Allow using the system version of flite and the HTS engine
By default, if the system version exists and can be used, then it will be used. Otherwise, the local version will be used Original patch by Saikrishna Arcot via https://gitorious.org/fg/flightgear/merge_requests/1582 slightly modified
This commit is contained in:
parent
4d4e1a2371
commit
6ee2fcdd9e
6 changed files with 308 additions and 61 deletions
13
3rdparty/CMakeLists.txt
vendored
13
3rdparty/CMakeLists.txt
vendored
|
@ -11,6 +11,17 @@ add_subdirectory(mongoose)
|
||||||
add_subdirectory(cjson)
|
add_subdirectory(cjson)
|
||||||
|
|
||||||
if (ENABLE_FLITE)
|
if (ENABLE_FLITE)
|
||||||
add_subdirectory(hts_engine_API)
|
|
||||||
add_subdirectory(flite_hts_engine)
|
add_subdirectory(flite_hts_engine)
|
||||||
|
|
||||||
|
if (SYSTEM_HTS_ENGINE)
|
||||||
|
set(HTS_Engine_FIND_REQUIRED TRUE)
|
||||||
|
find_package(HtsEngine)
|
||||||
|
|
||||||
|
include_directories(${HTS_ENGINE_INCLUDE_DIR})
|
||||||
|
message(STATUS "Using HTS engine includes at: ${HTS_ENGINE_INCLUDE_DIR}")
|
||||||
|
message(STATUS "Using HTS engine libraries: ${HTS_ENGINE_LIBRARIES}")
|
||||||
|
else()
|
||||||
|
add_subdirectory(hts_engine_API)
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include )
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
27
3rdparty/flite_hts_engine/CMakeLists.txt
vendored
27
3rdparty/flite_hts_engine/CMakeLists.txt
vendored
|
@ -1,6 +1,11 @@
|
||||||
|
if (SYSTEM_FLITE)
|
||||||
|
set(Flite_FIND_REQUIRED TRUE)
|
||||||
|
find_package(Flite)
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include)
|
include_directories(${FLITE_INCLUDE_DIR})
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include)
|
message(STATUS "Using Flite includes at: ${FLITE_INCLUDE_DIR}")
|
||||||
|
message(STATUS "Using Flite libraries: ${FLITE_LIBRARIES}")
|
||||||
|
else()
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/include)
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/include)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/cmulex)
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/cmulex)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/usenglish)
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/usenglish)
|
||||||
|
@ -59,6 +64,20 @@ set(FLITE_LANG_SOURCES
|
||||||
flite/lang/usenglish/us_text.c
|
flite/lang/usenglish/us_text.c
|
||||||
flite/lang/usenglish/usenglish.c
|
flite/lang/usenglish/usenglish.c
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SYSTEM_HTS_ENGINE)
|
||||||
|
set(HTS_Engine_FIND_REQUIRED TRUE)
|
||||||
|
find_package(HtsEngine)
|
||||||
|
|
||||||
|
include_directories(${HTS_ENGINE_INCLUDE_DIR})
|
||||||
|
message(STATUS "Using HTS engine includes for Flite/HTS Engine at: ${HTS_ENGINE_INCLUDE_DIR}")
|
||||||
|
else()
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include)
|
||||||
|
|
||||||
add_definitions(-DFLITE_PLUS_HTS_ENGINE)
|
add_definitions(-DFLITE_PLUS_HTS_ENGINE)
|
||||||
|
|
||||||
|
@ -68,3 +87,7 @@ add_library(flite_hts STATIC
|
||||||
lib/flite_hts_engine.c
|
lib/flite_hts_engine.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (SYSTEM_FLITE)
|
||||||
|
target_link_libraries(flite_hts ${FLITE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,16 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
if(GSM_FOUND)
|
if(GSM_FOUND)
|
||||||
set(SYSTEM_GSM_DEFAULT 1)
|
set(SYSTEM_GSM_DEFAULT 1)
|
||||||
endif(GSM_FOUND)
|
endif(GSM_FOUND)
|
||||||
|
|
||||||
|
find_package(Flite)
|
||||||
|
if(FLITE_FOUND)
|
||||||
|
set(SYSTEM_FLITE_DEFAULT 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(HtsEngine)
|
||||||
|
if(FLITE_FOUND)
|
||||||
|
set(SYSTEM_HTS_ENGINE_DEFAULT 1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
|
@ -143,6 +153,8 @@ option(ENABLE_IAX "Set to ON to build FlightGear with IAXClient/fgcom bui
|
||||||
option(USE_DBUS "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT})
|
option(USE_DBUS "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT})
|
||||||
option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex and speexdsp library" ${SYSTEM_SPEEX_DEFAULT})
|
option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex and speexdsp library" ${SYSTEM_SPEEX_DEFAULT})
|
||||||
option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT})
|
option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT})
|
||||||
|
option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT})
|
||||||
|
option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT})
|
||||||
|
|
||||||
# additional utilities
|
# additional utilities
|
||||||
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
||||||
|
|
119
CMakeModules/FindFlite.cmake
Normal file
119
CMakeModules/FindFlite.cmake
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
# - Try to find Flite
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# FLITE_FOUND - system has Flite
|
||||||
|
# FLITE_INCLUDE_DIRS - the Flite include directory
|
||||||
|
# FLITE_LIBRARIES - Link these to use Flite
|
||||||
|
# FLITE_DEFINITIONS - Compiler switches required for using Flite
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Saikrishna Arcot <saiarcot895@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
if (FLITE_LIBRARIES AND FLITE_INCLUDE_DIRS)
|
||||||
|
# in cache already
|
||||||
|
set(FLITE_FOUND TRUE)
|
||||||
|
else (FLITE_LIBRARIES AND FLITE_INCLUDE_DIRS)
|
||||||
|
#set(FLITE_DEFINITIONS ${_FliteCflags})
|
||||||
|
set(FLITE_DEFINITIONS "")
|
||||||
|
|
||||||
|
find_path(FLITE_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
flite.h
|
||||||
|
PATHS
|
||||||
|
${_FliteIncDir}
|
||||||
|
/usr/include
|
||||||
|
/usr/include/flite
|
||||||
|
/usr/local/include
|
||||||
|
/usr/local/include/flite
|
||||||
|
/opt/local/include
|
||||||
|
/opt/local/include/flite
|
||||||
|
/sw/include
|
||||||
|
/sw/include/flite
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FLITE_LIBRARY
|
||||||
|
NAMES
|
||||||
|
flite
|
||||||
|
Flite
|
||||||
|
PATHS
|
||||||
|
${_FliteLinkDir}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FLITE_CMU_US_KAL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
flite_cmu_us_kal
|
||||||
|
PATHS
|
||||||
|
${_FliteLinkDir}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FLITE_CMULEX_LIBRARY
|
||||||
|
NAMES
|
||||||
|
flite_cmulex
|
||||||
|
PATHS
|
||||||
|
${_FliteLinkDir}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FLITE_USENGLISH_LIBRARY
|
||||||
|
NAMES
|
||||||
|
flite_usenglish
|
||||||
|
PATHS
|
||||||
|
${_FliteLinkDir}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (FLITE_LIBRARY AND FLITE_CMU_US_KAL_LIBRARY AND FLITE_CMULEX_LIBRARY AND FLITE_USENGLISH_LIBRARY)
|
||||||
|
set(FLITE_FOUND TRUE)
|
||||||
|
endif (FLITE_LIBRARY AND FLITE_CMU_US_KAL_LIBRARY AND FLITE_CMULEX_LIBRARY AND FLITE_USENGLISH_LIBRARY)
|
||||||
|
|
||||||
|
set(FLITE_INCLUDE_DIRS
|
||||||
|
${FLITE_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (FLITE_FOUND)
|
||||||
|
set(FLITE_LIBRARIES
|
||||||
|
${FLITE_LIBRARIES}
|
||||||
|
${FLITE_LIBRARY}
|
||||||
|
${FLITE_CMU_US_KAL_LIBRARY}
|
||||||
|
${FLITE_CMULEX_LIBRARY}
|
||||||
|
${FLITE_USENGLISH_LIBRARY}
|
||||||
|
)
|
||||||
|
endif (FLITE_FOUND)
|
||||||
|
|
||||||
|
if (FLITE_INCLUDE_DIRS AND FLITE_LIBRARIES)
|
||||||
|
set(FLITE_FOUND TRUE)
|
||||||
|
endif (FLITE_INCLUDE_DIRS AND FLITE_LIBRARIES)
|
||||||
|
|
||||||
|
if (FLITE_FOUND)
|
||||||
|
if (NOT Flite_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found Flite and needed components: ${FLITE_LIBRARIES}")
|
||||||
|
endif (NOT Flite_FIND_QUIETLY)
|
||||||
|
else (FLITE_FOUND)
|
||||||
|
if (Flite_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find Flite or all components of Flite")
|
||||||
|
endif (Flite_FIND_REQUIRED)
|
||||||
|
endif (FLITE_FOUND)
|
||||||
|
|
||||||
|
# show the FLITE_INCLUDE_DIRS and FLITE_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(FLITE_INCLUDE_DIRS FLITE_LIBRARIES)
|
||||||
|
|
||||||
|
endif (FLITE_LIBRARIES AND FLITE_INCLUDE_DIRS)
|
78
CMakeModules/FindHtsEngine.cmake
Normal file
78
CMakeModules/FindHtsEngine.cmake
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# - Try to find HTS Engine
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# HTS_ENGINE_FOUND - system has HTS Engine
|
||||||
|
# HTS_ENGINE_INCLUDE_DIRS - the HTS Engine include directory
|
||||||
|
# HTS_ENGINE_LIBRARIES - Link these to use HTS Engine
|
||||||
|
# HTS_ENGINE_DEFINITIONS - Compiler switches required for using HTS Engine
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Saikrishna Arcot <saiarcot895@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
if (HTS_ENGINE_LIBRARIES AND HTS_ENGINE_INCLUDE_DIRS)
|
||||||
|
# in cache already
|
||||||
|
set(HTS_ENGINE_FOUND TRUE)
|
||||||
|
else (HTS_ENGINE_LIBRARIES AND HTS_ENGINE_INCLUDE_DIRS)
|
||||||
|
#set(HTS_ENGINE_DEFINITIONS ${_HTS_EngineCflags})
|
||||||
|
set(HTS_ENGINE_DEFINITIONS "")
|
||||||
|
|
||||||
|
find_path(HTS_ENGINE_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
HTS_engine.h
|
||||||
|
PATHS
|
||||||
|
${_HTS_EngineIncDir}
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(HTS_ENGINE_LIBRARY
|
||||||
|
NAMES
|
||||||
|
HTSEngine
|
||||||
|
PATHS
|
||||||
|
${_HTS_EngineLinkDir}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (HTS_ENGINE_LIBRARY)
|
||||||
|
set(HTS_ENGINE_FOUND TRUE)
|
||||||
|
endif (HTS_ENGINE_LIBRARY)
|
||||||
|
|
||||||
|
set(HTS_ENGINE_INCLUDE_DIRS
|
||||||
|
${HTS_ENGINE_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (HTS_ENGINE_FOUND)
|
||||||
|
set(HTS_ENGINE_LIBRARIES
|
||||||
|
${HTS_ENGINE_LIBRARIES}
|
||||||
|
${HTS_ENGINE_LIBRARY}
|
||||||
|
)
|
||||||
|
endif (HTS_ENGINE_FOUND)
|
||||||
|
|
||||||
|
if (HTS_ENGINE_INCLUDE_DIRS AND HTS_ENGINE_LIBRARIES)
|
||||||
|
set(HTS_ENGINE_FOUND TRUE)
|
||||||
|
endif (HTS_ENGINE_INCLUDE_DIRS AND HTS_ENGINE_LIBRARIES)
|
||||||
|
|
||||||
|
if (HTS_ENGINE_FOUND)
|
||||||
|
if (NOT HTS_Engine_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found HTS Engine: ${HTS_ENGINE_LIBRARIES}")
|
||||||
|
endif (NOT HTS_Engine_FIND_QUIETLY)
|
||||||
|
else (HTS_ENGINE_FOUND)
|
||||||
|
if (HTS_Engine_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find HTS Engine")
|
||||||
|
endif (HTS_Engine_FIND_REQUIRED)
|
||||||
|
endif (HTS_ENGINE_FOUND)
|
||||||
|
|
||||||
|
# show the HTS_ENGINE_INCLUDE_DIRS and HTS_ENGINE_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(HTS_ENGINE_INCLUDE_DIRS HTS_ENGINE_LIBRARIES)
|
||||||
|
|
||||||
|
endif (HTS_ENGINE_LIBRARIES AND HTS_ENGINE_INCLUDE_DIRS)
|
|
@ -145,8 +145,12 @@ target_link_libraries(fgfs
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_FLITE)
|
if(ENABLE_FLITE)
|
||||||
|
if(SYSTEM_HTS_ENGINE)
|
||||||
|
target_link_libraries(fgfs flite_hts ${HTS_ENGINE_LIBRARIES})
|
||||||
|
else()
|
||||||
target_link_libraries(fgfs flite_hts hts_engine)
|
target_link_libraries(fgfs flite_hts hts_engine)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
install(TARGETS fgfs BUNDLE DESTINATION .)
|
install(TARGETS fgfs BUNDLE DESTINATION .)
|
||||||
|
|
Loading…
Reference in a new issue