Setup plugin resources to build, cleanup

This commit is contained in:
falkTX 2021-10-17 01:12:45 +01:00
parent 718e3707cc
commit 739359430a
4 changed files with 179 additions and 30 deletions

View file

@ -5,6 +5,7 @@
#
DEP_PATH = $(abspath ../src/Rack/dep)
OBJCOPY ?= objcopy
# --------------------------------------------------------------
# Import base definitions
@ -20,16 +21,25 @@ PLUGIN_FILES = plugins.cpp
# Befaco
PLUGIN_FILES += $(filter-out Befaco/src/plugin.cpp,$(wildcard Befaco/src/*.cpp))
PLUGIN_BINARIES += Befaco/src/SpringReverbIR.pcm
# Fundamental
PLUGIN_FILES += $(filter-out Fundamental/src/plugin.cpp,$(wildcard Fundamental/src/*.cpp))
# --------------------------------------------------------------
# Resources to symlink
# TODO
# PLUGIN_RESOURCES = res/Befaco/res
# PLUGIN_RESOURCES = res/Befaco/res
# --------------------------------------------------------------
# Build setup
BUILD_DIR = ../build/plugins
PLUGIN_OBJS = $(PLUGIN_FILES:%=$(BUILD_DIR)/%.o)
PLUGIN_OBJS = $(PLUGIN_FILES:%=$(BUILD_DIR)/%.o)
PLUGIN_OBJS += $(PLUGIN_BINARIES:%=$(BUILD_DIR)/%.bin.o)
ifeq ($(MACOS),true)
BASE_FLAGS += -DARCH_MAC
@ -42,6 +52,7 @@ endif
BUILD_C_FLAGS += -std=gnu11
BASE_FLAGS += -I../dpf/dgl/src/nanovg
BASE_FLAGS += -I../dpf/distrho
BASE_FLAGS += -I../src
BASE_FLAGS += -I../src/neon-compat
BASE_FLAGS += -I../src/Rack/include
@ -56,8 +67,10 @@ BASE_FLAGS += -I../src/Rack/dep/pffft
BASE_FLAGS += -pthread
ifeq ($(WINDOWS),true)
BASE_FLAGS += -D_USE_MATH_DEFINES
BASE_FLAGS += -Imingw-compat
BASE_FLAGS += -Imingw-std-threads
BASE_FLAGS += -municode
endif
# --------------------------------------------------------------
@ -66,6 +79,20 @@ endif
BASE_FLAGS += -Wno-unused-parameter
BASE_FLAGS += -Wno-unused-variable
# also lots of plugins not updated to v2 yet
BASE_FLAGS += -Wno-deprecated-declarations
# --------------------------------------------------------------
# temporary macro just to get the ball rolling
ifeq ($(EXE_WRAPPER),wine)
PLUGINS_DIR = Z:$(subst /,\\,$(CURDIR))
else
PLUGINS_DIR = $(CURDIR)
endif
BUILD_CXX_FLAGS += -DCARDINAL_PLUGINS_DIR='"$(PLUGINS_DIR)"'
# --------------------------------------------------------------
# Build targets
@ -100,6 +127,12 @@ $(BUILD_DIR)/Fundamental/%.cpp.o: Fundamental/%.cpp
@echo "Compiling $<"
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DpluginInstance=pluginInstance__Fundamental -c -o $@
# copied and adjusted from VCVRack's compile.mk
$(BUILD_DIR)/%.bin.o: % res2c.py
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Generating and Compiling $<"
$(shell ./res2c.py $< | $(CC) -x c - $(BUILD_C_FLAGS) -c -o $@)
# --------------------------------------------------------------
-include $(PLUGIN_OBJS:%.o=%.d)