avs-device-sdk/build/cmake/BuildOptions.cmake

73 lines
3.7 KiB
CMake
Raw Normal View History

#
# Setup the build type and compiler options.
#
# To set the build type, run the following command with a build type of DEBUG, RELEASE, or MINSIZEREL:
# cmake <path-to-source> -DCMAKE_BUILD_TYPE=<build-type>
#
# If no build type is specified by specifying it on the command line, default to debug.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: DEBUG, RELEASE, or MINSIZEREL." FORCE)
message("No build type specified, defaulting to Release.")
endif()
# Verify the build type is valid.
set(buildTypes DEBUG RELEASE MINSIZEREL)
string(TOUPPER "${CMAKE_BUILD_TYPE}" buildType)
list(FIND buildTypes "${buildType}" buildTypeFound)
if (buildTypeFound EQUAL -1)
string(LENGTH "${CMAKE_BUILD_TYPE}" buildTypeLen)
math(EXPR buildTypePadLen "72 - ${buildTypeLen}")
if (buildTypePadLen GREATER 0)
string(RANDOM LENGTH "${buildTypePadLen}" ALPHABET " " buildTypePad)
endif()
message("###############################################################################")
message("# #")
message("# ERROR: #")
message("# Unknown build type selected. Please select from DEBUG, RELEASE, or #")
message("# MINSIZEREL. #")
message("# #")
message("# Build Type: #")
message("# ${buildType}${buildTypePad}#")
message("# #")
message("###############################################################################")
message(FATAL_ERROR "Unknown build type ${buildType}. Please select from DEBUG, RELEASE, or MINSIZEREL. Quitting!")
else()
message("Creating the build directory for the ${PROJECT_NAME} with build type: ${buildType}")
endif()
# Set up the compiler flags.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Determine the platform and compiler dependent flags.
if (UNIX)
set(CXX_PLATFORM_DEPENDENT_FLAGS_DEBUG "-DDEBUG -DACSDK_DEBUG_LOG_ENABLED -Wall -Wsign-compare -g")
set(CXX_PLATFORM_DEPENDENT_FLAGS_RELEASE "-DNDEBUG -Wall -O2")
set(CXX_PLATFORM_DEPENDENT_FLAGS_MINSIZEREL "-DNDEBUG -Wall -Os")
elseif(MSVC)
set(CXX_PLATFORM_DEPENDENT_FLAGS_DEBUG "/DDEBUG i-DACSDK_DEBUG_LOG_ENABLED /W4 /Zi")
set(CXX_PLATFORM_DEPENDENT_FLAGS_RELEASE "/DNDEBUG /W4 /O2")
set(CXX_PLATFORM_DEPENDENT_FLAGS_MINSIZEREL "/DNDEBUG /W4 /O1")
endif()
# Debug build, default.
set(CMAKE_CXX_FLAGS_DEBUG "${CXX_PLATFORM_DEPENDENT_FLAGS_DEBUG} -DRAPIDJSON_HAS_STDSTRING" CACHE INTERNAL "Flags used for DEBUG builds" FORCE)
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} CACHE INTERNAL "Flags used for DEBUG builds" FORCE)
# Release build.
set(CMAKE_CXX_FLAGS_RELEASE "${CXX_PLATFORM_DEPENDENT_FLAGS_RELEASE} -DRAPIDJSON_HAS_STDSTRING" CACHE INTERNAL "Flags used for RELEASE builds" FORCE)
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} CACHE INTERNAL "Flags used for RELEASE builds" FORCE)
# Minimum sized release build.
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CXX_PLATFORM_DEPENDENT_FLAGS_MINSIZEREL} -DRAPIDJSON_HAS_STDSTRING" CACHE INTERNAL "Flags used for minimum sized RELEASE builds" FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_RELEASE} CACHE INTERNAL "Flags used for minimum sized RELEASE builds" FORCE)
Version 1.1.0 alexa-client-sdk - Changes in this update: - Better GStreamer error reporting. MediaPlayer used to only report `MEDIA_ERROR_UNKNOWN`, now reports more specific errors as defined in `ErrorType.h`. - Codebase has been formatted for easier reading. - `DirectiveRouter::removeDirectiveHandler()` signature changed and now returns a bool indicating if given handler should be successfully removed or not. - Cleanup of raw and shared pointers in the creation of `Transport` objects. - `HTTP2Stream`s now have IDs assigned as they are acquired as opposed to created, making associated logs easier to interpret. - `AlertsCapabilityAgent` has been refactored. - Alert management has been factored out into an `AlertScheduler` class. - Creation of Reminder (implements Alert) class. - Added new capability agent for `PlaybackController` with unit tests. - Added Settings interface with unit tests. - Return type of `getOffsetInMilliseconds()` changed from `int64_t` to `std::chronology::milliseconds`. - Added `AudioPlayer` unit tests. - Added teardown for all Integration tests except Alerts. - Implemented PlaylistParser. - Bug fixes: - AIP getting stuck in `LISTENING` or `THINKING` and refusing user input on network outage. - SampleApp crashing if running for 5 minutes after network disconnect. - Issue where on repeated user barge-ins, `AudioPlayer` would not pause. Specifically, the third attempt to “Play iHeartRadio” would not result in currently-playing music pausing. - Utterances being ignored after particularly long TTS. - GStreamer errors cropping up on SampleApp exit as a result of accessing the pipeline before it’s been setup. - Crashing when playing one URL after another. - Buffer overrun in Alerts Renderer. - [SampleApp crashing when issuing "Alexa skip" command with iHeartRadio.](https://github.com/alexa/avs-device-sdk/issues/153) - [`HTTP2Transport` network thread triggering a join on itself.](https://github.com/alexa/avs-device-sdk/issues/127) - [`HTTP2Stream` request handling truncating exception messages.](https://github.com/alexa/avs-device-sdk/issues/67) - [`AudioPlayer` was attempting an incorrect state transition from `STOPPED` to `PLAYING` through a `playbackResumed`.](https://github.com/alexa/avs-device-sdk/issues/138)
2017-10-02 22:59:05 +00:00
if (ACSDK_LATENCY_LOG)
add_definitions(-DACSDK_LATENCY_LOG_ENABLED)
endif()