From f2d7df7b64b7732791783bb85857d69675ffe872 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 21 Aug 2021 15:41:31 +0100 Subject: [PATCH] Add resources to mac vst --- Makefile | 9 +++++++-- plugins/ProM/DistrhoUIProM.cpp | 27 ++++++++++++++++++--------- plugins/ProM/Makefile | 6 ++++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 3f991a1..103e4e5 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ plugins: dgl $(MAKE) all -C plugins/ProM ifneq ($(HAVE_PROJECTM),true) -resources: plugins +resources: gen # LV2 fonts install -d bin/ProM.lv2/resources/fonts ln -sf $(CURDIR)/plugins/ProM/projectM/fonts/*.ttf bin/ProM.lv2/resources/fonts/ @@ -30,7 +30,12 @@ resources: plugins install -d bin/ProM.lv2/resources/presets ln -sf $(CURDIR)/plugins/ProM/projectM/presets/presets_* bin/ProM.lv2/resources/presets/ ifeq ($(MACOS),true) -# TODO + # VST fonts + install -d bin/ProM.vst/Contents/Resources/fonts + ln -sf $(CURDIR)/plugins/ProM/projectM/fonts/*.ttf bin/ProM.vst/Contents/Resources/fonts/ + # VST presets + install -d bin/ProM.vst/Contents/Resources/presets + ln -sf $(CURDIR)/plugins/ProM/projectM/presets/presets_* bin/ProM.vst/Contents/Resources/presets/ else # VST directory install -d bin/ProM.vst diff --git a/plugins/ProM/DistrhoUIProM.cpp b/plugins/ProM/DistrhoUIProM.cpp index cd0c5a6..e0480be 100644 --- a/plugins/ProM/DistrhoUIProM.cpp +++ b/plugins/ProM/DistrhoUIProM.cpp @@ -38,20 +38,29 @@ static String getCurrentExecutableDataDir() #ifdef DISTRHO_OS_WINDOWS CHAR filename[MAX_PATH + 256]; - filename[0] = 0; + filename[0] = '\0'; GetModuleFileName(nullptr, filename, sizeof(filename)); datadir = String(filename); + datadir.truncate(datadir.rfind('\\')); #else Dl_info info; dladdr((void*)getCurrentExecutableDataDir, &info); datadir = String(info.dli_fname); + datadir.truncate(datadir.rfind('/')); - bool hasSlash; - const std::size_t slashPos = datadir.rfind('/', &hasSlash); - if (hasSlash) - datadir.truncate(slashPos); +# ifdef DISTRHO_OS_MAC + if (datadir.endsWith("/MacOS")) + { + datadir.truncate(datadir.rfind('/')); + datadir += "/Resources"; + } + else +# endif + { + datadir += "/resources"; + } #endif return datadir; @@ -147,10 +156,10 @@ void DistrhoUIProM::uiReshape(uint width, uint height) d_stdout("ProM datadir: '%s'", datadir.buffer()); projectM::Settings settings; - settings.presetURL = datadir + "/resources/presets"; - settings.titleFontURL = datadir + "/resources/fonts/Vera.ttf"; - settings.menuFontURL = datadir + "/resources/fonts/VeraMono.ttf"; - settings.datadir = datadir + "/resources"; + settings.presetURL = datadir + DISTRHO_OS_SEP_STR "presets"; + settings.titleFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "Vera.ttf"; + settings.menuFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "VeraMono.ttf"; + settings.datadir = datadir; fPM = new projectM(settings); #endif } diff --git a/plugins/ProM/Makefile b/plugins/ProM/Makefile index 983b517..b1410fc 100644 --- a/plugins/ProM/Makefile +++ b/plugins/ProM/Makefile @@ -147,17 +147,18 @@ endif # WINDOWS # silence projectM warnings BASE_FLAGS += -Wno-ignored-qualifiers BASE_FLAGS += -Wno-implicit-fallthrough -BASE_FLAGS += -Wno-maybe-uninitialized BASE_FLAGS += -Wno-overflow BASE_FLAGS += -Wno-shift-negative-value BASE_FLAGS += -Wno-sign-compare -BASE_FLAGS += -Wno-unused-but-set-variable BASE_FLAGS += -Wno-unused-parameter BASE_FLAGS += -Wno-unused-variable ifeq ($(MACOS),true) BASE_FLAGS += -Wno-constant-conversion BASE_FLAGS += -Wno-delete-non-abstract-non-virtual-dtor BASE_FLAGS += -Wno-mismatched-tags +else +BASE_FLAGS += -Wno-maybe-uninitialized +BASE_FLAGS += -Wno-unused-but-set-variable endif # MACOS ifeq ($(WINDOWS),true) BASE_FLAGS += -Wno-cast-function-type @@ -182,6 +183,7 @@ endif endif # HAVE_PROJECTM +# FIXME check if needed on windows LINK_FLAGS += -lpthread # --------------------------------------------------------------