jpcima / ysfx

Hosting library for JSFX
Apache License 2.0
159 stars 25 forks source link

How to use external VST and JUCE packages? #63

Closed yurivict closed 1 year ago

yurivict commented 1 year ago

Bundled VST3 breaks:

In file included from /disk-samsung/freebsd-ports/audio/ysfx/work/.build/_deps/juce-src/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp:42:
/disk-samsung/freebsd-ports/audio/ysfx/work/.build/_deps/juce-src/modules/juce_audio_processors/format_types/juce_VST3Headers.h:29:3: error: To build JUCE VST3 plug-ins on BSD you must use an external BSD-compatible VST3 SDK with JUCE_CUSTOM_VST3_SDK=1
 #error To build JUCE VST3 plug-ins on BSD you must use an external BSD-compatible VST3 SDK with JUCE_CUSTOM_VST3_SDK=1
  ^

This problem is definitely solved in the VST3 port.

How to use external packages? vst3sdk-3.7.4.b.25 juce-6.0.8_4

FreeBSD 13.1

jpcima commented 1 year ago

Since the revision 5ea0713, you will be able to give cmake a custom path to VST3 SDK -DYSFX_PLUGIN_VST3_SDK_PATH=<path>

It's relevant documentation from JUCE. This will define JUCE_CUSTOM_VST3_SDK to 1. https://github.com/juce-framework/JUCE/blob/master/docs/CMake%20API.md#juce_set_kind_sdk_path

yurivict commented 1 year ago

I supplied -DYSFX_PLUGIN_VST3_SDK_PATH=/usr/local and it failed:

In file included from /disk-samsung/freebsd-ports/audio/ysfx/work/.build/_deps/juce-src/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp:26:
In file included from /disk-samsung/freebsd-ports/audio/ysfx/work/.build/_deps/juce-src/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp:42:
/disk-samsung/freebsd-ports/audio/ysfx/work/.build/_deps/juce-src/modules/juce_audio_processors/format_types/juce_VST3Headers.h:114:11: fatal error: 'pluginterfaces/vst/vsttypes.h' file not found
 #include <pluginterfaces/vst/vsttypes.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

This file is installed at /usr/local/include/vst3sdk/vsttypes.h.

yurivict commented 1 year ago

I am trying to create the FreeBSD port for ysfx. Package builders don't allow to download anything during build. Juce package should be used. Is juce-6.0.8 sufficient for ysfx?

jpcima commented 1 year ago

This file is installed at /usr/local/include/vst3sdk/vsttypes.h.

This structure does not seem right. Every VST code which i've met, in includes files like <pluginterfaces/...> and <public.sdk/...>.

Is juce-6.0.8 sufficient for ysfx?

Most likely not, juce7 has made ysfx move on from deprecated API to new ones appeared in JUCE 7.

yurivict commented 1 year ago

Are you able to add a variable like YSFX_JUCE_PATH to use external JUCE?

Many systems have JUCE packaged and would benefit from this.

jpcima commented 1 year ago

Are you able to add a variable like YSFX_JUCE_PATH to use external JUCE?

Yes this is added, in revision 6706f64. option YSFX_PLUGIN_JUCE_SDK_PATH

jpcima commented 1 year ago

Many systems have JUCE packaged and would benefit from this.

IMO not, in experience, JUCE does not care to maintain API compatibility between their versions, neither forward or backward. It's better that software bundle exactly what version they need.

yurivict commented 1 year ago

Now it fails with:

CMake Error at cmake.plugin.txt:26 (add_subdirectory):
  The source directory

    /usr/local

  does not contain a CMakeLists.txt file.

JUCE is a header-only library. YSFX_PLUGIN_JUCE_SDK_PATH should probably assume the headers directory, which is currently $PREFIX/include/JUCE-7.0.1.

Or maybe it should assume $PREFIX because bin/juceaide is also needed (?) for build?

jpcima commented 1 year ago

I don't have familiarity with these file hierarchies which you describe. Usually juce will have a file CMakeLists.txt at the root of some SDK folder that projects can pick up as a subfolder.

Is $PREFIX/include/JUCE-7.0.1 a SDK folder containing CMakeLists?

Or maybe it should assume $PREFIX because bin/juceaide is also needed (?) for build?

Precompiled juceaide is not used, add_subdirectory of JUCE will compile it.

yurivict commented 1 year ago

Usually juce will have a file CMakeLists.txt at the root of some SDK folder that projects can pick up as a subfolder.

You are talking about the JUCE source tree. When JUCE is installed it installs a lot of C++ headers and 2 binaries. No CMakeLists.txt is installed.

JUCE is mostly a C++ headers-only library which also comes with the IDE which is called Projucer.

jpcima commented 1 year ago

Ok I figured this out, so JUCE 7 is able to install itself on system by make install. It sets itself up, not in "SDK" form, but as cmake Find module.

Hence, using should probably be something like find_package(JUCE), instead of FetchContent.

I'll give this a check.

jpcima commented 1 year ago

I've added option to use system JUCE like you have. works here (JUCE 7.0.1 used) -DYSFX_PLUGIN_USE_SYSTEM_JUCE=ON

yurivict commented 1 year ago

This works, thanks!