From 39669a6fa9309a4a7ba9284327484aa7b812d564 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 28 Nov 2023 14:30:02 +0800 Subject: [PATCH 1/4] Fix compiler warnings --- cmake/deps.cmake | 2 +- src/libespeak-ng/numbers.c | 2 +- src/libespeak-ng/voices.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/deps.cmake b/cmake/deps.cmake index b63ced21ba..7cf5ac2365 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -15,7 +15,7 @@ if (MBROLA_BIN) endif(MBROLA_BIN) if (SONIC_LIB AND SONIC_INC) set(HAVE_LIBSONIC ON) -else() +elseif(USE_LIBSONIC) FetchContent_Declare(sonic-git GIT_REPOSITORY https://github.com/waywardgeek/sonic.git GIT_TAG fbf75c3d6d846bad3bb3d456cbc5d07d9fd8c104 diff --git a/src/libespeak-ng/numbers.c b/src/libespeak-ng/numbers.c index afcda48600..d78db19c5a 100644 --- a/src/libespeak-ng/numbers.c +++ b/src/libespeak-ng/numbers.c @@ -1682,7 +1682,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned if (prev_thousands == 0) { if ((decimal_point == 0) && (ordinal == 0)) { // Look for special pronunciation for this number in isolation (LANG=kl) - sprintf(string, "_%dn", value); + sprintf(string, "_%ldn", value); if (Lookup(tr, string, ph_out)) return 1; } diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index b507902ea4..d664be8f42 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -424,8 +424,10 @@ voice_t *LoadVoice(const char *vname, int control) char phonemes_name[40] = ""; const char *language_type; char buf[sizeof(path_home)+30]; +#if USE_MBROLA char name1[40]; char name2[80]; +#endif int pitch1; int pitch2; From 2b20e6b2c2aadc701fb7831c113aa9dbcb2dbc24 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 28 Nov 2023 17:26:35 +0800 Subject: [PATCH 2/4] Fix include paths --- src/libespeak-ng/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libespeak-ng/CMakeLists.txt b/src/libespeak-ng/CMakeLists.txt index aa0d97edc1..a219f4ca63 100644 --- a/src/libespeak-ng/CMakeLists.txt +++ b/src/libespeak-ng/CMakeLists.txt @@ -103,7 +103,7 @@ target_link_libraries(espeak-ng PRIVATE espeak-ng-config ucd) if (NOT MSVC) target_link_libraries(espeak-ng PRIVATE m) endif() -target_link_libraries(espeak-ng PUBLIC espeak-include) +target_link_libraries(espeak-ng PRIVATE espeak-include) if (MINGW) target_link_options(espeak-ng PRIVATE "-static-libstdc++" "-static") From c58d2a4a88e9a291ca448f046e15c6188cbd3b3a Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Tue, 28 Nov 2023 18:30:54 +0800 Subject: [PATCH 3/4] Fix building on windows --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d24ffb2f4..01ba56c5de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ add_subdirectory(libespeak-ng) if(BUILD_ESPEAK_NG_EXE) add_executable(espeak-ng-bin espeak-ng.c) target_link_libraries( - espeak-ng-bin PRIVATE espeak-ng espeak-ng-config + espeak-ng-bin PRIVATE espeak-ng espeak-ng-config espeak-include ) if (MINGW) target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static") From 7251208ee427ef87e94f39d0e99b15d287224ed6 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Wed, 29 Nov 2023 11:40:08 +0800 Subject: [PATCH 4/4] Add rpath --- CMakeLists.txt | 13 +++++++++++++ src/libespeak-ng/CMakeLists.txt | 1 + 2 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5fec3691d..0a51ba1112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,19 @@ project(espeak-ng HOMEPAGE_URL "https://github.com/espeak-ng/espeak-ng" ) +set(CMAKE_SKIP_BUILD_RPATH FALSE) +set(BUILD_RPATH_USE_ORIGIN TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +if(NOT APPLE) + set(ESPEAK_NG_RPATH_ORIGIN "$ORIGIN") +else() + set(ESPEAK_NG_RPATH_ORIGIN "@loader_path") +endif() + +set(CMAKE_INSTALL_RPATH ${ESPEAK_NG_RPATH_ORIGIN}) +set(CMAKE_BUILD_RPATH ${ESPEAK_NG_RPATH_ORIGIN}) + option(BUILD_ESPEAK_NG_EXE "Whether to build espeak-ng-bin" ON) option(BUILD_ESPEAK_NG_TESTS "Whether to build tests" ON) diff --git a/src/libespeak-ng/CMakeLists.txt b/src/libespeak-ng/CMakeLists.txt index a219f4ca63..0f4a6cc499 100644 --- a/src/libespeak-ng/CMakeLists.txt +++ b/src/libespeak-ng/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(espeak-ng ) target_include_directories(espeak-ng BEFORE PRIVATE $) +target_link_libraries(espeak-ng PRIVATE "-Wl,-rpath,${ESPEAK_NG_RPATH_ORIGIN}") if (NOT MSVC) target_compile_options(espeak-ng PRIVATE