Skip to content

Instantly share code, notes, and snippets.

@jeremywen
Last active March 8, 2025 18:39
Show Gist options
  • Save jeremywen/d68f6b1c7ce033f47d8aaf76d59ff641 to your computer and use it in GitHub Desktop.
Save jeremywen/d68f6b1c7ce033f47d8aaf76d59ff641 to your computer and use it in GitHub Desktop.
# External plugins as "built-ins" for the Simulator
#
# Example with `Venom`:
# list(APPEND ext_builtin_brand_paths "${CMAKE_CURRENT_LIST_DIR}/../../metamodule-plugin-examples/Venom")
# list(APPEND ext_builtin_brand_libname "Venom")
#
# Don't forget to change init() => init_Venom(), and add `extern` to the pluginInstance!
#
# See docs/simulator-ext-plugins.md for instructions
list(APPEND ext_builtin_brand_paths "/Users/jeremy/vcv/JW-Modules")
list(APPEND ext_builtin_brand_libname "JW-Modules")
#
# Asset dir
#
cmake_path(SET ASSET_DIR "${CMAKE_CURRENT_BINARY_DIR}/assets")
set(ASSET_IMG_FILENAME assets.uimg)
cmake_path(APPEND ASSET_IMG_PATH "${CMAKE_CURRENT_BINARY_DIR}" "${ASSET_IMG_FILENAME}")
message("set ASSET_DIR to ${ASSET_DIR}")
message("set ASSET_IMG_PATH to ${ASSET_IMG_PATH}")
add_custom_command(
OUTPUT ${ASSET_DIR}
COMMAND ${CMAKE_COMMAND} -E echo Copying "${FWDIR}/assets" to "${ASSET_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${FWDIR}/assets" "${ASSET_DIR}"
COMMENT "Copying assets/ dir from ${FWDIR}/assets to ${ASSET_DIR}"
VERBATIM USES_TERMINAL
)
add_custom_command(
OUTPUT ${ASSET_IMG_PATH}
COMMAND cd ${ASSET_DIR} && ${CMAKE_COMMAND} -E tar -cf ${ASSET_IMG_PATH}.tar .
COMMAND ${FWDIR}/flashing/uimg_header.py --name Assets ${ASSET_IMG_PATH}.tar ${ASSET_IMG_PATH}
COMMENT "Creating assets uimg file at ${ASSET_IMG_PATH}"
DEPENDS ${ASSET_DIR}
VERBATIM USES_TERMINAL
)
add_custom_target(asset-image ALL
DEPENDS ${ASSET_IMG_PATH}
)
set(EXT_PLUGIN_INIT_CALLS "")
foreach(branddir brand IN ZIP_LISTS ext_builtin_brand_paths ext_builtin_brand_libname)
set(METAMODULE_SDK_DIR ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(${branddir} ${CMAKE_CURRENT_BINARY_DIR}/builtins/${brand})
target_link_libraries(${brand} PRIVATE metamodule::vcv-plugin-interface)
target_link_libraries(${brand} PRIVATE cpputil::cpputil)
target_compile_definitions(${brand} PRIVATE METAMODULE METAMODULE_BUILTIN)
target_link_libraries(_vcv_ports_internal PUBLIC ${brand})
add_dependencies(asset-image ${brand}-assets)
string(APPEND EXT_PLUGIN_INIT_CALLS "\textern void init_${brand}(rack::plugin::Plugin *);\n\tinit_${brand}(&internal_plugins.emplace_back(\"${brand}\"));")
endforeach()
configure_file(src/ext_plugin_builtin.hh.in ${CMAKE_CURRENT_BINARY_DIR}/ext_plugin/ext_plugin_builtin.hh)
target_include_directories(simulator PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ext_plugin)
#include "JWModules.hpp"
#if defined(METAMODULE_BUILTIN)
extern Plugin *pluginInstance;
#else
Plugin *pluginInstance;
#endif
#if defined(METAMODULE_BUILTIN)
void init_JW-Modules(rack::Plugin *p) {
#else
void init(rack::Plugin *p) {
#endif
{
pluginInstance = p;
p->addModel(modelAdd5);
p->addModel(modelAbcdSeq);
p->addModel(modelBouncyBalls);
p->addModel(modelCat);
p->addModel(modelTree);
p->addModel(modelFullScope);
p->addModel(modelGridSeq);
p->addModel(modelEightSeq);
p->addModel(modelDivSeq);
p->addModel(modelMinMax);
p->addModel(modelNoteSeq);
p->addModel(modelNoteSeqFu);
p->addModel(modelNoteSeq16);
p->addModel(modelTrigs);
p->addModel(modelOnePattern);
p->addModel(modelPatterns);
p->addModel(modelQuantizer);
p->addModel(modelSimpleClock);
// p->addModel(modelStr1ker);
p->addModel(modelD1v1de);
p->addModel(modelPres1t);
p->addModel(modelThingThing);
p->addModel(modelWavHead);
p->addModel(modelXYPad);
p->addModel(modelBlankPanel1hp);
p->addModel(modelBlankPanelSmall);
p->addModel(modelBlankPanelMedium);
p->addModel(modelBlankPanelLarge);
p->addModel(modelCoolBreeze);
p->addModel(modelPete);
p->addModel(modelTimer);
}
[01:35 PM][~/vcv/metamodule/simulator][v2.0-dev]cmake --fresh -B build -GNinja
-- The C compiler identification is AppleClang 16.0.0.16000026
-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Building Simulator with GUI
Log Level: None
lvgl_drv: LV_CONF_PATH =/Users/jeremy/vcv/metamodule/simulator/lv_conf.h
lvgl_drv: LV_CONF_DIR =
SDL2_INCLUDE_DIRS=/opt/homebrew/Cellar/sdl2/2.30.10/include/opt/homebrew/Cellar/sdl2/2.30.10/include/SDL2
-- ryml: using C++ standard: C++11
-- ryml: setting C++ standard: 11
-- ryml: setting C++ standard required: ON
-- ryml: importing subproject c4core (SUBDIRECTORY)... /Users/jeremy/vcv/metamodule/firmware/lib/patch-serial/ryml/rapidyaml/ext/c4core
-- c4core: using C++ standard: C++11
-- ryml: -----> target ryml PUBLIC incorporating lib c4core
Building Befaco as built-in plugin
-- The ASM compiler identification is AppleClang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
Building hetrickcv as built-in plugin
Building AudibleInstruments as built-in plugin
Building nonlinearcircuits as built-in plugin
Building eightfold as built-in plugin
Building Valley as built-in plugin
Building RackCore as built-in plugin
CMAKE_CXX_COMPILER_ID = AppleClang
set ASSET_DIR to /Users/jeremy/vcv/metamodule/simulator/build/assets
set ASSET_IMG_PATH to /Users/jeremy/vcv/metamodule/simulator/build/assets.uimg
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/metamodule-rack-interface/CMakeLists.txt:1 (add_library):
add_library cannot create target "metamodule-rack-interface" because
another target with the same name already exists. The existing target is
an interface library created in source directory
"/Users/jeremy/vcv/metamodule/firmware/metamodule-plugin-sdk/metamodule-rack-interface".
See documentation for policy CMP0002 for more details.
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/metamodule-rack-interface/CMakeLists.txt:2 (add_library):
add_library cannot create ALIAS target "metamodule::rack-interface" because
another target with the same name already exists.
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/metamodule-core-interface/CMakeLists.txt:3 (add_library):
add_library cannot create target "metamodule-core-interface" because
another target with the same name already exists. The existing target is
an interface library created in source directory
"/Users/jeremy/vcv/metamodule/firmware/metamodule-plugin-sdk/metamodule-core-interface".
See documentation for policy CMP0002 for more details.
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/metamodule-core-interface/CMakeLists.txt:4 (add_library):
add_library cannot create ALIAS target "metamodule::core-interface" because
another target with the same name already exists.
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/cpputil/CMakeLists.txt:3 (add_library):
add_library cannot create target "cpputil" because another target with the
same name already exists. The existing target is a static library created
in source directory "/Users/jeremy/vcv/metamodule/firmware/lib/cpputil".
See documentation for policy CMP0002 for more details.
CMake Error at /Users/jeremy/vcv/metamodule-plugin-sdk/cpputil/CMakeLists.txt:4 (add_library):
add_library cannot create ALIAS target "cpputil::cpputil" because another
target with the same name already exists.
-- Configuring incomplete, errors occurred!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment