Setup plugin resources to build, cleanup
This commit is contained in:
parent
718e3707cc
commit
739359430a
4 changed files with 179 additions and 30 deletions
|
@ -5,6 +5,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
DEP_PATH = $(abspath ../src/Rack/dep)
|
DEP_PATH = $(abspath ../src/Rack/dep)
|
||||||
|
OBJCOPY ?= objcopy
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Import base definitions
|
# Import base definitions
|
||||||
|
@ -20,16 +21,25 @@ PLUGIN_FILES = plugins.cpp
|
||||||
|
|
||||||
# Befaco
|
# Befaco
|
||||||
PLUGIN_FILES += $(filter-out Befaco/src/plugin.cpp,$(wildcard Befaco/src/*.cpp))
|
PLUGIN_FILES += $(filter-out Befaco/src/plugin.cpp,$(wildcard Befaco/src/*.cpp))
|
||||||
|
PLUGIN_BINARIES += Befaco/src/SpringReverbIR.pcm
|
||||||
|
|
||||||
# Fundamental
|
# Fundamental
|
||||||
PLUGIN_FILES += $(filter-out Fundamental/src/plugin.cpp,$(wildcard Fundamental/src/*.cpp))
|
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 setup
|
||||||
|
|
||||||
BUILD_DIR = ../build/plugins
|
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)
|
ifeq ($(MACOS),true)
|
||||||
BASE_FLAGS += -DARCH_MAC
|
BASE_FLAGS += -DARCH_MAC
|
||||||
|
@ -42,6 +52,7 @@ endif
|
||||||
BUILD_C_FLAGS += -std=gnu11
|
BUILD_C_FLAGS += -std=gnu11
|
||||||
|
|
||||||
BASE_FLAGS += -I../dpf/dgl/src/nanovg
|
BASE_FLAGS += -I../dpf/dgl/src/nanovg
|
||||||
|
BASE_FLAGS += -I../dpf/distrho
|
||||||
BASE_FLAGS += -I../src
|
BASE_FLAGS += -I../src
|
||||||
BASE_FLAGS += -I../src/neon-compat
|
BASE_FLAGS += -I../src/neon-compat
|
||||||
BASE_FLAGS += -I../src/Rack/include
|
BASE_FLAGS += -I../src/Rack/include
|
||||||
|
@ -56,8 +67,10 @@ BASE_FLAGS += -I../src/Rack/dep/pffft
|
||||||
BASE_FLAGS += -pthread
|
BASE_FLAGS += -pthread
|
||||||
|
|
||||||
ifeq ($(WINDOWS),true)
|
ifeq ($(WINDOWS),true)
|
||||||
|
BASE_FLAGS += -D_USE_MATH_DEFINES
|
||||||
BASE_FLAGS += -Imingw-compat
|
BASE_FLAGS += -Imingw-compat
|
||||||
BASE_FLAGS += -Imingw-std-threads
|
BASE_FLAGS += -Imingw-std-threads
|
||||||
|
BASE_FLAGS += -municode
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
@ -66,6 +79,20 @@ endif
|
||||||
BASE_FLAGS += -Wno-unused-parameter
|
BASE_FLAGS += -Wno-unused-parameter
|
||||||
BASE_FLAGS += -Wno-unused-variable
|
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
|
# Build targets
|
||||||
|
|
||||||
|
@ -100,6 +127,12 @@ $(BUILD_DIR)/Fundamental/%.cpp.o: Fundamental/%.cpp
|
||||||
@echo "Compiling $<"
|
@echo "Compiling $<"
|
||||||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DpluginInstance=pluginInstance__Fundamental -c -o $@
|
$(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)
|
-include $(PLUGIN_OBJS:%.o=%.d)
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
#include <plugin.hpp>
|
#include <plugin.hpp>
|
||||||
|
|
||||||
|
#include "DistrhoUtils.hpp"
|
||||||
|
|
||||||
|
#include "Befaco/src/plugin.hpp"
|
||||||
#include "Fundamental/src/plugin.hpp"
|
#include "Fundamental/src/plugin.hpp"
|
||||||
|
|
||||||
Plugin* pluginInstance__Befaco;
|
Plugin* pluginInstance__Befaco;
|
||||||
|
@ -25,17 +28,79 @@ Plugin* pluginInstance__Fundamental;
|
||||||
namespace rack {
|
namespace rack {
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
|
|
||||||
|
struct StaticPluginLoader {
|
||||||
|
Plugin* const plugin;
|
||||||
|
FILE* file;
|
||||||
|
json_t* rootJ;
|
||||||
|
|
||||||
|
StaticPluginLoader(Plugin* const p, const char* const name)
|
||||||
|
: plugin(p),
|
||||||
|
file(nullptr),
|
||||||
|
rootJ(nullptr)
|
||||||
|
{
|
||||||
|
p->path = system::join(CARDINAL_PLUGINS_DIR, name);
|
||||||
|
|
||||||
|
const std::string manifestFilename = system::join(p->path, "plugin.json");
|
||||||
|
|
||||||
|
if ((file = std::fopen(manifestFilename.c_str(), "r")) == nullptr)
|
||||||
|
{
|
||||||
|
d_stderr2("Manifest file %s does not exist", manifestFilename.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
json_error_t error;
|
||||||
|
if ((rootJ = json_loadf(file, 0, &error)) == nullptr)
|
||||||
|
{
|
||||||
|
d_stderr2("JSON parsing error at %s %d:%d %s", manifestFilename.c_str(), error.line, error.column, error.text);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~StaticPluginLoader()
|
||||||
|
{
|
||||||
|
if (rootJ != nullptr)
|
||||||
|
{
|
||||||
|
plugin->fromJson(rootJ);
|
||||||
|
json_decref(rootJ);
|
||||||
|
plugins.push_back(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file != nullptr)
|
||||||
|
std::fclose(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ok() const noexcept
|
||||||
|
{
|
||||||
|
return rootJ != nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static void initStatic__Befaco()
|
static void initStatic__Befaco()
|
||||||
{
|
{
|
||||||
Plugin* p = new Plugin;
|
Plugin* p = new Plugin;
|
||||||
pluginInstance__Befaco = p;
|
pluginInstance__Befaco = p;
|
||||||
plugins.push_back(p);
|
|
||||||
|
const StaticPluginLoader spl(p, "Befaco");
|
||||||
|
if (spl.ok())
|
||||||
|
{
|
||||||
|
p->addModel(modelEvenVCO);
|
||||||
|
p->addModel(modelRampage);
|
||||||
|
p->addModel(modelABC);
|
||||||
|
p->addModel(modelSpringReverb);
|
||||||
|
p->addModel(modelMixer);
|
||||||
|
p->addModel(modelSlewLimiter);
|
||||||
|
p->addModel(modelDualAtenuverter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initStatic__Fundamental()
|
static void initStatic__Fundamental()
|
||||||
{
|
{
|
||||||
Plugin* p = new Plugin;
|
Plugin* p = new Plugin;
|
||||||
pluginInstance__Fundamental = p;
|
pluginInstance__Fundamental = p;
|
||||||
|
|
||||||
|
const StaticPluginLoader spl(p, "Fundamental");
|
||||||
|
if (spl.ok())
|
||||||
|
{
|
||||||
p->addModel(modelVCO);
|
p->addModel(modelVCO);
|
||||||
p->addModel(modelVCO2);
|
p->addModel(modelVCO2);
|
||||||
p->addModel(modelVCF);
|
p->addModel(modelVCF);
|
||||||
|
@ -63,7 +128,7 @@ static void initStatic__Fundamental()
|
||||||
p->addModel(modelMidSide);
|
p->addModel(modelMidSide);
|
||||||
p->addModel(modelNoise);
|
p->addModel(modelNoise);
|
||||||
p->addModel(modelRandom);
|
p->addModel(modelRandom);
|
||||||
plugins.push_back(p);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initStaticPlugins()
|
void initStaticPlugins()
|
||||||
|
|
49
plugins/res2c.py
Executable file
49
plugins/res2c.py
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# DISTRHO Plugin Framework (DPF)
|
||||||
|
# Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for any purpose with
|
||||||
|
# or without fee is hereby granted, provided that the above copyright notice and this
|
||||||
|
# permission notice appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
|
||||||
|
# TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
|
||||||
|
# NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
||||||
|
# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# -----------------------------------------------------
|
||||||
|
|
||||||
|
def res2c(filename):
|
||||||
|
resname = "src_" + os.path.basename(filename.replace(".","_"))
|
||||||
|
fhandle = open(filename, 'rb')
|
||||||
|
resdata = fhandle.read()
|
||||||
|
|
||||||
|
print("const unsigned char %s[] = {\n" % resname)
|
||||||
|
for data in resdata:
|
||||||
|
print(" %3u," % data)
|
||||||
|
print("};\n")
|
||||||
|
|
||||||
|
print("const unsigned int %s_len = %d;\n" % (resname, fhandle.tell()))
|
||||||
|
|
||||||
|
# -----------------------------------------------------
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("Usage: %s <filename>" % sys.argv[0])
|
||||||
|
quit()
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
|
||||||
|
if not os.path.exists(filename):
|
||||||
|
print("Folder '%s' does not exist" % filename)
|
||||||
|
quit()
|
||||||
|
|
||||||
|
# dump code now
|
||||||
|
res2c(filename)
|
|
@ -97,8 +97,10 @@ BASE_FLAGS += -Ineon-compat
|
||||||
BASE_FLAGS += -pthread
|
BASE_FLAGS += -pthread
|
||||||
|
|
||||||
ifeq ($(WINDOWS),true)
|
ifeq ($(WINDOWS),true)
|
||||||
|
BASE_FLAGS += -D_USE_MATH_DEFINES
|
||||||
BASE_FLAGS += -Imingw-compat
|
BASE_FLAGS += -Imingw-compat
|
||||||
BASE_FLAGS += -Imingw-std-threads
|
BASE_FLAGS += -Imingw-std-threads
|
||||||
|
BASE_FLAGS += -municode
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_C_FLAGS += -std=gnu11
|
BUILD_C_FLAGS += -std=gnu11
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue