Skip to content

Commit

Permalink
Merge pull request #1 from csukuangfj/fix-ucd-cmake
Browse files Browse the repository at this point in the history
Support building shared library of ucd
  • Loading branch information
synesthesiam authored Nov 27, 2023
2 parents 0f65aa3 + 70d9000 commit 8593723
Show file tree
Hide file tree
Showing 7 changed files with 764 additions and 49 deletions.
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__)
# 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
// #define toupper udc_toupper

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

This file was deleted.

Loading

0 comments on commit 8593723

Please sign in to comment.