CMake Setup


Make sure you followed the installation instructions first before to continue this setup. If you encounter problems, please ask for support in our Discord server.

After the SDK has been successfully installed, it can be used into CMake-based projects. You should make sure that the AM_SDK_PATH environment variable is set before to configure your project. If not, you can manually set it as a CMake variable using the CLI:

cmake -DAM_SDK_PATH=/path/to/amplitude -S /path/to/sources -B /path/to/build

Or directly in your CMakeLists.txt file:

set(AM_SDK_PATH "/path/to/amplitude" CACHE PATH "The path to Amplitude Audio SDK libraries.")

After the AM_SDK_PATH variable is set, you should add the path to CMake scripts provided by the SDK to the current CMAKE_MODULE_PATH variable. For example:

# If using the environment variable

# If using the CMake variable

This will make available the FindAmplitudeAudioSDK.cmake and the DetectAmplitudeVersion.cmake scripts.

You can now call the find_package CMake function to make the SDK libraries available to your project:

find_package(AmplitudeAudioSDK REQUIRED)

After this call, 2 libraries will be available:

  • SparkyStudios::Audio::Amplitude::SDK::Shared: Amplitude Audio SDK as a shared library. You can link to this library if you intend to use plugins, or you don’t want static linking.
  • SparkyStudios::Audio::Amplitude::SDK::Static: Amplitude Audio SDK as a static library. Linking to this library will make your project unable to load plugins at runtime, as they need dynamic linking to work properly.

You just have to pick the one which suits the best to your needs and link your project with it:

# Shared library
    PRIVATE SparkyStudios::Audio::Amplitude::SDK::Shared

# Static library
    PRIVATE SparkyStudios::Audio::Amplitude::SDK::Static

Now you can use the SDK in your project!