Created
October 15, 2021 03:23
-
-
Save kkartaltepe/4b8eaf13aff3c13059a088d1ee09e249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b642123ac516c102c366c23260f13952c5f40df1 Mon Sep 17 00:00:00 2001 | |
From: Kurt Kartaltepe <kkartaltepe@gmail.com> | |
Date: Thu, 14 Oct 2021 20:21:36 -0700 | |
Subject: [PATCH] Add pkg-config for ntv2 library | |
This is a simple example of adding install targets and a pkg-config file | |
for the ntv2 library. | |
Signed-off-by: Kurt Kartaltepe <kkartaltepe@gmail.com> | |
--- | |
ajalibraries/ajantv2/CMakeLists.txt | 14 ++++++++++++++ | |
ajalibraries/ajantv2/ajantv2.pc.in | 14 ++++++++++++++ | |
2 files changed, 28 insertions(+) | |
create mode 100644 ajalibraries/ajantv2/ajantv2.pc.in | |
diff --git a/ajalibraries/ajantv2/CMakeLists.txt b/ajalibraries/ajantv2/CMakeLists.txt | |
index d3905b9..2dd7c9e 100644 | |
--- a/ajalibraries/ajantv2/CMakeLists.txt | |
+++ b/ajalibraries/ajantv2/CMakeLists.txt | |
@@ -458,6 +458,9 @@ set(AJANTV2_TARGET_SOURCES | |
add_library(ajantv2shared SHARED ${AJANTV2_TARGET_SOURCES}) | |
add_library(ajantv2 STATIC ${AJANTV2_TARGET_SOURCES}) | |
+set_target_properties(ajantv2shared PROPERTIES PUBLIC_HEADER "${AJANTV2_HEADERS}") | |
+set_target_properties(ajantv2 PROPERTIES PUBLIC_HEADER "${AJANTV2_HEADERS}") | |
+ | |
target_include_directories(ajantv2shared PUBLIC ${AJANTV2_TARGET_INCLUDE_DIRS}) | |
target_include_directories(ajantv2 PUBLIC ${AJANTV2_TARGET_INCLUDE_DIRS}) | |
@@ -466,3 +469,14 @@ target_link_libraries(ajantv2 PUBLIC ${EXTRA_LIBRARIES}) | |
target_compile_definitions(ajantv2shared PUBLIC ${EXTRA_DYNAMIC_DEFINES}) | |
target_compile_definitions(ajantv2 PUBLIC ${EXTRA_STATIC_DEFINES}) | |
+ | |
+install(TARGETS ajantv2shared ajantv2 | |
+ RUNTIME DESTINATION bin | |
+ LIBRARY DESTINATION lib | |
+ ARCHIVE DESTINATION lib | |
+ PUBLIC_HEADER DESTINATION include/ajantv2 | |
+) | |
+set(PKGCONF_EXTRA_LIBRARIES ${EXTRA_LIBRARIES}) | |
+list(TRANSFORM PKGCONF_EXTRA_LIBRARIES PREPEND "-l") | |
+configure_file("${PROJECT_SOURCE_DIR}/ajantv2.pc.in" "${PROJECT_BINARY_DIR}/ajantv2.pc" @ONLY) | |
+install(FILES "${PROJECT_BINARY_DIR}/ajantv2.pc" DESTINATION lib/pkgconfig) | |
diff --git a/ajalibraries/ajantv2/ajantv2.pc.in b/ajalibraries/ajantv2/ajantv2.pc.in | |
new file mode 100644 | |
index 0000000..b060b39 | |
--- /dev/null | |
+++ b/ajalibraries/ajantv2/ajantv2.pc.in | |
@@ -0,0 +1,14 @@ | |
+prefix="@CMAKE_INSTALL_PREFIX@" | |
+exec_prefix="${prefix}" | |
+libdir="${prefix}/lib" | |
+includedir="${prefix}/include/ajantv2" | |
+ | |
+Name: AJA ntv2 libraries | |
+Description: A library for using AJA ntv2 devices | |
+URL: https://github.com/aja-video/ntv2 | |
+Version: 0.0.0 | |
+Requires: @EXTRA_LIBRARIES@ | |
+Requires.private: @EXTRA_LIBRARIES@ | |
+Cflags: -I"${includedir}" | |
+Libs: -L"${libdir}" -lajantv2 | |
+Libs.private: -L"${libdir}" -lajantv2 @PKGCONF_EXTRA_LIBRARIES@ | |
-- | |
2.33.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment