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

Support building shared library of ucd #1

Merged
merged 8 commits into from
Nov 27, 2023
Merged
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
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@ project(espeak-ng
HOMEPAGE_URL "https://github.com/espeak-ng/espeak-ng"
)

option(BUILD_ESPEAK_NG_EXE "Whether to build espeak-ng-bin" ON)
option(BUILD_ESPEAK_NG_TESTS "Whether to build tests" ON)

include(CTest)

include(cmake/deps.cmake)
include(cmake/config.cmake)
add_subdirectory(src)
include(cmake/data.cmake)
if(BUILD_ESPEAK_NG_EXE)
include(cmake/data.cmake)
endif()
include(cmake/docs.cmake)

include(cmake/package.cmake)
include(CPack)

include(CTest)
add_subdirectory(tests)
if(BUILD_ESPEAK_NG_TESTS)
include(CTest)
add_subdirectory(tests)
endif()

option(BUILD_SHARED_LIBS "Build shared libraries" OFF)

Expand All @@ -33,4 +40,4 @@ message(STATUS " async: ${USE_ASYNC}")

install(
DIRECTORY vim/ftdetect vim/syntax DESTINATION share/vim/vimfiles
)
)
59 changes: 31 additions & 28 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,38 @@ add_library(espeak-include INTERFACE)
target_include_directories(espeak-include INTERFACE include include/compat)

add_subdirectory(ucd-tools)
add_subdirectory(speechPlayer)
if(USE_SPEECHPLAYER)
add_subdirectory(speechPlayer)
endif()
add_subdirectory(libespeak-ng)

add_executable(espeak-ng-bin espeak-ng.c)
set_target_properties(espeak-ng-bin PROPERTIES OUTPUT_NAME espeak-ng)
target_link_libraries(
espeak-ng-bin PRIVATE espeak-ng espeak-ng-config
)
if (MINGW)
target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static")
endif()
if (MSVC)
target_sources(espeak-ng-bin PRIVATE compat/getopt.c)
endif()
if (NOT WIN32)
add_custom_target(
speak-ng ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/speak-ng
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/espeak
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/speak
COMMENT "Link espeak-ng to compat names"
DEPENDS espeak-ng-bin
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
)
endif()
install(TARGETS espeak-ng-bin)
install(DIRECTORY include/espeak include/espeak-ng TYPE INCLUDE)
if (MINGW)
target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static")
endif()
if (MSVC)
target_sources(espeak-ng-bin PRIVATE compat/getopt.c)
endif()
if (NOT WIN32)
add_custom_target(
speak-ng ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/speak-ng
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/espeak
COMMAND ${CMAKE_COMMAND} -E create_symlink espeak-ng ${CMAKE_CURRENT_BINARY_DIR}/speak
COMMENT "Link espeak-ng to compat names"
DEPENDS espeak-ng-bin
)
endif()
install(TARGETS espeak-ng-bin)
install(DIRECTORY include/espeak include/espeak-ng TYPE INCLUDE)

if (ESPEAK_COMPAT AND NOT WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speak-ng DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/espeak DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speak DESTINATION bin)
endif()
if (ESPEAK_COMPAT AND NOT WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speak-ng DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/espeak DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/speak DESTINATION bin)
endif()
endif()
2 changes: 1 addition & 1 deletion src/include/compat/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define ENDIAN_H_COMPAT_SHIM
#pragma once

#if __has_include_next(<endian.h>)
#if __has_include_next(<endian.h>) && !defined(__APPLE__)
Copy link
Author

@csukuangfj csukuangfj Nov 27, 2023

Choose a reason for hiding this comment

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

Without !defined(__APPLE__) it causes errors for iOS.

# pragma GCC system_header // Silence "warning: #include_next is a GCC extension"
# include_next <endian.h>
#elif __has_include(<sys/endian.h>)
Expand Down
4 changes: 2 additions & 2 deletions src/include/compat/wctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#define iswspace ucd_isspace
#define iswupper ucd_isupper
#define iswxdigit ucd_isxdigit
#define tolower ucd_tolower
#define toupper udc_toupper
// #define tolower ucd_tolower
Copy link
Author

Choose a reason for hiding this comment

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

If I don't uncomment them, it causes errors in my code since I am using std::tolower and std::toupper in my code.

// #define toupper udc_toupper

#endif
1 change: 0 additions & 1 deletion src/include/espeak/speak_lib.h
Copy link
Author

Choose a reason for hiding this comment

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

This symlink causes errors on Windows when invoking make install since windows does not support symlinks.

This file was deleted.

Loading