AVS Device SDK CMake Parameters

CMake is a build tool that manages app dependencies and creates native make files suitable for your Alexa Voice Service (AVS) Device SDK project.

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

Build

The 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. Displays 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

Android

Use the following CMake 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

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.

PORTAUDIO_INCLUDE_DIR: Specifies the path to the PortAudio directory.
- 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

Bluetooth

Bluetooth is optional and only available for Linux and Raspberry Pi.

Make sure you install the required dependencies before building with Bluetooth.

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 app.
cmake -DBLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS=ON

Captions

The Alexa Voice Service (AVS) Device SDK 1.17 adds support for captions.

Feature Parameter Use Example
Enables Captions
Only available in 1.17 and higher
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
Only available in 1.17 and higher
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
Only available in 1.17 and higher
LIBWEBVTT_INCLUDE_DIR Required if CAPTION=ON, otherwise ignore cmake -DCAPTIONS=ON -DLIBWEBVTT_INCLUDE_DIR=[absolute path to webvtt/include]

Custom dependencies

The Alexa Voice Service (AVS) Device SDK 1.19 adds support to customize the dependencies that build with the SDK.

Feature Parameter Use Example
Build with a customized version of curl
Only available in 1.19 and higher
CURL_LIBRARY 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
Only available in 1.19 and higher
SQLITE_LIBRARY 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
Only available in 1.20 and higher
CRYPTO_LIBRARY 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]
Enable ccache to help speed compile time.
Only available in 1.20 and higher
USE_CCACHE - OFF
- ON

Default: OFF.
cmake [path to source] -DUSE_CCACHE=ON
Toggles the use of Run Time Type Information (RTTI) in the SDK.
Only available in 1.20 and higher
ACSDK_USE_RTTI - OFF
- ON

Default: OFF. This option defaults to OFF, except for WIN32 builds, where it must be ON
cmake [path to source] -DACSDK_USE_RTTI=ON
Overwrite the default memory allocator for RapidJSON.
Only available in 1.20 and higher
RAPIDJSON_MEM_OPTIMIZATION To overwrite the default memory allocator of use an OFF value. Using OFF builds the SDK with same settings as the Version 1.19 and lower cmake [path to source] -DRAPIDJSON_MEM_OPTIMIZATION=OFF

Custom media player

Feature Parameter Use Example
Enable a custom media player CUSTOM_MEDIA_PLAYER - OFF
- ON

Default: OFF
cmake -DCUSTOM_MEDIA_PLAYER=ON[Path to custom media player]

Diagnostics

Enable diagnostics tools – file audio injection, protocol trace, and device properties aggregation. Access these 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.
Only available in 1.18 and higher
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
Only available in 1.18 and higher
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 isn't available.
cmake -DDIAGNOSTICS=ON -DAUDIO_INJECTION=ON -DCMAKE_BUILD_TYPE=DEBUG
Control device properties
Only available in 1.18 and higher
DEVICE_PROPERTIES - OFF
- ON

Default: OFF
cmake -DDIAGNOSTICS=ON -DDEVICE_PROPERTIES=ON -DCMAKE_BUILD_TYPE=DEBUG
Control protocol trace
Only available in 1.18 and higher
PROTOCOL_TRACE - OFF
- ON

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

Endpoints

The Alexa Voice Service (AVS) Device SDK 1.17 adds support for 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
Only available in 1.17 and higher
ENABLE_ALL_ENDPOINT_CONTROLLERS - OFF
- ON

Default: OFF
cmake [path to source] -DENABLE_ALL_ENDPOINT_CONTROLLERS=ON
Enable toggle endpoints
Only available in 1.17 and higher
ENDPOINT_CONTROLLERS_TOGGLE_CAPABILITY - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_TOGGLE_CAPABILITY=ON
Enable mode endpoints
Only available in 1.17 and higher
ENDPOINT_CONTROLLERS_MODE_CONTROLLER - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_MODE_CONTROLLER=ON
Enable range endpoints
Only available in 1.17 and higher
ENDPOINT_CONTROLLERS_RANGE_CONTROLLER - OFF
- ON

Default: OFF
cmake [path to source] -DENDPOINT_CONTROLLERS_RANGE_CONTROLLER=ON
Enable power endpoints
Only available in 1.17 and higher
ENDPOINT_CONTROLLERS_POWER_CONTROLLER - OFF
- ON

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

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 to 9. The higher the number, the more information that's shown DEBUG[x] DEBUG0,DEBUG1,DEBUG2,DEBUG3,DEBUG4,DEBUG5,DEBUG6,DEBUG7,DEBUG8,DEBUG9 ./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

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

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

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

Additional options

You can build the SDK with the following additional options.

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 Device 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 Device 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]
SAMPLE-AES decryption

Opus is an interactive audio codec supported by the AVS Device 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]