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)
|
||||
|
||||
if (ENABLE_FLITE)
|
||||
add_subdirectory(hts_engine_API)
|
||||
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()
|
||||
|
|
141
3rdparty/flite_hts_engine/CMakeLists.txt
vendored
141
3rdparty/flite_hts_engine/CMakeLists.txt
vendored
|
@ -1,64 +1,83 @@
|
|||
if (SYSTEM_FLITE)
|
||||
set(Flite_FIND_REQUIRED TRUE)
|
||||
find_package(Flite)
|
||||
|
||||
include_directories(${FLITE_INCLUDE_DIR})
|
||||
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/lang/cmulex)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/usenglish)
|
||||
|
||||
set(FLITE_SOURCES
|
||||
flite/src/hrg/cst_ffeature.c
|
||||
flite/src/hrg/cst_item.c
|
||||
flite/src/hrg/cst_relation.c
|
||||
flite/src/hrg/cst_utterance.c
|
||||
|
||||
flite/src/lexicon/cst_lexicon.c
|
||||
flite/src/lexicon/cst_lts.c
|
||||
|
||||
flite/src/regex/cst_regex.c
|
||||
flite/src/regex/regexp.c
|
||||
|
||||
flite/src/stats/cst_cart.c
|
||||
|
||||
flite/src/synth/cst_ffeatures.c
|
||||
flite/src/synth/cst_phoneset.c
|
||||
flite/src/synth/cst_synth.c
|
||||
flite/src/synth/cst_utt_utils.c
|
||||
flite/src/synth/cst_voice.c
|
||||
flite/src/synth/flite.c
|
||||
|
||||
flite/src/utils/cst_alloc.c
|
||||
flite/src/utils/cst_error.c
|
||||
flite/src/utils/cst_features.c
|
||||
flite/src/utils/cst_string.c
|
||||
flite/src/utils/cst_tokenstream.c
|
||||
flite/src/utils/cst_val.c
|
||||
flite/src/utils/cst_val_const.c
|
||||
flite/src/utils/cst_val_user.c
|
||||
)
|
||||
|
||||
set(FLITE_LANG_SOURCES
|
||||
flite/lang/cmu_us_kal/cmu_us_kal.c
|
||||
|
||||
flite/lang/cmulex/cmu_lex.c
|
||||
flite/lang/cmulex/cmu_lex_data.c
|
||||
flite/lang/cmulex/cmu_lex_entries.c
|
||||
flite/lang/cmulex/cmu_lts_model.c
|
||||
flite/lang/cmulex/cmu_lts_rules.c
|
||||
flite/lang/cmulex/cmu_postlex.c
|
||||
|
||||
flite/lang/usenglish/us_aswd.c
|
||||
flite/lang/usenglish/us_expand.c
|
||||
flite/lang/usenglish/us_ffeatures.c
|
||||
flite/lang/usenglish/us_gpos.c
|
||||
flite/lang/usenglish/us_int_accent_cart.c
|
||||
flite/lang/usenglish/us_int_tone_cart.c
|
||||
flite/lang/usenglish/us_nums_cart.c
|
||||
flite/lang/usenglish/us_phoneset.c
|
||||
flite/lang/usenglish/us_phrasing_cart.c
|
||||
flite/lang/usenglish/us_pos_cart.c
|
||||
flite/lang/usenglish/us_text.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/hts_engine_API/include)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/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/usenglish)
|
||||
|
||||
set(FLITE_SOURCES
|
||||
flite/src/hrg/cst_ffeature.c
|
||||
flite/src/hrg/cst_item.c
|
||||
flite/src/hrg/cst_relation.c
|
||||
flite/src/hrg/cst_utterance.c
|
||||
|
||||
flite/src/lexicon/cst_lexicon.c
|
||||
flite/src/lexicon/cst_lts.c
|
||||
|
||||
flite/src/regex/cst_regex.c
|
||||
flite/src/regex/regexp.c
|
||||
|
||||
flite/src/stats/cst_cart.c
|
||||
|
||||
flite/src/synth/cst_ffeatures.c
|
||||
flite/src/synth/cst_phoneset.c
|
||||
flite/src/synth/cst_synth.c
|
||||
flite/src/synth/cst_utt_utils.c
|
||||
flite/src/synth/cst_voice.c
|
||||
flite/src/synth/flite.c
|
||||
|
||||
flite/src/utils/cst_alloc.c
|
||||
flite/src/utils/cst_error.c
|
||||
flite/src/utils/cst_features.c
|
||||
flite/src/utils/cst_string.c
|
||||
flite/src/utils/cst_tokenstream.c
|
||||
flite/src/utils/cst_val.c
|
||||
flite/src/utils/cst_val_const.c
|
||||
flite/src/utils/cst_val_user.c
|
||||
)
|
||||
|
||||
set(FLITE_LANG_SOURCES
|
||||
flite/lang/cmu_us_kal/cmu_us_kal.c
|
||||
|
||||
flite/lang/cmulex/cmu_lex.c
|
||||
flite/lang/cmulex/cmu_lex_data.c
|
||||
flite/lang/cmulex/cmu_lex_entries.c
|
||||
flite/lang/cmulex/cmu_lts_model.c
|
||||
flite/lang/cmulex/cmu_lts_rules.c
|
||||
flite/lang/cmulex/cmu_postlex.c
|
||||
|
||||
flite/lang/usenglish/us_aswd.c
|
||||
flite/lang/usenglish/us_expand.c
|
||||
flite/lang/usenglish/us_ffeatures.c
|
||||
flite/lang/usenglish/us_gpos.c
|
||||
flite/lang/usenglish/us_int_accent_cart.c
|
||||
flite/lang/usenglish/us_int_tone_cart.c
|
||||
flite/lang/usenglish/us_nums_cart.c
|
||||
flite/lang/usenglish/us_phoneset.c
|
||||
flite/lang/usenglish/us_phrasing_cart.c
|
||||
flite/lang/usenglish/us_pos_cart.c
|
||||
flite/lang/usenglish/us_text.c
|
||||
flite/lang/usenglish/usenglish.c
|
||||
)
|
||||
|
||||
add_definitions(-DFLITE_PLUS_HTS_ENGINE)
|
||||
|
||||
|
@ -68,3 +87,7 @@ add_library(flite_hts STATIC
|
|||
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)
|
||||
set(SYSTEM_GSM_DEFAULT 1)
|
||||
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()
|
||||
|
||||
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(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_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
|
||||
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,7 +145,11 @@ target_link_libraries(fgfs
|
|||
)
|
||||
|
||||
if(ENABLE_FLITE)
|
||||
target_link_libraries(fgfs flite_hts hts_engine)
|
||||
if(SYSTEM_HTS_ENGINE)
|
||||
target_link_libraries(fgfs flite_hts ${HTS_ENGINE_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(fgfs flite_hts hts_engine)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
|
|
Loading…
Reference in a new issue