VST SDK Problems when building from source via CMake

I’m still new at JUCE and the C++ ecosystem. I want to get JUCE building from source, preferably with all the examples and extras.

Sorry if this VST2 SDK issue has been done to death, but after searching this forum I still don’t get it. The post I was looking at: Plugininterfaces/vst2.x/vstfxstore.h not found

What I’m doing:

  1. Clone JUCE source from github, checkout latest release (6.1.2 at the moment)
  2. Generate a build tree with CMAKE
    cmake -B cmake-build-new -DCMAKE_INSTALL_PREFIX=/Users/me/projects/libs/juce -DJUCE_BUILD_EXAMPLES=ON -DJUCE_BUILD_EXTRAS=ON
  3. Start build
    cmake --build ./cmake-build-new --target install

It chugs along for a while and errors out with this

JUCE/examples/Plugins/ReaperEmbeddedViewPluginDemo.h:70:10: fatal error: 'pluginterfaces/vst2.x/aeffect.h' file not found

Looking at that source file it seems that the include is not behind any switch that I can turn off, but maybe I’m missing something.

I know VST2 SDK is no longer included. I do not have it installed, I’m just starting out. I don’t mind not being able to build VST2.

What’s the best way to get JUCE building? Can I turn off examples that depend on VST2? Should I copy the VST2 SDK from an older version of JUCE 5.3.2? Where are they in the source tree?

Thanks for reading this far. I think this would help other newcomers eventually.

Unless you’re quite familiar with CMake, it’s probably easiest to avoid installing JUCE altogether, and instead to just put it in a subdirectory of your project and then call add_subdirectory(path/to/JUCE) in your CMakeLists.

If you do want to install JUCE, you should do so with all of the examples/extras disabled. The examples/extras are not required for JUCE to function correctly, and will slow the intial build down considerably. Unfortunately there’s currently no way to build the examples from an installed copy of JUCE, so if you go this route you’ll probably need two separate build directories - one for reference (with the examples enabled) and one for installation (with the examples disabled).

To be clear, I’m suggesting something like:

# Install JUCE
cmake -B cmake-build-install -DCMAKE_INSTALL_PREFIX=/juce/prefix/path
cmake --build cmake-build-install --target install

# You can now locate JUCE in your own project by configuring the project with
# `-DJUCE_ROOT=/juce/prefix/path` and calling `find_package(JUCE CONFIG REQUIRED)`
# in the project's CMakeLists

# Configure examples
cmake -B cmake-build-examples -DCMAKE_BUILD_TYPE=Debug -DJUCE_BUILD_EXTRAS=ON -DJUCE_BUILD_EXAMPLES=ON

# Build some specific targets (building everything will take ages!)
cmake --build cmake-build-examples --target DemoRunner --target Projucer

Thank you for the tips, @reuk ! That makes sense. Having two build trees sounds like a good idea!

Turning off examples (removing -DJUCE_BUILD_EXAMPLES=ON) allowed me to build the install target. I could also keep extras on to build Projucer with no problems.

Off to the races!

On a related note:

Steinberg’s VST Github repo (GitHub - steinbergmedia/vst3sdk: VST 3 Plug-In SDK)
… Links to a download page for the VST SDK (3rd-party developers support & SDKs | Steinberg). The SDK download seems to include vst2 sdk. Haven’t tried it, though.