aports/testing/piper-tts/use-system-libs.patch

130 lines
3.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f96ec44..05a8a6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ add_executable(test_piper src/cpp/test.cpp src/cpp/piper.cpp)
# ---- fmt ---
-if(NOT DEFINED FMT_DIR)
+if(FALSE)
set(FMT_VERSION "10.0.0")
set(FMT_DIR "${CMAKE_CURRENT_BINARY_DIR}/fi")
@@ -43,7 +43,7 @@ endif()
# ---- spdlog ---
-if(NOT DEFINED SPDLOG_DIR)
+if(FALSE)
set(SPDLOG_DIR "${CMAKE_CURRENT_BINARY_DIR}/si")
set(SPDLOG_VERSION "1.12.0")
ExternalProject_Add(
@@ -58,7 +58,13 @@ endif()
# ---- piper-phonemize ---
-if(NOT DEFINED PIPER_PHONEMIZE_DIR)
+find_package(PkgConfig)
+pkg_check_modules(FMT REQUIRED fmt)
+pkg_check_modules(ONNXRUNTIME REQUIRED libonnxruntime)
+pkg_check_modules(PIPER_PHONEMIZE REQUIRED piper_phonemize)
+pkg_check_modules(SPDLOG REQUIRED spdlog)
+
+if(FALSE)
set(PIPER_PHONEMIZE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pi")
ExternalProject_Add(
piper_phonemize_external
@@ -74,9 +80,8 @@ endif()
if((NOT MSVC) AND (NOT APPLE))
# Linux flags
- string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wl,-rpath,'$ORIGIN'")
+ string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra")
string(APPEND CMAKE_C_FLAGS " -Wall -Wextra")
- target_link_libraries(piper -static-libgcc -static-libstdc++)
set(PIPER_EXTRA_LIBRARIES "pthread")
endif()
@@ -91,18 +96,18 @@ target_link_libraries(piper
)
target_link_directories(piper PUBLIC
- ${FMT_DIR}/lib
- ${SPDLOG_DIR}/lib
- ${PIPER_PHONEMIZE_DIR}/lib
+ ${FMT_LIBRARY_DIRS}
+ ${SPDLOG_LIBRARY_DIRS}
+ ${ONNXRUNTIME_LIBRARY_DIRS}
)
target_include_directories(piper PUBLIC
- ${FMT_DIR}/include
- ${SPDLOG_DIR}/include
- ${PIPER_PHONEMIZE_DIR}/include
+ ${FMT_INCLUDE_DIRS}
+ ${SPDLOG_INCLUDE_DIRS}
+ ${ONNXRUNTIME_INCLUDE_DIRS}
)
-target_compile_definitions(piper PUBLIC _PIPER_VERSION=${piper_version})
+target_compile_definitions(piper PUBLIC _PIPER_VERSION="${piper_version}")
# ---- Declare test ----
include(CTest)
@@ -116,16 +121,16 @@ target_compile_features(test_piper PUBLIC cxx_std_17)
target_include_directories(
test_piper PUBLIC
- ${FMT_DIR}/include
- ${SPDLOG_DIR}/include
- ${PIPER_PHONEMIZE_DIR}/include
+ ${FMT_INCLUDE_DIRS}
+ ${SPDLOG_INCLUDE_DIRS}
+ ${ONNXRUNTIME_INCLUDE_DIRS}
)
target_link_directories(
test_piper PUBLIC
- ${FMT_DIR}/lib
- ${SPDLOG_DIR}/lib
- ${PIPER_PHONEMIZE_DIR}/lib
+ ${FMT_LIBRARY_DIRS}
+ ${SPDLOG_LIBRARY_DIRS}
+ ${ONNXRUNTIME_LIBRARY_DIRS}
)
target_link_libraries(test_piper PUBLIC
@@ -141,32 +146,3 @@ target_link_libraries(test_piper PUBLIC
install(
TARGETS piper
DESTINATION ${CMAKE_INSTALL_PREFIX})
-
-# Dependencies
-install(
- DIRECTORY ${PIPER_PHONEMIZE_DIR}/bin/
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- USE_SOURCE_PERMISSIONS # keep +x
- FILES_MATCHING
- PATTERN "piper_phonemize"
- PATTERN "espeak-ng"
- PATTERN "*.dll"
-)
-
-install(
- DIRECTORY ${PIPER_PHONEMIZE_DIR}/lib/
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- FILES_MATCHING
- PATTERN "*.dll"
- PATTERN "*.so*"
-)
-
-install(
- DIRECTORY ${PIPER_PHONEMIZE_DIR}/share/espeak-ng-data
- DESTINATION ${CMAKE_INSTALL_PREFIX}
-)
-
-install(
- FILES ${PIPER_PHONEMIZE_DIR}/share/libtashkeel_model.ort
- DESTINATION ${CMAKE_INSTALL_PREFIX}
-)