Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion src/libespeak-ng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ add_library(espeak-ng
)

target_include_directories(espeak-ng BEFORE PRIVATE $<TARGET_PROPERTY:espeak-include,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(espeak-ng PRIVATE "-Wl,-rpath,${ESPEAK_NG_RPATH_ORIGIN}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit should fix
rhasspy/piper#286


if (NOT MSVC)
target_compile_options(espeak-ng PRIVATE
Expand Down Expand Up @@ -103,7 +104,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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line using PUBLIC causes errors when building for linux aarch64. I have spent half a day to figure it out.

https://github.com/rhasspy/espeak-ng/tree/master/src/include/compat
The above folder contains many header files that share the same name with the standard library headers. It is really bad to also include it in the header search path.

(It is even worse to name them using standard library header filenames.)

target_link_libraries(espeak-ng PRIVATE espeak-include)

if (MINGW)
target_link_options(espeak-ng PRIVATE "-static-libstdc++" "-static")
Expand Down
2 changes: 1 addition & 1 deletion src/libespeak-ng/numbers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions src/libespeak-ng/voices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down