From 6bfc5c8d6b3f65fb24a4cc8473bab41cc6fce1a9 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 27 Nov 2023 21:43:59 +0800 Subject: [PATCH] Fix for iOS --- CMakeLists.txt | 7 +++-- src/CMakeLists.txt | 52 +++++++++++++++++++------------------ src/include/compat/endian.h | 2 +- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 832f48bccd..c5fec3691d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,15 @@ 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) -if(NOT CMAKE_CROSSCOMPILING) +if(BUILD_ESPEAK_NG_EXE) include(cmake/data.cmake) endif() include(cmake/docs.cmake) @@ -19,7 +22,7 @@ include(cmake/docs.cmake) include(cmake/package.cmake) include(CPack) -if(NOT CMAKE_CROSSCOMPILING) +if(BUILD_ESPEAK_NG_TESTS) include(CTest) add_subdirectory(tests) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 48013384eb..c918cf17e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,31 +5,33 @@ add_subdirectory(ucd-tools) add_subdirectory(speechPlayer) add_subdirectory(libespeak-ng) -add_executable(espeak-ng-bin espeak-ng.c) -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) + 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() diff --git a/src/include/compat/endian.h b/src/include/compat/endian.h index c0e988e2f1..bef26509c2 100644 --- a/src/include/compat/endian.h +++ b/src/include/compat/endian.h @@ -20,7 +20,7 @@ #define ENDIAN_H_COMPAT_SHIM #pragma once -#if __has_include_next() +#if __has_include_next() && !defined(__APPLE__) # pragma GCC system_header // Silence "warning: #include_next is a GCC extension" # include_next #elif __has_include()