Skip to content
Snippets Groups Projects
Commit 011c695b authored by Stuart Mark James's avatar Stuart Mark James
Browse files

Reversed horrid formatting of tts_library/CMakeLists

parent 3d852b8c
No related branches found
No related tags found
No related merge requests found
#Start Build Config-- ---------------------------------
cmake_minimum_required(VERSION 3.0) message(STATUS "Configuring TTS Static Library")
#Need to make sure we have a good enough compiler for filesystem
#https: // stackoverflow.com/questions/33149878/experimentalfilesystem-linker-error
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) message(
FATAL_ERROR "Require at least gcc-5.3") endif()
project(tts_test) project(tts_static_library)
set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_COLOR_MAKEFILE ON)
#These inherit from the parent, clear them to be certain they are fresh
unset(INCLUDE_PATHS) unset(LIBRARIES) unset(LIBRARY_PATHS)
#Options
option(TTS_ENABLE_TRACING "Enable tracing on all function calls" OFF) option(
TTS_ENABLE_DEBUG "Enable debugging output" ON)
if (TTS_ENABLE_TRACING) message(STATUS
"Enabled function tracing for tts_library") endif(TTS_ENABLE_TRACING)
if (TTS_ENABLE_DEBUG) message(STATUS
"Enabled debug output for tts_library") endif(TTS_ENABLE_DEBUG)
#AWS Config-- ---------------------------------
#find the AWS SDK package files to setup the project
find_package(AWSSDK REQUIRED)
#Use the AWS macro to find the link aws - sdk libraries required
set(LIBRARY_REQUESTS polly) AWSSDK_DETERMINE_LIBS_TO_LINK(
LIBRARY_REQUESTS AWS_LIBRARIES) message(STATUS
"Using AWS SDK libraries: ${AWS_LIBRARIES}")
#add the aws include path
set(INCLUDE_PATHS ${INCLUDE_PATHS} ${AWSSDK_INCLUDE_DIR}) set(
LIBRARIES ${LIBRARIES} ${AWS_LIBRARIES}) set(LIBRARY_PATHS ${
LIBRARY_PATHS} ${AWS_LIBRARY_DIR})
#Pulse Audio-- ---------------------------------
find_package(PkgConfig REQUIRED) pkg_search_module(
PULSE_SIMPLE libpulse - simple REQUIRED)
set(INCLUDE_PATHS ${INCLUDE_PATHS} ${
PULSE_SIMPLE_INCLUDEDIR}) set(LIBRARIES ${LIBRARIES} ${
PULSE_SIMPLE_LIBRARIES}) set(LIBRARY_PATHS ${
LIBRARY_PATHS} ${PULSE_SIMPLE_LIBRARY_DIR})
#Other-- ---------------------------------
set(LIBRARIES $ { LIBRARIES } "pthread")
#Enforce Libraries-- ---------------------------------
unset(FOUND_LIBS)
foreach (LIB ${LIBRARIES})
#try the user provided paths first
find_library(FOUND_LIB_${LIB} ${
LIB} PATHS ${LIBRARY_PATHS} NO_DEFAULT_PATH)
#if we could not find it, drop to the system paths
if (NOT FOUND_LIB_${LIB}) find_library(
FOUND_LIB_${LIB} ${LIB}) endif()
list(APPEND FOUND_LIBS ${
FOUND_LIB_${LIB}})
if (FOUND_LIB_${LIB}) message(
STATUS "Found " $ {
LIB
} " at: " ${FOUND_LIB_${
LIB}}) else() message(FATAL
"Could not find " ${
LIB}) endif() endforeach(LIB)
#Finally our source
set(POLLY_TTS_SRC ${CMAKE_CURRENT_SOURCE_DIR} /
FileTTSCache.cpp ${
CMAKE_CURRENT_SOURCE_DIR} /
PulseAudioSink.cpp ${
CMAKE_CURRENT_SOURCE_DIR} /
JingleMgr.cpp ${CMAKE_CURRENT_SOURCE_DIR} /
TTSDataTypes.cpp ${
CMAKE_CURRENT_SOURCE_DIR} /
TTSRunner.cpp ${CMAKE_CURRENT_SOURCE_DIR} /
PollyTTSDriver.cpp)
#Build Targets-- ---------------------------------
#Target is a static library that can be shared with the other binaries
add_library(tts_static_library STATIC ${
POLLY_TTS_SRC}) target_compile_options(tts_static_library PUBLIC -
std = c++ 14 -
Wall - Wextra)
target_link_libraries(
tts_static_library PUBLIC ${
FOUND_LIBS} -
lstdc++ fs)
if (TTS_ENABLE_TRACING) target_compile_definitions(
tts_static_library PRIVATE -
DTRACE_ENABLED) endif(TTS_ENABLE_TRACING)
if (TTS_ENABLE_DEBUG) target_compile_definitions(
tts_static_library PRIVATE -
DDEBUG_ENABLED) endif(TTS_ENABLE_DEBUG)
target_include_directories(
tts_static_library PUBLIC ${
INCLUDE_PATHS} PUBLIC ${
CMAKE_CURRENT_LIST_DIR} PRIVATE
"${PROJECT_BINARY_DIR}")
# Start Build Config -----------------------------------
cmake_minimum_required(VERSION 3.0)
message(STATUS "Configuring TTS Static Library")
# Need to make sure we have a good enough compiler for filesystem
# https://stackoverflow.com/questions/33149878/experimentalfilesystem-linker-error
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3)
message(FATAL_ERROR "Require at least gcc-5.3")
endif()
project(tts_test)
project(tts_static_library)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
# These inherit from the parent, clear them to be certain they are fresh
unset(INCLUDE_PATHS)
unset(LIBRARIES)
unset(LIBRARY_PATHS)
# Options
option(TTS_ENABLE_TRACING "Enable tracing on all function calls" OFF)
option(TTS_ENABLE_DEBUG "Enable debugging output" ON)
if(TTS_ENABLE_TRACING)
message(STATUS "Enabled function tracing for tts_library")
endif(TTS_ENABLE_TRACING)
if(TTS_ENABLE_DEBUG)
message(STATUS "Enabled debug output for tts_library")
endif(TTS_ENABLE_DEBUG)
# AWS Config -----------------------------------
# find the AWS SDK package files to setup the project
find_package(AWSSDK REQUIRED)
# Use the AWS macro to find the link aws-sdk libraries required
set(LIBRARY_REQUESTS polly)
AWSSDK_DETERMINE_LIBS_TO_LINK(LIBRARY_REQUESTS AWS_LIBRARIES)
message(STATUS "Using AWS SDK libraries: ${AWS_LIBRARIES}")
# add the aws include path
set(INCLUDE_PATHS ${INCLUDE_PATHS} ${AWSSDK_INCLUDE_DIR})
set(LIBRARIES ${LIBRARIES} ${AWS_LIBRARIES})
set(LIBRARY_PATHS ${LIBRARY_PATHS} ${AWS_LIBRARY_DIR})
# Pulse Audio -----------------------------------
find_package(PkgConfig REQUIRED)
pkg_search_module(PULSE_SIMPLE libpulse-simple REQUIRED)
set(INCLUDE_PATHS ${INCLUDE_PATHS} ${PULSE_SIMPLE_INCLUDEDIR})
set(LIBRARIES ${LIBRARIES} ${PULSE_SIMPLE_LIBRARIES})
set(LIBRARY_PATHS ${LIBRARY_PATHS} ${PULSE_SIMPLE_LIBRARY_DIR})
# Other -----------------------------------
set(LIBRARIES ${LIBRARIES} "pthread")
# Enforce Libraries -----------------------------------
unset(FOUND_LIBS)
foreach(LIB ${LIBRARIES})
# try the user provided paths first
find_library(FOUND_LIB_${LIB} ${LIB} PATHS ${LIBRARY_PATHS} NO_DEFAULT_PATH)
# if we could not find it, drop to the system paths
if (NOT FOUND_LIB_${LIB})
find_library(FOUND_LIB_${LIB} ${LIB})
endif()
list(APPEND FOUND_LIBS ${FOUND_LIB_${LIB}})
if (FOUND_LIB_${LIB})
message(STATUS "Found " ${LIB} " at: " ${FOUND_LIB_${LIB}})
else()
message(FATAL "Could not find " ${LIB})
endif()
endforeach(LIB)
# Finally our source
set(POLLY_TTS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/FileTTSCache.cpp
${CMAKE_CURRENT_SOURCE_DIR}/PulseAudioSink.cpp
${CMAKE_CURRENT_SOURCE_DIR}/JingleMgr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TTSDataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TTSRunner.cpp
${CMAKE_CURRENT_SOURCE_DIR}/PollyTTSDriver.cpp)
# Build Targets -----------------------------------
# Target is a static library that can be shared with the other binaries
add_library(tts_static_library STATIC ${POLLY_TTS_SRC})
target_compile_options(tts_static_library PUBLIC -std=c++14 -Wall -Wextra)
target_link_libraries(tts_static_library PUBLIC ${FOUND_LIBS} -lstdc++fs)
if(TTS_ENABLE_TRACING)
target_compile_definitions(tts_static_library PRIVATE -DTRACE_ENABLED)
endif(TTS_ENABLE_TRACING)
if(TTS_ENABLE_DEBUG)
target_compile_definitions(tts_static_library PRIVATE -DDEBUG_ENABLED)
endif(TTS_ENABLE_DEBUG)
target_include_directories(tts_static_library
PUBLIC ${INCLUDE_PATHS}
PUBLIC ${CMAKE_CURRENT_LIST_DIR}
PRIVATE "${PROJECT_BINARY_DIR}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment