Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

CMake Parameters

brest-amzn edited this page Oct 30, 2019 · 6 revisions

CMake Parameters

CMake is a build tool that can manage your application's dependencies and create native makefiles suitable for the platform you're building on. It's an easy way to create and build projects using the AVS Device SDK for C++.

You can use the CMake variables and options listed on this page to customize how your SDK builds.

Build types:

Build Options

Build types

The following CMake build types are supported:

  • Debug - Enables logging. Shows debug logs with -g compiler flag.
  • Release - Adds -O2 flag and removes -g flag.
  • MinSizeRel - Compiles with RELEASE flags and optimizations (-Os) for a smaller build size.

CMAKE_BUILD_TYPE

Specifies the build type. If no build type is specified, the default is Release.

Values

DEBUG | RELEASE | MINISIZEREL

Default

OFF

Example:

You can set options with the CMake GUI tools or the command line by using -D. In this example, the build type Debug is specified:

cmake <absolute-path-to-source> -DCMAKE_BUILD_TYPE=DEBUG

Specify log level

You can specify the debug log level by including a DEBUG<x> variable when you invoke the sample app. The allowed values are DEBUG0, DEBUG1, ... DEBUG9, where DEBUG9 provides the most information.

For example:

./SampleApp/src/SampleApp ./Integration/AlexaClientSDKConfig.json DEBUG9

Log sensitive data

ACSDK_EMIT_SENSITIVE_LOGS

Enables potentially sensitive data logging in Debug builds.

Values

OFF | ON

Default

OFF

Example:

-DACSDK_EMIT_SENSITIVE_LOGS=ON

IMPORTANT: If you want to post logs generated with this setting to a public forum, be sure to review them and redact any data you consider sensitive before doing so.

Bluetooth

Currently, Bluetooth is only available for Linux and Raspberry Pi. There are dependencies required in order to build with Bluetooth.

BLUETOOTH_BLUEZ

Enables Bluetooth, based on BlueZ.

Values

OFF | ON

Default

ON

Example:

-DBLUETOOTH_BLUEZ=ON

BLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS

Automates loading and unloading of PulseAudio Bluetooth modules. To use this option you must install libpulse-dev. See Bluetooth dependencies for more information.

IMPORTANT By enabling this option, the AVS Device SDK for C++ will make modifications to the PulseAudio application.

Values

OFF | ON

Default

OFF

Example:

-DBLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS=ON

MediaPlayer

MediaPlayer is a reference implementation of the GStreamerMediaPlayerInterface.

GSTREAMER_MEDIA_PLAYER

Values

OFF | ON

Default

OFF

Example:

-DGSTREAMER_MEDIA_PLAYER=ON

If GStreamer was installed from source, you must specify the prefix path:

-DCMAKE_PREFIX_PATH==<absolute-path-to-GStreamer-build>

PortAudio

Required - PortAudio is a cross-platform audio input/output library that's required to build and run the sample app.

PORTAUDIO

Enables PortAudio.

Values

ON | OFF

Default

ON

PORTAUDIO_LIB_PATH

Specifies the path to the PortAudio library.

PORTAUDIO_INCLUDE_DIR

Specifies the path to the PortAudio directory.

Example:

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 detector

Note: Wake word detector (WWD) and key word detector (KWD) are used interchangeably.

The AVS Device SDK supports wake word detectors from Sensory and KITT.ai. The following options are required to build with a wake word detector.

Replace <wake-word-name> with SENSORY for Sensory, and KITTAI for KITT.ai.

_KEY_WORD_DETECTOR

Specifies if the WWD is enabled or disabled during build.

Values

OFF | ON

Default

OFF

Example:

Replace <wake-word-name> with SENSORY for Sensory, and KITTAI for KITT.ai.

-DSENSORY_KEY_WORD_DETECTOR=ON

_KEY_WORD_DETECTOR_LIB_PATH= The path to the wake word detector library.

_KEY_WORD_DETECTOR_INCLUDE_DIR= The path to the wake word detector include directory.

Sensory

If using the Sensory wake word detector, version 5.0.0-beta.10.2 or later is required.

This is an example CMake command to build with 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

Note that you may need to license the Sensory library for use prior to enabling it as a CMake options. A script to license the Sensory library can be found on the Sensory Github.

KITT.ai

A matrix calculation library, known as BLAS, is required to use KITT.ai. To install this library, run:

  • Generic Linux - apt-get install libatlas-base-dev
  • macOS - brew install homebrew/science/openblas

This is an example CMake command to build with KITT.ai:

cmake <absolute-path-to-source> -DKITTAI_KEY_WORD_DETECTOR=ON -DKITTAI_KEY_WORD_DETECTOR_LIB_PATH=<absolute-path>/snowboy-1.2.0/lib/libsnowboy-detect.a -DKITTAI_KEY_WORD_DETECTOR_INCLUDE_DIR=<absolute-path>/snowboy-1.2.0/include

Additional options

You can build the SDK with the following options. To enable these features, you can include these variables in your CMake build:

Feature Variable Description
Alexa for Business (A4B) -DA4B=ON By default, this option is OFF. Turning this option ON will enable A4B, including support for handling RevokeAuthorization directives.
Opus -DOPUS=ON Opus is an interactive audio codec that is supported by v1.11 or greater of the SDK. In order to enable Opus, this flag must be on, and you must have libopus installed. For information about Opus, see http://opus-codec.org/
SAMPLE-AES decryption -DENABLE_SAMPLE_AES=ON -DFFMPEG_INCLUDE_DIR=<absolute-path-to-ffmpeg-include-dir> -DFFMPEG_LIB_PATH=<absolute-path-to-ffmpeg-lib> Note: 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.

Android CMake variables and options

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

The following ANDROID_* variables are only relevant if the ANDROID variable is ON (-DANDROID=ON).

ANDROID - Enables the android build.

Values

OFF | ON

Default

OFF

ANDROID_LOGGER - Publishes logs using the Android logging facility.

Values

OFF | ON

Default

ON

ANDROID_MICROPHONE - Uses the Android microphone implementation, based on the Native Development Kit (NDK).

Values

OFF | ON

Default

ON

ANDROID_MEDIA_PLAYER - Uses the Android media player implementation, based on the NDK and FFmpeg.

Values

OFF | ON

Default

ON

ANDROID_DEVICE_INSTALL_PREFIX - The SDK installation path on the Android device or emulator.

Clone this wiki locally