diff --git a/CMakeLists.txt b/CMakeLists.txt index 7504482..284f8c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,17 @@ endif() if (WIN32) set (FORMATS Standalone VST VST3 LV2) else() - set (FORMATS Standalone VST VST3 AU LV2) + set (FORMATS Standalone VST3 AU LV2) +endif() + +# The VST2 SDK is an optional, non-redistributable submodule. Drop the VST +# format when it isn't checked out so the remaining formats still build. +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/plugin_sdk/vstsdk2.4/pluginterfaces/vst2.x/aeffect.h") + if (NOT WIN32) + list (INSERT FORMATS 1 VST) + endif() +else() + message (STATUS "VST2 SDK not found — skipping the VST format") endif() set_property (GLOBAL PROPERTY USE_FOLDERS YES) diff --git a/CMakePresets.json b/CMakePresets.json index edcdeae..addc8ec 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,6 +5,32 @@ "patch": 0 }, "version": 5, + "configurePresets": [ + { + "condition": { + "lhs": "${hostSystemName}", + "rhs": "Darwin", + "type": "equals" + }, + "displayName": "Build with Ninja on macOS", + "generator": "Ninja Multi-Config", + "inherits": "base", + "name": "macos" + } + ], + "buildPresets": [ + { + "condition": { + "lhs": "${hostSystemName}", + "rhs": "Darwin", + "type": "equals" + }, + "configurePreset": "macos", + "displayName": "Build with Ninja on macOS", + "inherits": "base", + "name": "macos" + } + ], "include": [ "modules/gin/ci/toolchains/xcode.json", "modules/gin/ci/toolchains/vs.json", diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f3d28fd --- /dev/null +++ b/Makefile @@ -0,0 +1,89 @@ +# Convenience Makefile for Wavetable +# Builds via CMake presets (see CMakePresets.json), then installs the plugin +# bundles into ~/Library/Audio/Plug-Ins and the factory resources into +# /Library/Audio/Presets (see the PRESET_ROOT note below). + +.PHONY: all configure build clean install uninstall uninstall-system pkg + +PRESET ?= $(shell \ + if command -v xcodebuild >/dev/null 2>&1 && xcodebuild -version >/dev/null 2>&1; then \ + echo xcode; \ + else \ + echo macos; \ + fi) +CONFIG ?= Release + +PLUGIN = Wavetable +VENDOR = SocaLabs + +BUILD_DIR = Builds/$(PRESET) +CACHE = $(BUILD_DIR)/CMakeCache.txt +ARTEFACTS = $(BUILD_DIR)/$(PLUGIN)_artefacts/$(CONFIG) +STAGE = $(BUILD_DIR)/install-stage + +# Bundles go in the user directory so no sudo is needed and hosts prefer them. +PLUGIN_ROOT = $(HOME)/Library/Audio/Plug-Ins + +# Factory presets and wavetables are only ever read from the system resource +# root on macOS (see systemResourceRoot() in PluginProcessor.cpp), so they have +# to go to /Library and need sudo. +SYSTEM_PLUGIN_ROOT = /Library/Audio/Plug-Ins +PRESET_ROOT = /Library/Audio/Presets/$(VENDOR)/$(PLUGIN) + +all: build + +configure: $(CACHE) + +$(CACHE): + cmake --preset $(PRESET) + +build: $(CACHE) + cmake --build --preset $(PRESET) --config $(CONFIG) + +clean: + cmake --build --preset $(PRESET) --target clean 2>/dev/null || true + rm -rf $(BUILD_DIR) + +install: build + @if [ -d "$(SYSTEM_PLUGIN_ROOT)/Components/$(PLUGIN).component" ] || [ -d "$(SYSTEM_PLUGIN_ROOT)/VST3/$(PLUGIN).vst3" ]; then \ + echo "WARNING: an older system-wide install still exists in $(SYSTEM_PLUGIN_ROOT)."; \ + echo " Hosts may load that one instead - run 'make uninstall-system'."; \ + fi + @test -d "$(ARTEFACTS)/AU/$(PLUGIN).component" || { echo "Missing AU artefact in $(ARTEFACTS)"; exit 1; } + @test -d "$(ARTEFACTS)/VST3/$(PLUGIN).vst3" || { echo "Missing VST3 artefact in $(ARTEFACTS)"; exit 1; } + @test -d "$(ARTEFACTS)/CLAP/$(PLUGIN).clap" || { echo "Missing CLAP artefact in $(ARTEFACTS)"; exit 1; } + @echo "Staging $(CONFIG) artefacts..." + @rm -rf $(STAGE) + @mkdir -p $(STAGE)/Components $(STAGE)/VST3 $(STAGE)/CLAP $(STAGE)/Presets $(STAGE)/Wavetables + @cp -R "$(ARTEFACTS)/AU/$(PLUGIN).component" $(STAGE)/Components/ + @cp -R "$(ARTEFACTS)/VST3/$(PLUGIN).vst3" $(STAGE)/VST3/ + @cp -R "$(ARTEFACTS)/CLAP/$(PLUGIN).clap" $(STAGE)/CLAP/ + @find plugin/Resources/Presets -name '*.xml' -type f -exec cp {} $(STAGE)/Presets/ \; + @cp -R plugin/Resources/WavetablesFLAC/. $(STAGE)/Wavetables/ + @echo "Installing bundles to $(PLUGIN_ROOT)..." + @mkdir -p $(PLUGIN_ROOT)/Components $(PLUGIN_ROOT)/VST3 $(PLUGIN_ROOT)/CLAP + @rsync -a --delete "$(STAGE)/Components/$(PLUGIN).component/" "$(PLUGIN_ROOT)/Components/$(PLUGIN).component/" + @rsync -a --delete "$(STAGE)/VST3/$(PLUGIN).vst3/" "$(PLUGIN_ROOT)/VST3/$(PLUGIN).vst3/" + @rsync -a --delete "$(STAGE)/CLAP/$(PLUGIN).clap/" "$(PLUGIN_ROOT)/CLAP/$(PLUGIN).clap/" + @echo "Installing resources to $(PRESET_ROOT)..." + sudo mkdir -p $(PRESET_ROOT)/Presets $(PRESET_ROOT)/Wavetables + sudo rsync -a --delete "$(STAGE)/Presets/" "$(PRESET_ROOT)/Presets/" + sudo rsync -a --delete "$(STAGE)/Wavetables/" "$(PRESET_ROOT)/Wavetables/" + @echo "Done. Restart your DAW to load the new binary." + +uninstall: + rm -rf $(PLUGIN_ROOT)/Components/$(PLUGIN).component + rm -rf $(PLUGIN_ROOT)/VST3/$(PLUGIN).vst3 + rm -rf $(PLUGIN_ROOT)/CLAP/$(PLUGIN).clap + rm -rf $(HOME)/Library/Audio/Presets/$(VENDOR)/$(PLUGIN) + +# Removes the older system-wide install, otherwise hosts may keep loading it +# instead of the copy in ~/Library. +uninstall-system: + sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/Components/$(PLUGIN).component + sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/VST3/$(PLUGIN).vst3 + sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/CLAP/$(PLUGIN).clap + sudo rm -rf $(PRESET_ROOT) + +pkg: + ./Installer/build.sh \ No newline at end of file