AVS Device SDK Cmake Parameters

CMake is a build tool that manages application dependencies and creates native make files suitable for your project. It's an easy way to create and build the AVS Device SDK for C++.

Use the following cmake variables to customize how your SDK builds.

Build

The AVS SDK supports the CMAKE_BUILD_TYPE parameter. You can build the SDK with different Cmake configurations. By default, the SDK builds using the RELEASE flag.

Feature Parameter Use Example
Sets the default build type CMAKE_BUILD_TYPE Use the -D. at the front of your cmake command

DEBUG - Enables logging. Shows debug logs with -g compiler flag.

RELEASE - Adds -O2 flag and removes -g flag.

MINISIZEREL - Compiles with RELEASE flags and optimizations (-Os) for a smaller build size
cmake [absolute path to source] -DCMAKE_BUILD_TYPE=DEBUG

Logs

Control how the SDK manages logs.

Feature Parameter Use Example
Specify a debug log level when you invoke the sample app. Choose a number from 0-9. The higher the number, the more information that's shown DEBUG[x] DEBUG0,DEBUG1,DEBUG2,DEBUG3,DEBUG4,DEBUG5,DEBUG6,DEBUG7,DEBUG8,DEBUG9 cmake ./SampleApp/src/SampleApp ./Integration/AlexaClientSDKConfig.json DEBUG9
Log sensitive data logging in Debug builds. Turned OFF by default ACSDK_EMIT_SENSITIVE_LOGS - OFF
- ON

IMPORTANT: Make sure you redact any sensitive data if posting logs publicly
cmake -DACSDK_EMIT_SENSITIVE_LOGS=ON

Custom dependencies

Customize the dependencies that build with the SDK.

Feature Parameter Use Example
Build with a customized version of curl - Uses version included with SDK by default cmake [path to source] -DCURL_LIBRARY=[path to curl library] -DCURL_INCLUDE_DIR=[path to curl include directory]
Build with a customized version of SQLite - Uses version included with SDK by default cmake [path to source] -DSQLITE_LIBRARY=[path to sql library] -DSQLITE_INCLUDE_DIR=[path to sql include directory]
Build with a customized version of crypto - Uses version included with SDK by default cmake [path to source] -DCRYPTO_LIBRARY=[path to crypto library] -DCRYPTO_INCLUDE_DIR=[path to crypto include directory]

Bluetooth

Bluetooth is optional and only available for Linux and Raspberry Pi. To build with Bluetooth, make sure you install the required dependencies before trying the following cmake parameters.

Feature Parameter Use Example
Enables Bluetooth, based on BlueZ BLUETOOTH_BLUEZ - OFF
- ON

Default: OFF
cmake -DBLUETOOTH_BLUEZ=ON
Automates loading and unloading of PulseAudio Bluetooth modules. BLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS - OFF
- ON

Default: OFF

IMPORTANT: By enabling this option, the AVS Device SDK for C++ makes modifications to the PulseAudio application
cmake -DBLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS=ON

Audio

Feature Parameter Use Example
Enables a reference implementation of the GStreamer GSTREAMER_MEDIA_PLAYER - OFF
- ON

Default: OFF
cmake -DGSTREAMER_MEDIA_PLAYER=ON

If GStreamer is installed from source, specify the prefix path

cmake \ -DCMAKE_PREFIX_PATH=[absolute path to GStreamer build]
Enables PortAudio PORTAUDIO_LIB_PATH: Specifies the path to the PortAudio library.

Specifies the path to the PortAudio directory: PORTAUDIO_INCLUDE_DIR
- OFF
- ON

Default: ON
cmake [absolute path to source] -DPORTAUDIO=ON -DPORTAUDIO_LIB_PATH=[absolute path]/portaudio/lib/.libs/libportaudio.a -DPORTAUDIO_INCLUDE_DIR=[absolute path]/portaudio/include

Wake word

The AVS Device SDK supports wake word detectors from Sensory. Use the following cmake parameters to build with a wake word detector.

Feature Parameter Use Example
Enables wake word during build {WAKEWORD}_KEY_WORD_DETECTOR - OFF
- ON

Default: OFF
cmake \ -D{WAKEWORD}_KEY_WORD_DETECTOR=ON
Enable Sensory WAKEWORD Replace [SENSORY] with your wake word detector variable
cmake [absolute-path-to-source] -DSENSORY_KEY_WORD_DETECTOR=ON

Extra Parameters

  • [wake-word-name]_KEY_WORD_DETECTOR_LIB_PATH=[absolute-path-to-lib]
    • The path to the wake word detector library.
  • [wake-word-name]_KEY_WORD_DETECTOR_INCLUDE_DIR=[absolute-path-to-include-dir]
    • The path to the wake word detector include directory.

Example

Sensory

cmake [absolute path to source]-DSENSORY_KEY_WORD_DETECTOR=ON -DSENSORY_KEY_WORD_DETECTOR_LIB_PATH=[absolute-path]/alexa-rpi/lib/libsnsr.a -DSENSORY_KEY_WORD_DETECTOR_INCLUDE_DIR=[absolute-path]/alexa-rpi/include

Captions

Feature Parameter Use Example
Enables Captions CAPTIONS=ON - OFF
- ON

Default: OFF

If CAPTIONS=ON, you must also define LIBWEBVTT_LIB_PATH and LIBWEBVTT_INCLUDE_DIR
cmake -DCAPTIONS=ON -DLIBWEBVTT_INCLUDE_DIR=[absolute path to webvtt/include] -DLIBWEBVTT_LIB_PATH=[absolute path to webvtt/build/src/webvtt/libwebvtt.a]

