diff --git a/src/Cardinal/CardinalPlugin.cpp b/src/Cardinal/CardinalPlugin.cpp new file mode 120000 index 0000000..c0c7e71 --- /dev/null +++ b/src/Cardinal/CardinalPlugin.cpp @@ -0,0 +1 @@ +../CardinalPlugin.cpp \ No newline at end of file diff --git a/src/Cardinal/CardinalUI.cpp b/src/Cardinal/CardinalUI.cpp new file mode 120000 index 0000000..5558256 --- /dev/null +++ b/src/Cardinal/CardinalUI.cpp @@ -0,0 +1 @@ +../CardinalUI.cpp \ No newline at end of file diff --git a/src/DistrhoPluginInfo.h b/src/Cardinal/DistrhoPluginInfo.h similarity index 100% rename from src/DistrhoPluginInfo.h rename to src/Cardinal/DistrhoPluginInfo.h diff --git a/src/Cardinal/Makefile b/src/Cardinal/Makefile new file mode 100644 index 0000000..90e7891 --- /dev/null +++ b/src/Cardinal/Makefile @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +# Makefile for DISTRHO Plugins # +# ---------------------------- # +# Created by falkTX +# + +NAME = Cardinal +include ../Makefile.cardinal.mk diff --git a/src/Cardinal/MenuBar.cpp b/src/Cardinal/MenuBar.cpp new file mode 120000 index 0000000..8d1a35a --- /dev/null +++ b/src/Cardinal/MenuBar.cpp @@ -0,0 +1 @@ +../override/MenuBar.cpp \ No newline at end of file diff --git a/src/Cardinal/RemoteNanoVG.cpp b/src/Cardinal/RemoteNanoVG.cpp new file mode 120000 index 0000000..e6be4e7 --- /dev/null +++ b/src/Cardinal/RemoteNanoVG.cpp @@ -0,0 +1 @@ +../override/RemoteNanoVG.cpp \ No newline at end of file diff --git a/src/Cardinal/RemoteWindow.cpp b/src/Cardinal/RemoteWindow.cpp new file mode 120000 index 0000000..52195ae --- /dev/null +++ b/src/Cardinal/RemoteWindow.cpp @@ -0,0 +1 @@ +../override/RemoteWindow.cpp \ No newline at end of file diff --git a/src/Cardinal/Window.cpp b/src/Cardinal/Window.cpp new file mode 120000 index 0000000..759f272 --- /dev/null +++ b/src/Cardinal/Window.cpp @@ -0,0 +1 @@ +../override/Window.cpp \ No newline at end of file diff --git a/src/Cardinal/common.cpp b/src/Cardinal/common.cpp new file mode 120000 index 0000000..915948e --- /dev/null +++ b/src/Cardinal/common.cpp @@ -0,0 +1 @@ +../override/common.cpp \ No newline at end of file diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index cd423b5..08f8761 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -307,7 +307,9 @@ class CardinalPlugin : public CardinalBasePlugin { SharedResourcePointer fInitializer; +#if DISTRHO_PLUGIN_NUM_INPUTS != 0 float* fAudioBufferIn; +#endif float* fAudioBufferOut; std::string fAutosavePath; String fWindowSize; @@ -326,7 +328,9 @@ public: CardinalPlugin() : CardinalBasePlugin(kModuleParameters + kWindowParameterCount, 0, 2), fInitializer(this), +#if DISTRHO_PLUGIN_NUM_INPUTS != 0 fAudioBufferIn(nullptr), +#endif fAudioBufferOut(nullptr), fIsActive(false), fCurrentAudioDevice(nullptr), @@ -497,7 +501,11 @@ protected: const char* getLabel() const override { +#if DISTRHO_PLUGIN_IS_SYNTH + return "CardinalSynth"; +#else return "Cardinal"; +#endif } const char* getDescription() const override @@ -529,7 +537,11 @@ protected: int64_t getUniqueId() const override { +#if DISTRHO_PLUGIN_IS_SYNTH + return d_cconst('d', 'C', 'n', 'S'); +#else return d_cconst('d', 'C', 'd', 'n'); +#endif } /* -------------------------------------------------------------------------------------------------------- @@ -746,9 +758,11 @@ protected: void activate() override { const uint32_t bufferSize = getBufferSize() * DISTRHO_PLUGIN_NUM_OUTPUTS; - fAudioBufferIn = new float[bufferSize]; fAudioBufferOut = new float[bufferSize]; +#if DISTRHO_PLUGIN_NUM_INPUTS != 0 + fAudioBufferIn = new float[bufferSize]; std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize); +#endif { const MutexLocker cml(fDeviceMutex); @@ -767,9 +781,12 @@ protected: fCurrentAudioDevice->onStopStream(); } - delete[] fAudioBufferIn; delete[] fAudioBufferOut; - fAudioBufferIn = fAudioBufferOut = nullptr; + fAudioBufferOut = nullptr; +#if DISTRHO_PLUGIN_NUM_INPUTS != 0 + delete[] fAudioBufferIn; + fAudioBufferIn = nullptr; +#endif } void run(const float** const inputs, float** const outputs, const uint32_t frames, @@ -784,11 +801,13 @@ protected: if (fCurrentAudioDevice != nullptr) { +#if DISTRHO_PLUGIN_NUM_INPUTS != 0 for (uint32_t i=0, j=0; ihandleMessagesFromHost(midiEvents, midiEventCount); if (fCurrentAudioDevice != nullptr) - fCurrentAudioDevice->processBuffer(fAudioBufferIn, DISTRHO_PLUGIN_NUM_INPUTS, + { +#if DISTRHO_PLUGIN_NUM_INPUTS == 0 + const float* const insPtr = nullptr; +#else + const float* const insPtr = fAudioBufferIn; +#endif + fCurrentAudioDevice->processBuffer(insPtr, DISTRHO_PLUGIN_NUM_INPUTS, fAudioBufferOut, DISTRHO_PLUGIN_NUM_OUTPUTS, frames); + } if (fCurrentMidiOutput != nullptr) fCurrentMidiOutput->processMessages(); diff --git a/src/CardinalSynth/CardinalPlugin.cpp b/src/CardinalSynth/CardinalPlugin.cpp new file mode 120000 index 0000000..c0c7e71 --- /dev/null +++ b/src/CardinalSynth/CardinalPlugin.cpp @@ -0,0 +1 @@ +../CardinalPlugin.cpp \ No newline at end of file diff --git a/src/CardinalSynth/CardinalUI.cpp b/src/CardinalSynth/CardinalUI.cpp new file mode 120000 index 0000000..5558256 --- /dev/null +++ b/src/CardinalSynth/CardinalUI.cpp @@ -0,0 +1 @@ +../CardinalUI.cpp \ No newline at end of file diff --git a/src/CardinalSynth/DistrhoPluginInfo.h b/src/CardinalSynth/DistrhoPluginInfo.h new file mode 100644 index 0000000..00b1ae8 --- /dev/null +++ b/src/CardinalSynth/DistrhoPluginInfo.h @@ -0,0 +1,42 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the LICENSE file. + */ + +#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED +#define DISTRHO_PLUGIN_INFO_H_INCLUDED + +#define DISTRHO_PLUGIN_BRAND "DISTRHO" +#define DISTRHO_PLUGIN_NAME "Cardinal" +#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/cardinal#synth" + +#ifdef HEADLESS +#define DISTRHO_PLUGIN_HAS_UI 0 +#else +#define DISTRHO_PLUGIN_HAS_UI 1 +#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 +#define DISTRHO_UI_USE_NANOVG 1 +#define DISTRHO_UI_USER_RESIZABLE 1 +#endif +#define DISTRHO_PLUGIN_IS_SYNTH 1 +#define DISTRHO_PLUGIN_NUM_INPUTS 0 +#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 +#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 +#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1 +#define DISTRHO_PLUGIN_WANT_FULL_STATE 1 +#define DISTRHO_PLUGIN_WANT_STATE 1 +#define DISTRHO_PLUGIN_WANT_TIMEPOS 1 + +#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/src/CardinalSynth/Makefile b/src/CardinalSynth/Makefile new file mode 100644 index 0000000..59eab40 --- /dev/null +++ b/src/CardinalSynth/Makefile @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +# Makefile for DISTRHO Plugins # +# ---------------------------- # +# Created by falkTX +# + +NAME = CardinalSynth +include ../Makefile.cardinal.mk diff --git a/src/CardinalSynth/MenuBar.cpp b/src/CardinalSynth/MenuBar.cpp new file mode 120000 index 0000000..8d1a35a --- /dev/null +++ b/src/CardinalSynth/MenuBar.cpp @@ -0,0 +1 @@ +../override/MenuBar.cpp \ No newline at end of file diff --git a/src/CardinalSynth/RemoteNanoVG.cpp b/src/CardinalSynth/RemoteNanoVG.cpp new file mode 120000 index 0000000..e6be4e7 --- /dev/null +++ b/src/CardinalSynth/RemoteNanoVG.cpp @@ -0,0 +1 @@ +../override/RemoteNanoVG.cpp \ No newline at end of file diff --git a/src/CardinalSynth/RemoteWindow.cpp b/src/CardinalSynth/RemoteWindow.cpp new file mode 120000 index 0000000..52195ae --- /dev/null +++ b/src/CardinalSynth/RemoteWindow.cpp @@ -0,0 +1 @@ +../override/RemoteWindow.cpp \ No newline at end of file diff --git a/src/CardinalSynth/Window.cpp b/src/CardinalSynth/Window.cpp new file mode 120000 index 0000000..759f272 --- /dev/null +++ b/src/CardinalSynth/Window.cpp @@ -0,0 +1 @@ +../override/Window.cpp \ No newline at end of file diff --git a/src/CardinalSynth/common.cpp b/src/CardinalSynth/common.cpp new file mode 120000 index 0000000..915948e --- /dev/null +++ b/src/CardinalSynth/common.cpp @@ -0,0 +1 @@ +../override/common.cpp \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index 6f8fa98..55485f3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,36 +11,6 @@ PREFIX ?= /usr/local DESTDIR ?= SYSDEPS ?= false -# -------------------------------------------------------------- -# Project name, used for binaries - -NAME = Cardinal - -# -------------------------------------------------------------- -# Files to build (DPF stuff) - -FILES_DSP = \ - CardinalPlugin.cpp \ - override/asset.cpp \ - override/common.cpp \ - override/context.cpp \ - override/dep.cpp \ - override/library.cpp \ - override/network.cpp \ - override/osdialog.cpp - -ifeq ($(HEADLESS),true) -FILES_DSP += \ - override/RemoteNanoVG.cpp \ - override/RemoteWindow.cpp -else -FILES_UI = \ - CardinalUI.cpp \ - AsyncDialog.cpp \ - override/MenuBar.cpp \ - override/Window.cpp -endif - # -------------------------------------------------------------- # Import base definitions @@ -48,61 +18,9 @@ USE_NANOVG_FBO = true include ../dpf/Makefile.base.mk # -------------------------------------------------------------- -# Files to build (VCV stuff) - -FILES_DSP += Rack/dep/pffft/pffft.c -FILES_DSP += Rack/dep/pffft/fftpack.c -FILES_DSP += Rack/dep/osdialog/osdialog.c -FILES_DSP += Rack/dep/oui-blendish/blendish.c - -IGNORED_FILES = Rack/src/asset.cpp -IGNORED_FILES += Rack/src/common.cpp -IGNORED_FILES += Rack/src/context.cpp -IGNORED_FILES += Rack/src/dep.cpp -IGNORED_FILES += Rack/src/discord.cpp -IGNORED_FILES += Rack/src/gamepad.cpp -IGNORED_FILES += Rack/src/keyboard.cpp -IGNORED_FILES += Rack/src/library.cpp -IGNORED_FILES += Rack/src/network.cpp -IGNORED_FILES += Rack/src/rtaudio.cpp -IGNORED_FILES += Rack/src/rtmidi.cpp -IGNORED_FILES += Rack/src/app/MenuBar.cpp -IGNORED_FILES += Rack/src/window/Window.cpp - -FILES_DSP += $(wildcard Rack/src/*.c) -FILES_DSP += $(wildcard Rack/src/*/*.c) -FILES_DSP += $(filter-out $(IGNORED_FILES),$(wildcard Rack/src/*.cpp)) -FILES_DSP += $(filter-out $(IGNORED_FILES), $(wildcard Rack/src/*/*.cpp)) - -# -------------------------------------------------------------- -# Extra libraries to link against - -ifneq ($(SYSDEPS),true) -EXTRA_LIBS = ../plugins/plugins.a -EXTRA_LIBS += Rack/dep/lib/libjansson.a -EXTRA_LIBS += Rack/dep/lib/libsamplerate.a -EXTRA_LIBS += Rack/dep/lib/libspeexdsp.a -ifeq ($(WINDOWS),true) -EXTRA_LIBS += Rack/dep/lib/libarchive_static.a -else -EXTRA_LIBS += Rack/dep/lib/libarchive.a -endif -EXTRA_LIBS += Rack/dep/lib/libzstd.a - -EXTRA_DEPENDENCIES = $(EXTRA_LIBS) -endif - -# -------------------------------------------------------------- -# Do some magic +# Build setup -DPF_PATH = ../dpf -DPF_BUILD_DIR = ../build -DPF_TARGET_DIR = ../bin -USE_VST2_BUNDLE = true -include ../dpf/Makefile.plugins.mk - -# -------------------------------------------------------------- -# Extra flags for VCV stuff +BUILD_DIR = ../build/rack ifeq ($(MACOS),true) BASE_FLAGS += -DARCH_MAC @@ -114,6 +32,7 @@ endif BASE_FLAGS += -fno-finite-math-only BASE_FLAGS += -I../dpf/dgl/src/nanovg +BASE_FLAGS += -I../dpf/distrho BASE_FLAGS += -I../include BASE_FLAGS += -I../include/neon-compat BASE_FLAGS += -IRack/include @@ -149,96 +68,87 @@ endif BUILD_C_FLAGS += -std=gnu11 # -------------------------------------------------------------- -# FIXME lots of warnings from VCV side - -BASE_FLAGS += -Wno-unused-parameter -BASE_FLAGS += -Wno-unused-variable - -# -------------------------------------------------------------- -# extra linker flags +# Rack files to build -LINK_FLAGS += -pthread - -ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) -LINK_FLAGS += -ldl -endif +RACK_FILES += AsyncDialog.cpp +RACK_FILES += override/asset.cpp +RACK_FILES += override/context.cpp +RACK_FILES += override/dep.cpp +RACK_FILES += override/library.cpp +RACK_FILES += override/network.cpp +RACK_FILES += override/osdialog.cpp -ifeq ($(MACOS),true) -LINK_FLAGS += -framework IOKit -else ifeq ($(WINDOWS),true) -LINK_FLAGS += -ldbghelp -lshlwapi -# needed by JW-Modules -EXTRA_LIBS += -lws2_32 -lwinmm -endif +RACK_FILES += Rack/dep/pffft/pffft.c +RACK_FILES += Rack/dep/pffft/fftpack.c +RACK_FILES += Rack/dep/osdialog/osdialog.c +RACK_FILES += Rack/dep/oui-blendish/blendish.c -ifeq ($(SYSDEPS),true) -LINK_FLAGS += $(shell pkg-config --libs jansson libarchive samplerate speexdsp) -endif +IGNORED_FILES = Rack/src/asset.cpp +IGNORED_FILES += Rack/src/common.cpp +IGNORED_FILES += Rack/src/context.cpp +IGNORED_FILES += Rack/src/dep.cpp +IGNORED_FILES += Rack/src/discord.cpp +IGNORED_FILES += Rack/src/gamepad.cpp +IGNORED_FILES += Rack/src/keyboard.cpp +IGNORED_FILES += Rack/src/library.cpp +IGNORED_FILES += Rack/src/network.cpp +IGNORED_FILES += Rack/src/rtaudio.cpp +IGNORED_FILES += Rack/src/rtmidi.cpp +IGNORED_FILES += Rack/src/app/MenuBar.cpp +IGNORED_FILES += Rack/src/window/Window.cpp -ifeq ($(WITH_LTO),true) -LINK_FLAGS += -fno-strict-aliasing -flto -Werror=odr -Werror=lto-type-mismatch -endif +RACK_FILES += $(wildcard Rack/src/*.c) +RACK_FILES += $(wildcard Rack/src/*/*.c) +RACK_FILES += $(filter-out $(IGNORED_FILES),$(wildcard Rack/src/*.cpp)) +RACK_FILES += $(filter-out $(IGNORED_FILES), $(wildcard Rack/src/*/*.cpp)) # -------------------------------------------------------------- -# optional liblo +# FIXME lots of warnings from VCV side -ifeq ($(HAVE_LIBLO),true) -BASE_FLAGS += $(LIBLO_FLAGS) -LINK_FLAGS += $(LIBLO_LIBS) -endif +BASE_FLAGS += -Wno-unused-parameter +BASE_FLAGS += -Wno-unused-variable # -------------------------------------------------------------- -# fallback path to resource files - -ifeq ($(EXE_WRAPPER),wine) -SOURCE_DIR = Z:$(subst /,\\,$(CURDIR)) -else -SOURCE_DIR = $(CURDIR) -endif +# Build targets -ifneq ($(SYSDEPS),true) -BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_SOURCE_DIR='"$(SOURCE_DIR)"' -endif +TARGET = rack.a -BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"' +all: $(TARGET) + $(MAKE) -C Cardinal + $(MAKE) -C CardinalSynth -# -------------------------------------------------------------- -# Enable all possible plugin types +resources: + $(MAKE) resources -C Cardinal + $(MAKE) resources -C CardinalSynth -all: jack lv2 vst2 vst3 resources +clean: + rm -f $(TARGET) + rm -rf $(BUILD_DIR) + $(MAKE) clean -C Cardinal + $(MAKE) clean -C CardinalSynth # -------------------------------------------------------------- +# Build commands -CORE_RESOURCES = $(subst Rack/res/,,$(wildcard Rack/res/*)) template.vcv - -PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.lv2/resources/%) -ifeq ($(MACOS),true) -PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst/Contents/Resources/%) -else -PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst/resources/%) -endif -PLUGIN_RESOURCES += $(CORE_RESOURCES:%=../bin/Cardinal.vst3/Contents/Resources/%) +RACK_OBJS = $(RACK_FILES:%=$(BUILD_DIR)/%.o) -resources: $(PLUGIN_RESOURCES) +$(TARGET): $(RACK_OBJS) + @echo "Creating $@" + $(SILENT)rm -f $@ + $(SILENT)$(AR) crs $@ $^ -../bin/Cardinal.%/template.vcv: template.vcv - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ +$(BUILD_DIR)/%.c.o: %.c + -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" + @echo "Compiling $<" + $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@ -../bin/Cardinal.lv2/resources/%: Rack/res/% - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ +$(BUILD_DIR)/%.cpp.o: %.cpp + -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" + @echo "Compiling $<" + $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ -../bin/Cardinal.vst/resources/%: Rack/res/% - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ - -../bin/Cardinal.vst/Contents/Resources/%: Rack/res/% - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ +# -------------------------------------------------------------- -../bin/Cardinal.vst3/Contents/Resources/%: Rack/res/% - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ +-include $(RACK_OBJS:%.o=%.d) # -------------------------------------------------------------- diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk new file mode 100644 index 0000000..33a66bc --- /dev/null +++ b/src/Makefile.cardinal.mk @@ -0,0 +1,217 @@ +#!/usr/bin/make -f +# Makefile for DISTRHO Plugins # +# ---------------------------- # +# Created by falkTX +# + +# Must have NAME defined + +# -------------------------------------------------------------- +# Build config + +PREFIX ?= /usr/local +DESTDIR ?= +SYSDEPS ?= false + +# -------------------------------------------------------------- +# Files to build (DPF stuff) + +FILES_DSP = CardinalPlugin.cpp +FILES_DSP += common.cpp + +ifeq ($(HEADLESS),true) +FILES_DSP += RemoteNanoVG.cpp +FILES_DSP += RemoteWindow.cpp +else +FILES_UI = CardinalUI.cpp +FILES_UI += MenuBar.cpp +FILES_UI += Window.cpp +endif + +# -------------------------------------------------------------- +# Extra libraries to link against + +EXTRA_LIBS = ../../plugins/plugins.a +EXTRA_LIBS += ../rack.a + +ifneq ($(SYSDEPS),true) +EXTRA_LIBS += ../Rack/dep/lib/libjansson.a +EXTRA_LIBS += ../Rack/dep/lib/libsamplerate.a +EXTRA_LIBS += ../Rack/dep/lib/libspeexdsp.a +ifeq ($(WINDOWS),true) +EXTRA_LIBS += ../Rack/dep/lib/libarchive_static.a +else +EXTRA_LIBS += ../Rack/dep/lib/libarchive.a +endif +EXTRA_LIBS += ../Rack/dep/lib/libzstd.a +endif + +EXTRA_DEPENDENCIES = $(EXTRA_LIBS) + +# -------------------------------------------------------------- +# Do some magic + +USE_NANOVG_FBO = true +USE_VST2_BUNDLE = true +include ../../dpf/Makefile.plugins.mk + +# -------------------------------------------------------------- +# Extra flags for VCV stuff + +ifeq ($(MACOS),true) +BASE_FLAGS += -DARCH_MAC +else ifeq ($(WINDOWS),true) +BASE_FLAGS += -DARCH_WIN +else +BASE_FLAGS += -DARCH_LIN +endif + +BASE_FLAGS += -fno-finite-math-only +BASE_FLAGS += -I.. +BASE_FLAGS += -I../../dpf/dgl/src/nanovg +BASE_FLAGS += -I../../include +BASE_FLAGS += -I../../include/neon-compat +BASE_FLAGS += -I../Rack/include +ifeq ($(SYSDEPS),true) +BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) +else +BASE_FLAGS += -I../Rack/dep/include +endif +BASE_FLAGS += -I../Rack/dep/glfw/include +BASE_FLAGS += -I../Rack/dep/nanosvg/src +BASE_FLAGS += -I../Rack/dep/oui-blendish +BASE_FLAGS += -pthread + +ifeq ($(WINDOWS),true) +BASE_FLAGS += -D_USE_MATH_DEFINES +BASE_FLAGS += -DWIN32_LEAN_AND_MEAN +BASE_FLAGS += -I../../include/mingw-compat +BASE_FLAGS += -I../../include/mingw-std-threads +endif + +ifeq ($(HEADLESS),true) +BASE_FLAGS += -DHEADLESS +endif + +ifeq ($(WITH_LTO),true) +BASE_FLAGS += -fno-strict-aliasing -flto +endif + +BUILD_C_FLAGS += -std=gnu11 + +# -------------------------------------------------------------- +# FIXME lots of warnings from VCV side + +BASE_FLAGS += -Wno-unused-parameter +BASE_FLAGS += -Wno-unused-variable + +# -------------------------------------------------------------- +# extra linker flags + +LINK_FLAGS += -pthread + +ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) +LINK_FLAGS += -ldl +endif + +ifeq ($(MACOS),true) +LINK_FLAGS += -framework IOKit +else ifeq ($(WINDOWS),true) +LINK_FLAGS += -ldbghelp -lshlwapi +# needed by JW-Modules +EXTRA_LIBS += -lws2_32 -lwinmm +endif + +ifeq ($(SYSDEPS),true) +LINK_FLAGS += $(shell pkg-config --libs jansson libarchive samplerate speexdsp) +endif + +ifeq ($(WITH_LTO),true) +LINK_FLAGS += -fno-strict-aliasing -flto -Werror=odr -Werror=lto-type-mismatch +endif + +# -------------------------------------------------------------- +# optional liblo + +ifeq ($(HAVE_LIBLO),true) +BASE_FLAGS += $(LIBLO_FLAGS) +LINK_FLAGS += $(LIBLO_LIBS) +endif + +# -------------------------------------------------------------- +# fallback path to resource files + +ifeq ($(EXE_WRAPPER),wine) +SOURCE_DIR = Z:$(subst /,\\,$(abspath $(CURDIR)/..)) +else +SOURCE_DIR = $(abspath $(CURDIR)/..) +endif + +ifneq ($(SYSDEPS),true) +BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_SOURCE_DIR='"$(SOURCE_DIR)"' +endif + +BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"' + +# -------------------------------------------------------------- +# Enable all possible plugin types + +all: jack lv2 vst2 vst3 resources + +# -------------------------------------------------------------- + +ifeq ($(NAME),Cardinal) + +CORE_RESOURCES = $(subst ../Rack/res/,,$(wildcard ../Rack/res/*)) ../template.vcv + +PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.lv2/resources/%) +ifeq ($(MACOS),true) +PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.vst/Contents/Resources/%) +else +PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.vst/resources/%) +endif +PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.vst3/Contents/Resources/%) + +else + +PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).lv2/resources +ifeq ($(MACOS),true) +PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).vst/Contents/Resources +else +PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).vst/resources +endif +PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).vst3/Contents/Resources + +endif + +# -------------------------------------------------------------- + +resources: $(PLUGIN_RESOURCES) + +ifneq ($(NAME),Cardinal) +$(TARGET_DIR)/$(NAME).%: $(TARGET_DIR)/Cardinal.% + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ +endif + +$(TARGET_DIR)/Cardinal.%/template.vcv: ../template.vcv + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ + +$(TARGET_DIR)/Cardinal.lv2/resources/%: ../Rack/res/% + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ + +$(TARGET_DIR)/Cardinal.vst/resources/%: ../Rack/res/% + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ + +$(TARGET_DIR)/Cardinal.vst/Contents/Resources/%: ../Rack/res/% + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ + +$(TARGET_DIR)/Cardinal.vst3/Contents/Resources/%: ../Rack/res/% + -@mkdir -p "$(shell dirname $@)" + ln -sf $(abspath $<) $@ + +# -------------------------------------------------------------- diff --git a/src/override/Window.cpp b/src/override/Window.cpp index 5c3e40b..35a6ca5 100644 --- a/src/override/Window.cpp +++ b/src/override/Window.cpp @@ -29,8 +29,6 @@ #include #include -#include - #include #include #include diff --git a/src/override/asset.cpp b/src/override/asset.cpp index d9a9b13..01e2820 100644 --- a/src/override/asset.cpp +++ b/src/override/asset.cpp @@ -19,6 +19,10 @@ #include #include +#ifdef NDEBUG +# undef DEBUG +#endif + #include #include "DistrhoUtils.hpp" diff --git a/src/override/common.cpp b/src/override/common.cpp index 1161457..0fb286b 100644 --- a/src/override/common.cpp +++ b/src/override/common.cpp @@ -28,6 +28,10 @@ #include #include +#ifdef NDEBUG +# undef DEBUG +#endif + #include "DistrhoPluginUtils.hpp" // fopen_u8 diff --git a/src/override/context.cpp b/src/override/context.cpp index f3c6cd6..4f1cddf 100644 --- a/src/override/context.cpp +++ b/src/override/context.cpp @@ -6,7 +6,11 @@ #include #include -#include "DistrhoPluginUtils.hpp" +#ifdef NDEBUG +# undef DEBUG +#endif + +#include "DistrhoUtils.hpp" /** * This file is an edited version of VCVRack's context.cpp