aports/testing/piper-phonemize/add-pkgconfig-support.patch
2023-11-26 19:19:47 +00:00

50 lines
1.4 KiB
Diff

commit 6f9df58efef9fd8262e37c717d25f37839f4cdc0
Author: Shaun Ren <shaun.ren@linux.com>
Date: Fri Sep 29 22:56:36 2023 -0400
Add piper_phonemize.pc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7b30a6..b7fd68c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,6 +166,9 @@ endif()
target_compile_features(piper_phonemize PUBLIC cxx_std_17)
+set(pc_requires_private "espeak-ng libonnxruntime")
+configure_file(piper_phonemize.pc.in piper_phonemize.pc @ONLY)
+
# ---- Declare executable ----
add_executable(piper_phonemize_exe src/main.cpp src/phoneme_ids.cpp)
@@ -249,6 +252,10 @@ install(
PATTERN "*.h"
PATTERN "*.hpp")
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/piper_phonemize.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
install(
TARGETS piper_phonemize_exe
ARCHIVE DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/piper_phonemize.pc.in b/piper_phonemize.pc.in
new file mode 100644
index 0000000..57d32db
--- /dev/null
+++ b/piper_phonemize.pc.in
@@ -0,0 +1,13 @@
+prefix="@CMAKE_INSTALL_PREFIX@"
+exec_prefix="${prefix}"
+libdir="${prefix}/@CMAKE_INSTALL_LIBDIR@"
+includedir="${prefix}/include"
+
+Name: @PROJECT_NAME@
+Description: @CMAKE_PROJECT_DESCRIPTION@
+URL: @CMAKE_PROJECT_HOMEPAGE_URL@
+Version: @PROJECT_VERSION@
+
+Requires.private: @pc_requires_private@
+Cflags: -I"${includedir}"
+Libs: -L"${libdir}" -l@PROJECT_NAME@