diff --git a/Makefile b/Makefile index b8ad38a..a6dac28 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ include dpf/Makefile.base.mk -all: dgl plugins gen resources +all: dgl plugins gen # -------------------------------------------------------------- @@ -17,22 +17,16 @@ plugins: dgl $(MAKE) all -C plugins/Cardinal ifneq ($(CROSS_COMPILING),true) -gen: plugins resources dpf/utils/lv2_ttl_generator +gen: plugins dpf/utils/lv2_ttl_generator @$(CURDIR)/dpf/utils/generate-ttl.sh ifeq ($(MACOS),true) @$(CURDIR)/dpf/utils/generate-vst-bundles.sh endif -resources: bin/Cardinal.lv2/res - -bin/Cardinal.lv2/res: plugins - ln -sf $(CURDIR)/plugins/Cardinal/Rack/res bin/Cardinal.lv2/res - dpf/utils/lv2_ttl_generator: $(MAKE) -C dpf/utils/lv2-ttl-generator else gen: -resources: endif # -------------------------------------------------------------- diff --git a/dpf b/dpf index a1322bc..65eb8c0 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit a1322bc0c5814633ec3c82080540a2657f4f4486 +Subproject commit 65eb8c098d6ed2c3407b761e8b967f82e0a7b8a7 diff --git a/plugins/Cardinal/CardinalPlugin.cpp b/plugins/Cardinal/CardinalPlugin.cpp index a028b43..1fdf154 100644 --- a/plugins/Cardinal/CardinalPlugin.cpp +++ b/plugins/Cardinal/CardinalPlugin.cpp @@ -58,13 +58,18 @@ struct Initializer { { using namespace rack; - settings::devMode = true; + settings::autoCheckUpdates = false; settings::autosaveInterval = 0; + settings::discordUpdateActivity = false; + settings::isPlugin = true; system::init(); asset::init(); logger::init(); random::init(); + // Make system dir point to source code location. It is good enough for now + asset::systemDir = CARDINAL_PLUGIN_SOURCE_DIR DISTRHO_OS_SEP_STR "Rack"; + // Log environment INFO("%s %s v%s", APP_NAME.c_str(), APP_EDITION.c_str(), APP_VERSION.c_str()); INFO("%s", system::getOperatingSystemInfo().c_str()); @@ -107,20 +112,20 @@ struct Initializer { keyboard::init(); plugin::init(); library::init(); - ui::init(); + ui::init(); } ~Initializer() { using namespace rack; - ui::destroy(); + ui::destroy(); library::destroy(); midi::destroy(); audio::destroy(); plugin::destroy(); - INFO("Destroying logger"); - logger::destroy(); + INFO("Destroying logger"); + logger::destroy(); } }; @@ -144,7 +149,7 @@ class CardinalPlugin : public Plugin ~ScopedContext() { - rack::contextSet(nullptr); + rack::contextSet(nullptr); } }; @@ -161,6 +166,7 @@ public: fContext->scene = new rack::app::Scene; fContext->event->rootWidget = fContext->scene; fContext->patch = new rack::patch::Manager; + fContext->patch->autosavePath = "/OBVIOUSLY-NOT-VALID-PATH/"; fContext->engine->startFallbackThread(); } diff --git a/plugins/Cardinal/CardinalUI.cpp b/plugins/Cardinal/CardinalUI.cpp index 595f7be..508dd45 100644 --- a/plugins/Cardinal/CardinalUI.cpp +++ b/plugins/Cardinal/CardinalUI.cpp @@ -64,7 +64,7 @@ class CardinalUI : public UI ~ScopedContext() { - rack::contextSet(nullptr); + rack::contextSet(nullptr); } }; @@ -95,7 +95,7 @@ public: { const ScopedContext sc(this); - fContext->window->step(); + fContext->window->step(); } void uiIdle() override diff --git a/plugins/Cardinal/Makefile b/plugins/Cardinal/Makefile index 918672f..caf5018 100644 --- a/plugins/Cardinal/Makefile +++ b/plugins/Cardinal/Makefile @@ -24,6 +24,7 @@ FILES_UI = \ # Import base definitions USE_NANOVG_FBO = true +USE_RGBA = true include ../../dpf/Makefile.base.mk # -------------------------------------------------------------- @@ -65,16 +66,40 @@ EXTRA_LIBS += Rack/dep/lib/libzstd.a include ../../dpf/Makefile.plugins.mk +# -------------------------------------------------------------- +# Fix up cmake for windows cross-compilation + ifeq ($(WINDOWS),true) CMAKE := cmake -G 'Unix Makefiles' -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=$(subst gcc,windres,$(CC)) else CMAKE := cmake endif -BUILD_C_FLAGS += -std=gnu11 +CMAKE += -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX='$(abspath Rack/dep)' + +# -------------------------------------------------------------- +# 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 +endif + +ifneq ($(MACOS_OR_WINDOWS),true) +MACHINE += -linux +endif + +# -------------------------------------------------------------- +# VCV internal dependencies target Rack/dep/lib/%.a: - $(MAKE) CMAKE="$(CMAKE) -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX='$(abspath Rack/dep)'" -C Rack/dep lib/$*.a + $(MAKE) ARCH_NAME=$(ARCH_NAME) CMAKE="$(CMAKE)" MACHINE=$(MACHINE) -C Rack/dep lib/$*.a Rack/dep/lib/libarchive.a: Rack/dep/lib/libzstd.a @@ -83,7 +108,25 @@ Rack/dep/lib/libarchive_static.a: Rack/dep/lib/libzstd.a # -------------------------------------------------------------- # Extra flags for VCV stuff -BASE_FLAGS += -D_APP_VERSION=2.git.0 +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 + +# 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 += -IRack/include BASE_FLAGS += -IRack/dep/include @@ -94,20 +137,13 @@ BASE_FLAGS += -IRack/dep/nanosvg/src BASE_FLAGS += -IRack/dep/osdialog BASE_FLAGS += -IRack/dep/oui-blendish BASE_FLAGS += -IRack/dep/pffft +BASE_FLAGS += -pthread ifeq ($(WINDOWS),true) BASE_FLAGS += -Imingw-compat BUILD_CXX_FLAGS += -Imingw-std-threads endif -ifeq ($(MACOS),true) -BASE_FLAGS += -DARCH_MAC -else ifeq ($(WINDOWS),true) -BASE_FLAGS += -DARCH_WIN -else -BASE_FLAGS += -DARCH_LIN -endif - # FIXME lots of warnings from VCV side BASE_FLAGS += -Wno-unused-parameter BASE_FLAGS += -Wno-unused-variable @@ -123,11 +159,6 @@ else ifeq ($(WINDOWS),true) LINK_FLAGS += -ldbghelp -lshlwapi endif -# LINK_FLAGS += $(OPENGL_LIBS) - -# TODO needed on windows? need to check -LINK_FLAGS += -lpthread - # -------------------------------------------------------------- # Enable all possible plugin types