Browse Source

On non-x64, load plugins from `plugins-CPU` dir. Remove "-CPU" from plugin binary filename.

tags/v2.4.0
Andrew Belt 1 year ago
parent
commit
1052dc7b5f
2 changed files with 14 additions and 15 deletions
  1. +7
    -6
      plugin.mk
  2. +7
    -9
      src/plugin.cpp

+ 7
- 6
plugin.mk View File

@@ -24,10 +24,6 @@ LDFLAGS += -L$(RACK_DIR) -lRack
include $(RACK_DIR)/arch.mk include $(RACK_DIR)/arch.mk


TARGET := plugin TARGET := plugin
ifndef ARCH_X64
# On non-x64, append CPU name to plugin binary
TARGET := $(TARGET)-$(ARCH_CPU)
endif


ifdef ARCH_LIN ifdef ARCH_LIN
TARGET := $(TARGET).so TARGET := $(TARGET).so
@@ -52,6 +48,11 @@ ifdef ARCH_WIN
RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack2 RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack2
endif endif


PLUGINS_DIR := $(RACK_USER_DIR)/plugins
ifndef ARCH_X64
# On non-x64, append CPU name to plugins dir
PLUGINS_DIR := $(PLUGINS_DIR)-$(ARCH_CPU)
endif


DEP_FLAGS += -fPIC DEP_FLAGS += -fPIC
include $(RACK_DIR)/dep.mk include $(RACK_DIR)/dep.mk
@@ -88,8 +89,8 @@ endif
cd dist && tar -c $(SLUG) | zstd -$(ZSTD_COMPRESSION_LEVEL) -o "$(SLUG)"-"$(VERSION)"-$(ARCH_NAME).vcvplugin cd dist && tar -c $(SLUG) | zstd -$(ZSTD_COMPRESSION_LEVEL) -o "$(SLUG)"-"$(VERSION)"-$(ARCH_NAME).vcvplugin


install: dist install: dist
mkdir -p "$(RACK_USER_DIR)"/plugins/
cp dist/*.vcvplugin "$(RACK_USER_DIR)"/plugins/
mkdir -p "$(PLUGINS_DIR)"
cp dist/*.vcvplugin "$(PLUGINS_DIR)"/


.PHONY: clean dist .PHONY: clean dist
.DEFAULT_GOAL := all .DEFAULT_GOAL := all

+ 7
- 9
src/plugin.cpp View File

@@ -103,14 +103,7 @@ static InitCallback loadPluginCallback(Plugin* plugin) {
libraryExt = "dylib"; libraryExt = "dylib";
#endif #endif


#if defined ARCH_X64
// Use `plugin.EXT` on x64 for backward compatibility.
// Change to `plugin-OS-CPU.EXT` in Rack 3.
std::string libraryFilename = "plugin." + libraryExt; std::string libraryFilename = "plugin." + libraryExt;
#else
// Use `plugin-CPU.EXT` on other CPUs like ARM64
std::string libraryFilename = "plugin-" + APP_CPU + "." + libraryExt;
#endif
std::string libraryPath = system::join(plugin->path, libraryFilename); std::string libraryPath = system::join(plugin->path, libraryFilename);


// Check file existence // Check file existence
@@ -260,9 +253,14 @@ void init() {
// Load Core // Load Core
loadPlugin(""); loadPlugin("");


pluginsPath = asset::user("plugins");

// Get user plugins directory // Get user plugins directory
pluginsPath = asset::user("plugins");
// Use `plugins-CPU` dir on non-x64 platforms
#if !defined ARCH_X64
if (!settings::devMode) {
pluginsPath += "-" + APP_CPU;
}
#endif
system::createDirectory(pluginsPath); system::createDirectory(pluginsPath);


// Don't load plugins if safe mode is enabled // Don't load plugins if safe mode is enabled


Loading…
Cancel
Save