diff --git a/.gitmodules b/.gitmodules index 6a04d42..b826b30 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,15 @@ [submodule "plugins/Cardinal/Rack"] - path = plugins/Cardinal/Rack + path = src/Rack url = https://github.com/VCVRack/Rack.git [submodule "dpf"] path = dpf url = https://github.com/DISTRHO/DPF.git [submodule "plugins/Cardinal/mingw-std-threads"] - path = plugins/Cardinal/mingw-std-threads + path = src/mingw-std-threads url = https://github.com/meganz/mingw-std-threads.git [submodule "plugins/Cardinal/sse2neon"] - path = plugins/Cardinal/sse2neon + path = src/sse2neon url = https://github.com/DLTcollab/sse2neon.git +[submodule "plugins/Fundamental"] + path = plugins/Fundamental + url = https://github.com/VCVRack/Fundamental.git diff --git a/Makefile b/Makefile index 67b3ab1..f5e7ca3 100644 --- a/Makefile +++ b/Makefile @@ -6,18 +6,25 @@ include dpf/Makefile.base.mk -all: dgl plugins gen +all: cardinal deps dgl plugins gen # -------------------------------------------------------------- +cardinal: deps dgl plugins + $(MAKE) all -C src + +deps: + $(MAKE) all -C deps + dgl: $(MAKE) USE_NANOVG_FBO=true USE_RGBA=true -C dpf/dgl opengl + # $(MAKE) opengl -C dpf/dgl USE_NANOVG_FBO=true USE_RGBA=true -plugins: dgl - $(MAKE) all -C plugins/Cardinal +plugins: deps + $(MAKE) all -C plugins ifneq ($(CROSS_COMPILING),true) -gen: plugins dpf/utils/lv2_ttl_generator +gen: cardinal dpf/utils/lv2_ttl_generator @$(CURDIR)/dpf/utils/generate-ttl.sh ifeq ($(MACOS),true) @$(CURDIR)/dpf/utils/generate-vst-bundles.sh @@ -32,19 +39,13 @@ endif # -------------------------------------------------------------- clean: + $(MAKE) clean -C deps $(MAKE) clean -C dpf/dgl $(MAKE) clean -C dpf/utils/lv2-ttl-generator - $(MAKE) clean -C plugins/Cardinal + $(MAKE) clean -C plugins + $(MAKE) clean -C src rm -rf bin build - rm -rf plugins/Cardinal/Rack/dep/bin - rm -rf plugins/Cardinal/Rack/dep/include - rm -rf plugins/Cardinal/Rack/dep/lib - rm -rf plugins/Cardinal/Rack/dep/share - rm -rf plugins/Cardinal/Rack/dep/jansson-2.12 - rm -rf plugins/Cardinal/Rack/dep/libarchive-3.4.3 - rm -rf plugins/Cardinal/Rack/dep/speexdsp-SpeexDSP-1.2rc3 - rm -rf plugins/Cardinal/Rack/dep/zstd-1.4.5 # -------------------------------------------------------------- -.PHONY: plugins +.PHONY: deps plugins diff --git a/deps/Makefile b/deps/Makefile new file mode 100644 index 0000000..03d8718 --- /dev/null +++ b/deps/Makefile @@ -0,0 +1,149 @@ +#!/usr/bin/make -f +# Makefile for Cardinal # +# --------------------- # +# Created by falkTX +# + +DEP_PATH = $(abspath ../src/Rack/dep) + +# -------------------------------------------------------------- +# Import base definitions + +USE_NANOVG_FBO = true +USE_RGBA = true +include ../dpf/Makefile.base.mk + +# -------------------------------------------------------------- +# override VCV arch.mk stuff so we can build more architectures + +ifeq ($(CPU_ARM),true) +ARCH_NAME = arm +MACHINE = i686-bring-forth-the-rack +else ifeq ($(CPU_ARM64),true) +ARCH_NAME = arm64 +MACHINE = x86_64-bring-forth-the-rack +else ifeq ($(CPU_AARCH64),true) +ARCH_NAME = aarch64 +MACHINE = x86_64-bring-forth-the-rack +else +MACHINE = $(TARGET_MACHINE) +endif + +ifneq ($(MACOS_OR_WINDOWS),true) +MACHINE_SUFFIX = -linux +endif + +# NOTE speex fails to build when neon is enabled +CONFIGURE = ./configure --prefix="$(DEP_PATH)" --host=$(TARGET_MACHINE) --enable-neon=no + +# -------------------------------------------------------------- +# Fix up cmake + +SPACE = +SPACE += + +CMAKE = cmake + +ifneq (,$(findstring -arch$(SPACE),$(CXXFLAGS))) +CMAKE += -DCMAKE_OSX_ARCHITECTURES='$(subst $(SPACE),;,$(subst -arch=,,$(filter -arch=%,$(subst -arch$(SPACE),-arch=,$(CXXFLAGS)))))' +endif +ifneq (,$(findstring -mmacosx-version-min=,$(CXXFLAGS))) +CMAKE += -DCMAKE_OSX_DEPLOYMENT_TARGET=$(subst -mmacosx-version-min=,,$(filter -mmacosx-version-min=%,$(CXXFLAGS))) +endif + +ifeq ($(WINDOWS),true) +CMAKE += -G 'Unix Makefiles' +CMAKE += -DCMAKE_RC_COMPILER=$(subst gcc,windres,$(CC)) +CMAKE += -DCMAKE_SYSTEM_NAME=Windows +endif + +ifeq ($(DEBUG),true) +CMAKE += -DCMAKE_BUILD_TYPE=Debug +else +CMAKE += -DCMAKE_BUILD_TYPE=Release +endif + +CMAKE += -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX='$(DEP_PATH)' + +# -------------------------------------------------------------- +# VCV internal dependencies target + +$(DEP_PATH)/lib/%.a: + $(MAKE) \ + ARCH_NAME=$(ARCH_NAME) \ + CFLAGS="$(BUILD_C_FLAGS)" \ + CXXFLAGS="$(BUILD_CXX_FLAGS)" \ + LDFLAGS="$(LINK_FLAGS)" \ + CMAKE="$(CMAKE)" \ + CONFIGURE="$(CONFIGURE)" \ + DEP_FLAGS="$(BASE_FLAGS)" \ + DEP_MAC_SDK_FLAGS= \ + MACHINE=$(MACHINE)$(MACHINE_SUFFIX) \ + -C $(DEP_PATH) lib/$*.a + +$(DEP_PATH)/lib/libarchive.a: $(DEP_PATH)/lib/libzstd.a + +$(DEP_PATH)/lib/libarchive_static.a: $(DEP_PATH)/lib/libzstd.a + +ifeq ($(MACOS),true) +# zstd cmake is borked, see https://github.com/facebook/zstd/issues/1401 +$(DEP_PATH)/lib/libzstd.a: $(DEP_PATH)/zstd-1.4.5/.stamp-patched + +$(DEP_PATH)/zstd-1.4.5/.stamp-patched: + $(MAKE) -C $(DEP_PATH) zstd-1.4.5 + sed -i -e "56,66d" $(DEP_PATH)/zstd-1.4.5/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake + touch $@ +endif + +# libsamplerate fails to link its tests in some systems +$(DEP_PATH)/libsamplerate-0.1.9: + $(MAKE) -C $(DEP_PATH) libsamplerate-0.1.9 + +$(DEP_PATH)/lib/libsamplerate.a: $(DEP_PATH)/libsamplerate-0.1.9 + cd $(DEP_PATH)/libsamplerate-0.1.9 && $(CONFIGURE) --disable-fftw --disable-sndfile + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/termination_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/simple_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/misc_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/callback_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/reset_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/varispeed_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/float_short_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/multi_channel_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/callback_hang_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/src-evaluate + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/throughput_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/multichan_throughput_test + touch $(DEP_PATH)/libsamplerate-0.1.9/tests/downsample_test + $(MAKE) -C $(DEP_PATH)/libsamplerate-0.1.9 + $(MAKE) -C $(DEP_PATH)/libsamplerate-0.1.9 install + +# -------------------------------------------------------------- +# Build targets + +TARGETS += $(DEP_PATH)/lib/libjansson.a +TARGETS += $(DEP_PATH)/lib/libsamplerate.a +TARGETS += $(DEP_PATH)/lib/libspeexdsp.a + +ifeq ($(WINDOWS),true) +TARGETS += $(DEP_PATH)/lib/libarchive_static.a +else +TARGETS += $(DEP_PATH)/lib/libarchive.a +endif + +TARGETS += $(DEP_PATH)/lib/libzstd.a + +all: $(TARGETS) + +clean: + rm -f $(TARGETS) + rm -rf $(DEP_PATH)/bin + rm -rf $(DEP_PATH)/include + rm -rf $(DEP_PATH)/lib + rm -rf $(DEP_PATH)/share + rm -rf $(DEP_PATH)/jansson-2.12 + rm -rf $(DEP_PATH)/libarchive-3.4.3 + rm -rf $(DEP_PATH)/libsamplerate-0.1.9 + rm -rf $(DEP_PATH)/speexdsp-SpeexDSP-1.2rc3 + rm -rf $(DEP_PATH)/zstd-1.4.5 + +# -------------------------------------------------------------- diff --git a/dpf b/dpf index 2711cbe..2f1b512 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 2711cbefa481c3ebed1ca9dbda190bf915d8b0b9 +Subproject commit 2f1b5127cc2da84e3c3f155808efb34d650b3489 diff --git a/plugins/Cardinal/GL/glew.h b/plugins/Cardinal/GL/glew.h deleted file mode 100644 index 1a3a19b..0000000 --- a/plugins/Cardinal/GL/glew.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#ifdef NDEBUG -# undef DEBUG -#endif - -#include "OpenGL.hpp" diff --git a/plugins/Cardinal/Rack b/plugins/Cardinal/Rack deleted file mode 160000 index 042a9ce..0000000 --- a/plugins/Cardinal/Rack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 042a9ce026d253700ea14e340182900162ab4653 diff --git a/plugins/Fundamental b/plugins/Fundamental new file mode 160000 index 0000000..baaf463 --- /dev/null +++ b/plugins/Fundamental @@ -0,0 +1 @@ +Subproject commit baaf463db2bcd9d4f577f209b3795d7321a174fe diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..1e3f80e --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,99 @@ +#!/usr/bin/make -f +# Makefile for Cardinal # +# --------------------- # +# Created by falkTX +# + +DEP_PATH = $(abspath ../src/Rack/dep) + +# -------------------------------------------------------------- +# Import base definitions + +USE_NANOVG_FBO = true +USE_RGBA = true +include ../dpf/Makefile.base.mk + +# -------------------------------------------------------------- +# Files to build + +PLUGIN_FILES = plugins.cpp + +# Fundamental +PLUGIN_FILES += $(filter-out Fundamental/src/plugin.cpp,$(wildcard Fundamental/src/*.cpp)) + +# -------------------------------------------------------------- +# Build setup + +BUILD_DIR = ../build/plugins + +PLUGIN_OBJS = $(PLUGIN_FILES:%=$(BUILD_DIR)/%.o) + +ifeq ($(MACOS),true) +BASE_FLAGS += -DARCH_MAC +else ifeq ($(WINDOWS),true) +BASE_FLAGS += -DARCH_WIN +else +BASE_FLAGS += -DARCH_LIN +endif + +BUILD_C_FLAGS += -std=gnu11 + +BASE_FLAGS += -I../dpf/dgl/src/nanovg +BASE_FLAGS += -I../src +BASE_FLAGS += -I../src/neon-compat +BASE_FLAGS += -I../src/Rack/include +BASE_FLAGS += -I../src/Rack/dep/include +# BASE_FLAGS += -I../src/Rack/dep/filesystem/include +# BASE_FLAGS += -I../src/Rack/dep/fuzzysearchdatabase/src +BASE_FLAGS += -I../src/Rack/dep/glfw/include +BASE_FLAGS += -I../src/Rack/dep/nanosvg/src +# BASE_FLAGS += -I../src/Rack/dep/osdialog +BASE_FLAGS += -I../src/Rack/dep/oui-blendish +BASE_FLAGS += -I../src/Rack/dep/pffft +BASE_FLAGS += -pthread + +ifeq ($(WINDOWS),true) +BASE_FLAGS += -Imingw-compat +BASE_FLAGS += -Imingw-std-threads +endif + +# -------------------------------------------------------------- +# FIXME lots of warnings from VCV side + +BASE_FLAGS += -Wno-unused-parameter +BASE_FLAGS += -Wno-unused-variable + +# -------------------------------------------------------------- +# Build targets + +TARGET = plugins.a + +all: $(TARGET) + +clean: + rm -f $(TARGET) + rm -rf $(BUILD_DIR) + +# -------------------------------------------------------------- +# Build commands + +$(TARGET): $(PLUGIN_OBJS) + @echo "Creating $@" + $(SILENT)rm -f $@ + $(SILENT)$(AR) crs $@ $^ + +$(BUILD_DIR)/plugins.cpp.o: plugins.cpp + -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" + @echo "Compiling $<" + $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DpluginInstance=pluginInstance__Fundamental -c -o $@ + +$(BUILD_DIR)/Fundamental/%.cpp.o: Fundamental/%.cpp + -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" + @echo "Compiling $<" + $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DpluginInstance=pluginInstance__Fundamental -c -o $@ + +# -------------------------------------------------------------- + +-include $(PLUGIN_OBJS:%.o=%.d) + +# -------------------------------------------------------------- diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp new file mode 100644 index 0000000..ed5a4d7 --- /dev/null +++ b/plugins/plugins.cpp @@ -0,0 +1,67 @@ +/* + * 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. + */ + +#include + +#include "Fundamental/src/plugin.hpp" + +Plugin* pluginInstance__Fundamental; + +namespace rack { +namespace plugin { + +static void initStatic__Fundamental() +{ + Plugin* p = new Plugin; + pluginInstance__Fundamental = p; + p->addModel(modelVCO); + p->addModel(modelVCO2); + p->addModel(modelVCF); + p->addModel(modelVCA_1); + p->addModel(modelVCA); + p->addModel(modelLFO); + p->addModel(modelLFO2); + p->addModel(modelDelay); + p->addModel(modelADSR); + p->addModel(modelVCMixer); + p->addModel(model_8vert); + p->addModel(modelUnity); + p->addModel(modelMutes); + p->addModel(modelPulses); + p->addModel(modelScope); + p->addModel(modelSEQ3); + p->addModel(modelSequentialSwitch1); + p->addModel(modelSequentialSwitch2); + p->addModel(modelOctave); + p->addModel(modelQuantizer); + p->addModel(modelSplit); + p->addModel(modelMerge); + p->addModel(modelSum); + p->addModel(modelViz); + p->addModel(modelMidSide); + p->addModel(modelNoise); + p->addModel(modelRandom); + plugins.push_back(p); +} + +void initStaticPlugins() +{ + initStatic__Fundamental(); +} + +} +} diff --git a/plugins/Cardinal/CardinalPlugin.cpp b/src/CardinalPlugin.cpp similarity index 95% rename from plugins/Cardinal/CardinalPlugin.cpp rename to src/CardinalPlugin.cpp index d8ae8dc..c59b6e6 100644 --- a/plugins/Cardinal/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -40,6 +40,12 @@ #endif #include "DistrhoPlugin.hpp" +namespace rack { +namespace plugin { +void initStaticPlugins(); +} +} + START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------------------------------------------- @@ -111,6 +117,8 @@ struct Initializer { midi::init(); // does nothing plugin::init(); ui::init(); + + plugin::initStaticPlugins(); } ~Initializer() diff --git a/plugins/Cardinal/CardinalUI.cpp b/src/CardinalUI.cpp similarity index 100% rename from plugins/Cardinal/CardinalUI.cpp rename to src/CardinalUI.cpp diff --git a/plugins/Cardinal/DistrhoPluginInfo.h b/src/DistrhoPluginInfo.h similarity index 100% rename from plugins/Cardinal/DistrhoPluginInfo.h rename to src/DistrhoPluginInfo.h diff --git a/src/GL/glew.h b/src/GL/glew.h new file mode 100644 index 0000000..2ec0dd6 --- /dev/null +++ b/src/GL/glew.h @@ -0,0 +1,124 @@ +/* + * 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. + */ + +// this file matches the top of `OpenGL.hpp` provided by DPF + +#pragma once + +#ifdef NDEBUG +# undef DEBUG +#endif + +/* Check OS */ +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +# define DISTRHO_OS_WINDOWS 1 +#else +# if defined(__APPLE__) +# define DISTRHO_OS_MAC 1 +# endif +#endif + +// ----------------------------------------------------------------------- +// Fix OpenGL includes for Windows, based on glfw code (part 1) + +#undef DGL_CALLBACK_DEFINED +#undef DGL_WINGDIAPI_DEFINED + +#ifdef DISTRHO_OS_WINDOWS + +#ifndef APIENTRY +# define APIENTRY __stdcall +#endif // APIENTRY + +/* We need WINGDIAPI defined */ +#ifndef WINGDIAPI +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) +# define WINGDIAPI __declspec(dllimport) +# elif defined(__LCC__) +# define WINGDIAPI __stdcall +# else +# define WINGDIAPI extern +# endif +# define DGL_WINGDIAPI_DEFINED +#endif // WINGDIAPI + +/* Some files also need CALLBACK defined */ +#ifndef CALLBACK +# if defined(_MSC_VER) +# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +# else +# define CALLBACK __stdcall +# endif +# define DGL_CALLBACK_DEFINED +#endif // CALLBACK + +/* Most GL/glu.h variants on Windows need wchar_t */ +#include + +#endif // DISTRHO_OS_WINDOWS + +// ----------------------------------------------------------------------- +// OpenGL includes + +#ifdef DISTRHO_OS_MAC +# ifdef DGL_USE_OPENGL3 +# include +# include +# else +# include +# endif +#else +# ifdef DISTRHO_OS_WINDOWS +# define GL_GLEXT_PROTOTYPES +# endif +# ifndef __GLEW_H__ +# include +# include +# endif +#endif + +// ----------------------------------------------------------------------- +// Missing OpenGL defines + +#if defined(GL_BGR_EXT) && !defined(GL_BGR) +# define GL_BGR GL_BGR_EXT +#endif + +#if defined(GL_BGRA_EXT) && !defined(GL_BGRA) +# define GL_BGRA GL_BGRA_EXT +#endif + +#ifndef GL_CLAMP_TO_BORDER +# define GL_CLAMP_TO_BORDER 0x812D +#endif + +// ----------------------------------------------------------------------- +// Fix OpenGL includes for Windows, based on glfw code (part 2) + +#ifdef DGL_CALLBACK_DEFINED +# undef CALLBACK +# undef DGL_CALLBACK_DEFINED +#endif + +#ifdef DGL_WINGDIAPI_DEFINED +# undef WINGDIAPI +# undef DGL_WINGDIAPI_DEFINED +#endif diff --git a/plugins/Cardinal/Makefile b/src/Makefile similarity index 54% rename from plugins/Cardinal/Makefile rename to src/Makefile index f1046c0..1eef189 100644 --- a/plugins/Cardinal/Makefile +++ b/src/Makefile @@ -25,7 +25,7 @@ FILES_UI = \ USE_NANOVG_FBO = true USE_RGBA = true -include ../../dpf/Makefile.base.mk +include ../dpf/Makefile.base.mk # -------------------------------------------------------------- # Files to build (VCV stuff) @@ -50,107 +50,26 @@ FILES_DSP += $(wildcard Rack/src/*/*.c) FILES_DSP += $(filter-out Rack/src/dep.cpp Rack/src/discord.cpp Rack/src/gamepad.cpp Rack/src/keyboard.cpp Rack/src/library.cpp Rack/src/network.cpp Rack/src/rtaudio.cpp Rack/src/rtmidi.cpp, $(wildcard Rack/src/*.cpp)) FILES_DSP += $(filter-out Rack/src/window/Window.cpp, $(wildcard Rack/src/*/*.cpp)) -EXTRA_DEPENDENCIES += Rack/dep/lib/libjansson.a -EXTRA_DEPENDENCIES += Rack/dep/lib/libspeexdsp.a +# -------------------------------------------------------------- +# Extra libraries to link against +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_DEPENDENCIES += Rack/dep/lib/libarchive_static.a +EXTRA_LIBS += Rack/dep/lib/libarchive_static.a else -EXTRA_DEPENDENCIES += Rack/dep/lib/libarchive.a +EXTRA_LIBS += Rack/dep/lib/libarchive.a endif - -EXTRA_DEPENDENCIES += Rack/dep/lib/libzstd.a - -EXTRA_LIBS = $(EXTRA_DEPENDENCIES) +EXTRA_LIBS += Rack/dep/lib/libzstd.a # -------------------------------------------------------------- # Do some magic -include ../../dpf/Makefile.plugins.mk - -# -------------------------------------------------------------- -# override VCV arch.mk stuff so we can build more architectures - -DEP_PATH = $(abspath Rack/dep) - -ifeq ($(CPU_ARM),true) -ARCH_NAME = arm -MACHINE = i686-bring-forth-the-rack -else ifeq ($(CPU_ARM64),true) -ARCH_NAME = arm64 -MACHINE = x86_64-bring-forth-the-rack -else ifeq ($(CPU_AARCH64),true) -ARCH_NAME = aarch64 -MACHINE = x86_64-bring-forth-the-rack -else -MACHINE = $(TARGET_MACHINE) -endif - -ifneq ($(MACOS_OR_WINDOWS),true) -MACHINE_SUFFIX = -linux -endif - -# NOTE speex fails to build when neon is enabled -CONFIGURE = ./configure --prefix="$(DEP_PATH)" --host=$(TARGET_MACHINE) --enable-neon=no - -# -------------------------------------------------------------- -# Fix up cmake - -SPACE = -SPACE += - -CMAKE = cmake - -ifneq (,$(findstring -arch$(SPACE),$(CXXFLAGS))) -CMAKE += -DCMAKE_OSX_ARCHITECTURES='$(subst $(SPACE),;,$(subst -arch=,,$(filter -arch=%,$(subst -arch$(SPACE),-arch=,$(CXXFLAGS)))))' -endif -ifneq (,$(findstring -mmacosx-version-min=,$(CXXFLAGS))) -CMAKE += -DCMAKE_OSX_DEPLOYMENT_TARGET=$(subst -mmacosx-version-min=,,$(filter -mmacosx-version-min=%,$(CXXFLAGS))) -endif - -ifeq ($(WINDOWS),true) -CMAKE += -G 'Unix Makefiles' -CMAKE += -DCMAKE_RC_COMPILER=$(subst gcc,windres,$(CC)) -CMAKE += -DCMAKE_SYSTEM_NAME=Windows -endif - -ifeq ($(DEBUG),true) -CMAKE += -DCMAKE_BUILD_TYPE=Debug -else -CMAKE += -DCMAKE_BUILD_TYPE=Release -endif - -CMAKE += -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX='$(DEP_PATH)' - -# -------------------------------------------------------------- -# VCV internal dependencies target - -Rack/dep/lib/%.a: - $(MAKE) \ - ARCH_NAME=$(ARCH_NAME) \ - CFLAGS="$(BUILD_C_FLAGS)" \ - CXXFLAGS="$(BUILD_CXX_FLAGS)" \ - LDFLAGS="$(LINK_FLAGS)" \ - CMAKE="$(CMAKE)" \ - CONFIGURE="$(CONFIGURE)" \ - DEP_FLAGS="$(BASE_FLAGS)" \ - DEP_MAC_SDK_FLAGS= \ - MACHINE=$(MACHINE)$(MACHINE_SUFFIX) \ - -C Rack/dep lib/$*.a - -Rack/dep/lib/libarchive.a: Rack/dep/lib/libzstd.a - -Rack/dep/lib/libarchive_static.a: Rack/dep/lib/libzstd.a - -ifeq ($(MACOS),true) -# zstd cmake is borked, see https://github.com/facebook/zstd/issues/1401 -Rack/dep/lib/libzstd.a: Rack/dep/zstd-1.4.5/.stamp-patched - -Rack/dep/zstd-1.4.5/.stamp-patched: - $(MAKE) -C Rack/dep zstd-1.4.5 - sed -i -e "56,66d" Rack/dep/zstd-1.4.5/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake - touch $@ -endif +DPF_PATH = ../dpf +DPF_TARGET_DIR = ../bin +include ../dpf/Makefile.plugins.mk # -------------------------------------------------------------- # Extra flags for VCV stuff @@ -163,18 +82,8 @@ else BASE_FLAGS += -DARCH_LIN endif -BUILD_C_FLAGS += -std=gnu11 - -# temporary macro just to get the ball rolling -ifeq ($(EXE_WRAPPER),wine) -SOURCE_DIR = Z:$(subst /,\\,$(CURDIR)) -else -SOURCE_DIR = $(CURDIR) -endif -BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_SOURCE_DIR='"$(SOURCE_DIR)"' - BASE_FLAGS += -D_APP_VERSION=Cardinal -BASE_FLAGS += -I$(DPF_PATH)/dgl/src/nanovg +BASE_FLAGS += -I../dpf/dgl/src/nanovg BASE_FLAGS += -IRack/include BASE_FLAGS += -IRack/dep/include BASE_FLAGS += -IRack/dep/filesystem/include @@ -184,20 +93,25 @@ BASE_FLAGS += -IRack/dep/nanosvg/src BASE_FLAGS += -IRack/dep/osdialog BASE_FLAGS += -IRack/dep/oui-blendish BASE_FLAGS += -IRack/dep/pffft +BASE_FLAGS += -Ineon-compat BASE_FLAGS += -pthread -BASE_FLAGS += -Ineon-compat - ifeq ($(WINDOWS),true) -BASE_FLAGS += -Imingw-compat -BUILD_CXX_FLAGS += -Imingw-std-threads +BASE_FLAGS += -Imingw-compat +BASE_FLAGS += -Imingw-std-threads 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 + ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) LINK_FLAGS += -ldl endif @@ -209,10 +123,19 @@ LINK_FLAGS += -ldbghelp -lshlwapi endif # -------------------------------------------------------------- -# Enable all possible plugin types +# temporary macro just to get the ball rolling -TARGETS = jack lv2 vst2 vst3 +ifeq ($(EXE_WRAPPER),wine) +SOURCE_DIR = Z:$(subst /,\\,$(CURDIR)) +else +SOURCE_DIR = $(CURDIR) +endif -all: $(TARGETS) +BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_SOURCE_DIR='"$(SOURCE_DIR)"' + +# -------------------------------------------------------------- +# Enable all possible plugin types + +all: jack lv2 vst2 vst3 # -------------------------------------------------------------- diff --git a/src/Rack b/src/Rack new file mode 160000 index 0000000..420e781 --- /dev/null +++ b/src/Rack @@ -0,0 +1 @@ +Subproject commit 420e781fa7bfdcf47163ab1fa976c171c91cb92b diff --git a/plugins/Cardinal/ResizeHandle.hpp b/src/ResizeHandle.hpp similarity index 100% rename from plugins/Cardinal/ResizeHandle.hpp rename to src/ResizeHandle.hpp diff --git a/plugins/Cardinal/Window.cpp b/src/Window.cpp similarity index 99% rename from plugins/Cardinal/Window.cpp rename to src/Window.cpp index 8b96b11..fc27717 100644 --- a/plugins/Cardinal/Window.cpp +++ b/src/Window.cpp @@ -17,6 +17,7 @@ #ifdef NDEBUG # undef DEBUG #endif + #include "DistrhoUI.hpp" namespace rack { diff --git a/plugins/Cardinal/dep.cpp b/src/dep.cpp similarity index 88% rename from plugins/Cardinal/dep.cpp rename to src/dep.cpp index bd9a761..31d99af 100644 --- a/plugins/Cardinal/dep.cpp +++ b/src/dep.cpp @@ -7,8 +7,14 @@ #endif #include "OpenGL.hpp" -#define BLENDISH_IMPLEMENTATION -#include +#ifdef DEBUG +// fix blendish build, missing symbol in debug mode +extern "C" { +float bnd_clamp(float v, float mn, float mx) { + return (v > mx)?mx:(v < mn)?mn:v; +} +} +#endif #define NANOSVG_IMPLEMENTATION #define NANOSVG_ALL_COLOR_KEYWORDS diff --git a/plugins/Cardinal/mingw-compat/Shlobj.h b/src/mingw-compat/Shlobj.h similarity index 100% rename from plugins/Cardinal/mingw-compat/Shlobj.h rename to src/mingw-compat/Shlobj.h diff --git a/plugins/Cardinal/mingw-compat/Shlwapi.h b/src/mingw-compat/Shlwapi.h similarity index 100% rename from plugins/Cardinal/mingw-compat/Shlwapi.h rename to src/mingw-compat/Shlwapi.h diff --git a/plugins/Cardinal/mingw-compat/Windows.h b/src/mingw-compat/Windows.h similarity index 100% rename from plugins/Cardinal/mingw-compat/Windows.h rename to src/mingw-compat/Windows.h diff --git a/plugins/Cardinal/mingw-compat/condition_variable b/src/mingw-compat/condition_variable similarity index 100% rename from plugins/Cardinal/mingw-compat/condition_variable rename to src/mingw-compat/condition_variable diff --git a/plugins/Cardinal/mingw-compat/mutex b/src/mingw-compat/mutex similarity index 100% rename from plugins/Cardinal/mingw-compat/mutex rename to src/mingw-compat/mutex diff --git a/plugins/Cardinal/mingw-compat/thread b/src/mingw-compat/thread similarity index 100% rename from plugins/Cardinal/mingw-compat/thread rename to src/mingw-compat/thread diff --git a/plugins/Cardinal/mingw-std-threads b/src/mingw-std-threads similarity index 100% rename from plugins/Cardinal/mingw-std-threads rename to src/mingw-std-threads diff --git a/plugins/Cardinal/neon-compat/pmmintrin.h b/src/neon-compat/pmmintrin.h similarity index 100% rename from plugins/Cardinal/neon-compat/pmmintrin.h rename to src/neon-compat/pmmintrin.h diff --git a/plugins/Cardinal/sse2neon b/src/sse2neon similarity index 100% rename from plugins/Cardinal/sse2neon rename to src/sse2neon