Browse Source

Windows: bunch of build fixes with CMake (#1585)

master
Alexander Epaneshnikov 2 years ago
parent
commit
35315502c4
No account linked to committer's email address
4 changed files with 18 additions and 1 deletions
  1. 3
    0
      src/CMakeLists.txt
  2. 10
    0
      src/libespeak-ng/CMakeLists.txt
  3. 4
    0
      tests/CMakeLists.txt
  4. 1
    1
      tests/api.c

+ 3
- 0
src/CMakeLists.txt View File

@@ -10,6 +10,9 @@ 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()

+ 10
- 0
src/libespeak-ng/CMakeLists.txt View File

@@ -102,4 +102,14 @@ if (NOT MSVC)
endif()
target_link_libraries(espeak-ng PUBLIC espeak-include)

if ((MINGW OR WIN32 OR MSVC) AND BUILD_SHARED_LIBS)
set_target_properties(espeak-ng PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ..
)
endif()

if (MINGW)
target_link_options(espeak-ng PRIVATE "-static-libstdc++" "-static")
endif()

install(TARGETS espeak-ng LIBRARY)

+ 4
- 0
tests/CMakeLists.txt View File

@@ -10,6 +10,7 @@ macro(compiled_test _test_name)
target_link_libraries(test_${_test_name} PRIVATE
$<TARGET_PROPERTY:espeak-ng,LINK_LIBRARIES>
)
target_compile_definitions(test_${_test_name} PRIVATE LIBESPEAK_NG_EXPORT=1)
target_include_directories(
test_${_test_name} PRIVATE
$<TARGET_PROPERTY:espeak-ng,SOURCE_DIR>
@@ -17,6 +18,9 @@ macro(compiled_test _test_name)
$<TARGET_PROPERTY:espeak-ng,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:espeak-ng-config,INTERFACE_INCLUDE_DIRECTORIES>
)
if (MINGW)
target_link_options(test_${_test_name} PUBLIC "-static" "-static-libstdc++")
endif()
add_dependencies(test_${_test_name} data)
add_test(
NAME ${_test_name}

+ 1
- 1
tests/api.c View File

@@ -630,7 +630,7 @@ main(int argc, char **argv)
(void)argc; // unused parameter

char *progdir = strdup(argv[0]);
char *dir = strrchr(progdir, '/');
char *dir = strrchr(progdir, PATHSEP);
if (dir != NULL) *dir = 0;

test_espeak_terminate_without_initialize();

Loading…
Cancel
Save