Disable dev mode, use source dir as system dir; Fix some builds

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-10-09 22:43:05 +01:00
parent beb0965051
commit a482ee7b73
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
5 changed files with 64 additions and 33 deletions

View file

@ -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();
}

View file

@ -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

View file

@ -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