Using cmake for building VST 3 plug-ins
On this page:
- Goal
- CMake for building VST 3 plug-ins
- Command line for Windows
- Command line for macOS
- On Linux with QtCreator
- Use of cmake-gui
- Available SMTG cmake options
- Using your IDE for compiling the examples
Related pages:
- How to set up my system for VST 3
- Building the examples included in the SDK on Windows
- Building the examples included in the SDK on macOS
- Building the examples included in the SDK on Linux
Goal
This tutorial explains how to use cmake with VST 3 SDK.
CMake for building VST 3 plug-ins
The SDK provides a set of cmake files allowing you to compile the included samples and to develop new plug-ins.
- Download cmake from: https://cmake.org or use a package manager for your OS (See How to set up my system for VST 3).
- You can use the command line or the cmake editor (cmake-gui).
Command line for Windows
Example for building Microsoft Studio 17 2022 solution:
// go in to the folder where you extracted the VST 3 SDK
mkdir build
cd build
cmake.exe -G "Visual Studio 17 2022" -A x64 "..\vst3sdk"
// or without symbolic links
cmake.exe -G "Visual Studio 17 2022" -A x64 "..\vst3sdk" -DSMTG_CREATE_PLUGIN_LINK=0
// or with symbolic links but using the user location (enable by default), it does not request admin right
cmake.exe -G "Visual Studio 17 2022" -A x64 "..\vst3sdk" -DSMTG_PLUGIN_TARGET_USER_PROGRAM_FILES_COMMON=1
// note: you can find the string definition for different Visual Studio Generators in the cmake online documentation
Command line for macOS
Example for building Xcode project:
// go in to the folder where you extracted the VST 3 SDK
mkdir build
cd build
/Applications/CMake.app/Content/bin/cmake -G"Xcode" "../vst3sdk"
On Linux with QtCreator
You can use QtCreator 2.3.1 (or higher)
- start QtCreator 2.3.2
- open the CMakeLists.txt located at the top of the VST3_SDK folder
- click on the menu Build->Run CMake
Use of cmake-gui
- start the CMake (cmake-gui) application
- set Where is the source code to the location of the VST3_SDK folder
- set Where to build the binaries to a build folder of yourchoice
- click on Configure
- click on Generate for creating project/solution
Example of cmakegui application on Windows
- Compile with cmake command line
cd build
cmake --build
- Choose a specific compiler with cmake (command line on Linux)
cmake -DCMAKE_C_COMPILER=/usr/bin/clang-DCMAKE_CXX_COMPILER=/usr/bin/clang++
// or
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-DCMAKE_CXX_COMPILER=/usr/bin/g++
Available SMTG cmake options
SMTG_AAX_SDK_PATH
: Here, you can define where the AAX SDK is located (if needed)SMTG_ADD_VST3_UTILITIES
: Build VST Utilities (default ON)SMTG_CREATE_MODULE_INFO
: Create the moduleinfo.json file (default ON)SMTG_CUSTOM_BINARY_LOCATION
: Customize output location for binariesSMTG_CXX_STANDARD
: C++ standard version used for plugins: 14, 17, 20, 23SMTG_ENABLE_ADDRESS_SANITIZER
: Enable Address Sanitizer (default OFF)SMTG_ENABLE_TARGET_VARS_LOG
: Enables to log target variables for debugging (new since 3.6.11!) (default OFF)SMTG_ENABLE_VST3_HOSTING_EXAMPLES
: Enable VST 3 Hosting Examples (default ON)SMTG_ENABLE_VST3_PLUGIN_EXAMPLES
: Enable VST 3 Plug-in Examples (default ON)SMTG_ENABLE_VSTGUI_SUPPORT
: Enable VSTGUI Support (default ON)SMTG_MDA_VST3_VST2_COMPATIBLE
: Build the MDA examples as a replacement for their VST 2 counterpart (default ON)SMTG_PLUGIN_TARGET_USER_PATH
: Here, you can redefine the VST 3 plug-ins folderSMTG_RENAME_ASSERT
: Rename ASSERT to SMTG_ASSERT to avoid conflicts with 3rd party libraries (default ON)SMTG_RUN_VST_VALIDATOR
: Run the VST validator on VST 3 plug-ins each time they are built (default ON)
Specific Windows
SMTG_CREATE_BUNDLE_FOR_WINDOWS
: Create bundle on Windows for the VST 3 plug-ins (new since 3.6.10!) (default ON)SMTG_CREATE_PLUGIN_LINK
: Create symbolic link for each VST 3 plug-in in ${VST3_FOLDER_NAME} folder (you need to have Administrator rights on Windows or change the Local Group Policy to allow the creation of symbolic links) (default ON)SMTG_PLUGIN_TARGET_USER_PROGRAM_FILES_COMMON
: use FOLDERID_UserProgramFilesCommon as VST 3 target path (default ON)SMTG_USE_STATIC_CRT
: Use static CRuntime on Windows (option /MT) (default OFF: /MD is used)
Specific macOS/iOS
SMTG_AUDIOUNIT_SDK_PATH
: Path to AudioUnit SDKSMTG_BUILD_INTERAPPAUDIO
: Enable building the iOS InterAppAudio examples (deprecated) (default OFF)SMTG_BUILD_UNIVERSAL_BINARY
: Build universal binary (32 & 64 bit)SMTG_CODE_SIGN_IDENTITY_IOS
: iOS Code Sign IdentitySMTG_CODE_SIGN_IDENTITY_MAC
: macOS Code Sign IdentitySMTG_COREAUDIO_SDK_PATH
: Here, you can define where the COREAUDIO SDK is locatedSMTG_DISABLE_CODE_SIGNING
: Disable All Code Signing (default OFF)SMTG_ENABLE_IOS_TARGETS
: Enable building iOS targets (default OFF)SMTG_IOS_DEVELOPMENT_TEAM
: Needed for building the InterAppAudio and AUv3 examples for iOSSMTG_VSTSDK_GENERATE_MACOS_IOS_COLLECTION_TARGETS
: Create macOS and iOS collection targets (default OFF)SMTG_XCODE_MANUAL_CODE_SIGN_STYLE
: Manual Xcode sign style (default OFF)SMTG_XCODE_OTHER_CODE_SIGNING_FLAGS
: Other code signing flags [Xcode] (default --timestamp)
Using your IDE for compiling the examples
- Solution/project (vstsdk.sln/vstsdk.xcodeproj) is generated in the "build" folder.
- The created plug-ins are located in the "build" folder, in sub-folders /VST3/Release or /VST3/Debug.
- In order to allow a DAW to find these plug-ins you have to create links from the official VST 3 Locations to them.