Browse Source

Rework how resource files are installed

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 4 years ago
parent
commit
29122b180b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 25 additions and 21 deletions
  1. +14
    -8
      plugins/Makefile
  2. +1
    -1
      plugins/Mog
  3. +1
    -1
      src/Makefile.cardinal.mk
  4. +9
    -11
      src/custom/asset.cpp

+ 14
- 8
plugins/Makefile View File

@@ -838,34 +838,40 @@ else
PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json))
endif

RESOURCE_FILES = \
$(wildcard */presets) \
$(wildcard */res/*.svg) \
$(filter-out HetrickCV/res/illustrator - deprecated/MyModule.svg,$(wildcard */res/*/*.svg)) \
$(wildcard */res/*.ttf) $(wildcard */res/*/*.ttf)

PLUGIN_RESOURCES =
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.lv2/resources/%)
ifeq ($(MACOS),true)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst/Contents/Resources/%)
else
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst/resources/%)
endif
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst3/Contents/Resources/%)

resources: $(PLUGIN_RESOURCES)

../bin/CardinalFX.lv2/resources/%: %/res
../bin/CardinalFX.lv2/resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@

../bin/CardinalFX.vst/resources/%: %/res
../bin/CardinalFX.vst/resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@

../bin/CardinalFX.vst/Contents/Resources/%: %/res
../bin/CardinalFX.vst/Contents/Resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@

../bin/CardinalFX.vst3/Contents/Resources/%: %/res
../bin/CardinalFX.vst3/Contents/Resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@



+ 1
- 1
plugins/Mog

@@ -1 +1 @@
Subproject commit c1b128866786246a407c10713efb00ecc8486ced
Subproject commit 01c4fac9f2e91f60125d36767224f457b2057fb7

+ 1
- 1
src/Makefile.cardinal.mk View File

@@ -223,7 +223,7 @@ ifeq ($(NAME),CardinalFX)

all: lv2 vst2 vst3 resources

CORE_RESOURCES = $(filter-out icon.png,$(subst ../Rack/res/,,$(wildcard ../Rack/res/*))) template.vcv
CORE_RESOURCES = $(subst ../Rack/res/,,$(wildcard ../Rack/res/ComponentLibrary/*.svg ../Rack/res/fonts/*.ttf)) template.vcv

PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/CardinalFX.lv2/resources/%)
ifeq ($(MACOS),true)


+ 9
- 11
src/custom/asset.cpp View File

@@ -50,14 +50,16 @@ std::string user(std::string filename) {

// get system resource, trimming "res/" prefix if we are loaded as a plugin bundle
std::string system(std::string filename) {
if (string::endsWith(filename, "/ComponentLibrary/ScrewSilver.svg"))
// Always use dark screws
if (string::endsWith(filename, "/ScrewSilver.svg"))
filename = filename.substr(0, filename.size()-10) + "Black.svg";
return system::join(systemDir, bundlePath.empty() ? filename : trim(filename));
}

// get plugin resource, also trims "res/" as needed
// get plugin resource
std::string plugin(plugin::Plugin* plugin, std::string filename) {
DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, {});
// always use dark scheme
if (plugin->slug == "GlueTheGiant")
{
if (filename == "res/BusDepot.svg"
@@ -73,28 +75,24 @@ std::string plugin(plugin::Plugin* plugin, std::string filename) {
filename = filename.substr(0, filename.size()-4) + "_Night.svg";
}
}
return system::join(plugin->path, trim(filename));
return system::join(plugin->path, filename);
}

// path to plugin manifest
std::string pluginManifest(const std::string& dirname) {
// no bundlePath set, assume local source build
if (bundlePath.empty())
{
if (dirname == "Core")
return system::join(systemDir, "..", "..", "plugins", "Core.json");
return system::join(systemDir, "..", "..", "plugins", dirname, "plugin.json");
}
// bundlePath is present, use resources from bundle
return system::join(bundlePath, dirname + ".json");
}

// path to plugin files
std::string pluginPath(const std::string& dirname) {
// no bundlePath set, assume local source build
if (bundlePath.empty())
{
if (dirname == "Core")
return systemDir;
return system::join(systemDir, "..", "..", "plugins", "res", dirname);
}
// bundlePath is present, use resources from bundle
return system::join(systemDir, dirname);
}



Loading…
Cancel
Save