diff --git a/Makefile b/Makefile index c72a7b3..fa695fd 100644 --- a/Makefile +++ b/Makefile @@ -83,17 +83,21 @@ FLAGS += -DNDEBUG # TODO is this OK? supercollider := dep/supercollider/build/lang/libsclang.a OBJECTS += $(supercollider) DEPS += $(supercollider) +DISTRIBUTABLES += dep/supercollider/SCClassLibrary +DISTRIBUTABLES += support/supercollider_extensions SUPERCOLLIDER_CMAKE_FLAGS += -DSUPERNOVA=OFF -DSC_EL=OFF -DSC_VIM=OFF -DSC_ED=OFF -DSC_IDE=OFF -DSC_ABLETON_LINK=OFF -DSC_QT=OFF -DCMAKE_BUILD_TYPE=Release -DSCLANG_SERVER=OFF -DBUILD_TESTING=OFF SUPERCOLLIDER_SUBMODULES += external_libraries/hidapi external_libraries/nova-simd external_libraries/nova-tt external_libraries/portaudio_sc_org external_libraries/yaml-cpp SUPERCOLLIDER_BRANCH := topic/vcv-prototype-support -# TODO need some better way of getting link library names! -LDFLAGS += dep/supercollider/build/lang/../external_libraries/libtlsf.a /usr/lib/libpthread.dylib dep/supercollider/build/lang/../external_libraries/hidapi/mac/libhidapi.a dep/supercollider/build/lang/../external_libraries/hidapi/hidapi_parser/libhidapi_parser.a dep/supercollider/build/lang/../external_libraries/libboost_thread_lib.a dep/supercollider/build/lang/../external_libraries/libboost_system_lib.a dep/supercollider/build/lang/../external_libraries/libboost_regex_lib.a dep/supercollider/build/lang/../external_libraries/libboost_filesystem_lib.a /usr/local/opt/readline/lib/libreadline.dylib -framework Carbon -framework CoreAudio -framework CoreMIDI -framework CoreServices -framework IOKit -framework CoreFoundation /usr/local/opt/libsndfile/lib/libsndfile.dylib dep/supercollider/build/lang/../external_libraries/libyaml.a +# FIXME should be able to find some better way of getting link library names! +LDFLAGS += $$(cat dep/supercollider/build/lang/vcv_libsclang_link_line.txt) $(supercollider): cd dep && git clone "https://github.com/supercollider/supercollider" --branch $(SUPERCOLLIDER_BRANCH) --depth 5 cd dep/supercollider && git submodule update --init -- $(SUPERCOLLIDER_SUBMODULES) + cd dep/supercollider && git apply ../../support/supercollider_get_libsclang_link_line.patch cd dep/supercollider && mkdir build && cd build cd dep/supercollider/build && cmake .. -G "Unix Makefiles" $(SUPERCOLLIDER_CMAKE_FLAGS) cd dep/supercollider/build && $(MAKE) libsclang + cd dep/supercollider/build && $(MAKE) generate_libsclang_link_line endif # Python diff --git a/src/SuperColliderEngine.cpp b/src/SuperColliderEngine.cpp index d48c9c6..6db72b1 100644 --- a/src/SuperColliderEngine.cpp +++ b/src/SuperColliderEngine.cpp @@ -161,7 +161,7 @@ SC_VcvPrototypeClient::SC_VcvPrototypeClient(SuperColliderEngine* engine) { using Path = SC_LanguageConfig::Path; Path sc_lib_root = rack::asset::plugin(pluginInstance, "dep/supercollider/SCClassLibrary"); - Path sc_ext_root = rack::asset::plugin(pluginInstance, "dep/supercollider_extensions"); + Path sc_ext_root = rack::asset::plugin(pluginInstance, "support/supercollider_extensions"); Path sc_yaml_path = rack::asset::plugin(pluginInstance, "dep/supercollider/sclang_vcv_config.yml"); if (!SC_LanguageConfig::defaultLibraryConfig(/* isStandalone */ true)) diff --git a/support/supercollider_extensions/VcvPrototypeProcessBlock.sc b/support/supercollider_extensions/VcvPrototypeProcessBlock.sc new file mode 100644 index 0000000..a6801fb --- /dev/null +++ b/support/supercollider_extensions/VcvPrototypeProcessBlock.sc @@ -0,0 +1,23 @@ +// Represents a process block in VCV Prototype. Users should generally not create instances +// of this class themselves, and should only modify the values in `outputs`, `knobs`, `lights`, +// and `switchLights`. +// +// Original author: Brian Heim + +VcvPrototypeProcessBlock { + classvar <>numRows; // Set internally, do not modify + + // Code in SuperColliderEngine.cpp relies on ordering. + var outputs; // Array[numRows] of Signal[bufferSize] + var <>knobs; // FloatArray[numRows] + var lights; // Array[numRows] of FloatArray[3] + var <>switchLights; // Array[numRows] of FloatArray[3] + + // TODO not needed? + *new { |... args| ^super.newCopyArgs(*args); } +} diff --git a/support/supercollider_get_libsclang_link_line.patch b/support/supercollider_get_libsclang_link_line.patch new file mode 100644 index 0000000..26f70aa --- /dev/null +++ b/support/supercollider_get_libsclang_link_line.patch @@ -0,0 +1,22 @@ +diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt +index f370ad7..f73309f 100644 +--- a/lang/CMakeLists.txt ++++ b/lang/CMakeLists.txt +@@ -388,3 +388,17 @@ else() + RUNTIME DESTINATION "bin" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + endif() ++ ++set(LIBSCLANG_LINK_LINE_FILE vcv_libsclang_link_line.txt) ++get_target_property(libsclang_libs libsclang INTERFACE_LINK_LIBRARIES) ++add_custom_command(OUTPUT ${LIBSCLANG_LINK_LINE_FILE} COMMAND echo) ++foreach(lib IN LISTS libsclang_libs) ++ if(TARGET ${lib}) ++ add_custom_command(APPEND OUTPUT ${LIBSCLANG_LINK_LINE_FILE} ++ COMMAND echo $ ">>" ${LIBSCLANG_LINK_LINE_FILE}) ++ else() ++ add_custom_command(APPEND OUTPUT ${LIBSCLANG_LINK_LINE_FILE} ++ COMMAND echo ${lib} ">>" ${LIBSCLANG_LINK_LINE_FILE}) ++ endif() ++endforeach() ++add_custom_target(generate_libsclang_link_line DEPENDS ${LIBSCLANG_LINK_LINE_FILE})