The absolute path to the prebuilt static library for libwebvtt LIBWEBVTT_LIB_PATH Required if CAPTION=ON, otherwise ignore cmake -DCAPTIONS=ON -DLIBWEBVTT_LIB_PATH=[absolute path to webvtt build/src/webvtt/libwebvtt.a]
The absolute path to the directory containing the C header files of the libwebvtt library LIBWEBVTT_INCLUDE_DIR Required if CAPTION=ON, otherwise ignore cmake -DCAPTIONS=ON -DLIBWEBVTT_INCLUDE_DIR=[absolute path to webvtt/include]

Metrics

Feature Parameter Use Example
Enable metrics recording METRICS - OFF
- ON

Default: OFF
cmake -DMETRICS=ON

Endpoints

SDK supports the following endpoint controller capabilities: Toggle, Mode and Range. You can also test them in the Sample app.

Feature Parameter Use Example
Enable all endpoints ENABLE_ALL_ENDPOINT_CONTROLLERS - OFF
- ON

Default: OFF
cmake [path to source] -DENABLE_ALL_ENDPOINT_CONTROLLERS=ON
Enable toggle endpoints ENDPOINT_CONTROLLERS_TOGGLE_CAPABILITY - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_TOGGLE_CAPABILITY=ON
Enable mode endpoints ENDPOINT_CONTROLLERS_MODE_CONTROLLER - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_MODE_CONTROLLER=ON
Enable range endpoints ENDPOINT_CONTROLLERS_RANGE_CONTROLLER - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_RANGE_CONTROLLER=ON
Enable power endpoints ENDPOINT_CONTROLLERS_POWER_CONTROLLER - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_POWER_CONTROLLER=ON

Diagnostics

Enable diagnostics tools – file audio injection, protocol trace, and device properties aggregation. Access these tools through the diagnostic menu, by pressing o after starting and authorizing the Sample App.

Audio injection replaces a real microphone and can't be used if another microphone, such as PortAudio, is enabled. Note that these tools are available in DEBUG mode only, and must not be enabled in devices built for release

Feature Parameter Use Example
Enable all diagnostic tools. DIAGNOSTICS - OFF
- ON

Default: OFF

When this flag is on, all diagnostic components are enabled by default. You can control individual components – or use different combinations – by using the individual flags below.
cmake -DIAGNOSTICS=ON -DCMAKE_BUILD_TYPE=DEBUG
Enable file audio injection only AUDIO_INJECTION - OFF
- ON

Default: OFF

To enable, you must NOT enable a microphone component. Audio injection and microphones are incompatible. If you turn on this flag but also enable a microphone component – for example, Portaudio – audio injection is not available.
cmake -DDIAGNOSTICS=ON AUDIO_INJECTION=ON -DCMAKE_BUILD_TYPE=DEBUG
Control device properties DEVICE_PROPERTIES - OFF
- ON

Default: OFF
cmake -DDIAGNOSTICS=ON DEVICE_PROPERTIES=ON -DCMAKE_BUILD_TYPE=DEBUG
Control protocol trace PROTOCOL_TRACE - OFF
- ON

Default: OFF
cmake -DDIAGNOSTICS=ON PROTOCOL_TRACE=ON -DCMAKE_BUILD_TYPE=DEBUG

Android

Use the following parameters when creating an Android build of the SDK.

Feature Parameter Use Example
Enables the Android build ANDROID - OFF
- ON

Default: OFF
cmake -DANDROID=ON
Publishes logs using the Android logging facility ANDROID_LOGGER - OFF
- ON

Default: ON
cmake ANDROID_LOGGER
Uses the Android microphone implementation, based on the Native Development Kit (NDK) ANDROID_MICROPHONE - OFF
- ON

Default: ON
cmake ANDROID_MICROPHONE
Uses the Android microphone implementation, based on the Native Development Kit (NDK) ANDROID_MEDIA_PLAYER - OFF
- ON

Default: ON
cmake ANDROID_MEDIA_PLAYER
The SDK installation path on the Android device or emulator ANDROID_DEVICE_INSTALL_PREFIX - OFF
- ON

Default: ON
cmake ANDROID_DEVICE_INSTALL_PREFIX

Additional options

You can build the SDK with the following additional options. Include the following variables in your CMake build:

Feature Parameter Use Example
Alexa for Business (A4B) DA4B - OFF
- ON

Default: OFF

Turning on enables A4B, including support for RevokeAuthorization directives.
cmake -DA4B=ON
Opus

Opus is an interactive audio codec supported by the AVS SDK v1.11 +.
OPUS - OFF
- ON

Default: OFF

To enable, you must install libopus
cmake -DOPUS=ON
SAMPLE-AES decryption

Opus is an interactive audio codec supported by the AVS SDK v1.11 +.
ENABLE_SAMPLE_AES - OFF
- ON

Default: OFF.

To enable SAMPLE-AES decryption for HLS playlists, the FFMPEG dependency is required, and the build options FFMPEG_INCLUDE_DIR & FFMPEG_LIB_PATH must be provided.
cmake -DENABLE_SAMPLE_AES=ON -DFFMPEG_INCLUDE_DIR=[absolute path to ffmpeg include directory] -DFFMPEG_LIB_PATH=[absolute path to ffmpeg library]