From 8cdd0993d398f025faa8bcc96f295bc335d5076f Mon Sep 17 00:00:00 2001 From: David GUGLIELMI Date: Thu, 9 May 2024 14:17:58 +0200 Subject: [PATCH 1/2] Add build option BUILD_SHARED_LIBRARY --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45b91259..bf6d72ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,12 @@ file(GLOB AP4_HEADERS ${SOURCE_METADATA}/*.h ) -add_library(ap4 STATIC ${AP4_SOURCES}) +option(BUILD_SHARED_LIBRARY "Build as a shared library" OFF) +if(BUILD_SHARED_LIBRARY) + add_library(ap4 SHARED ${AP4_SOURCES}) +else() + add_library(ap4 STATIC ${AP4_SOURCES}) +endif() target_include_directories(ap4 PUBLIC ${AP4_INCLUDE_DIRS} ) From 84d2c72872b3ed82fc633074169ffdd6a8cfb34b Mon Sep 17 00:00:00 2001 From: David GUGLIELMI Date: Thu, 9 May 2024 14:26:18 +0200 Subject: [PATCH 2/2] Add pkg-config file --- Build/pkgconfig/bento4.pc.in | 9 +++++++++ CMakeLists.txt | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Build/pkgconfig/bento4.pc.in diff --git a/Build/pkgconfig/bento4.pc.in b/Build/pkgconfig/bento4.pc.in new file mode 100644 index 00000000..ffccf21b --- /dev/null +++ b/Build/pkgconfig/bento4.pc.in @@ -0,0 +1,9 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ + +Name: @PROJECT_NAME@ +Description: Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools +Version: @BENTO4_VERSION@ +Libs: -L${libdir} -lap4 +Cflags: -I${includedir}/bento4 diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6d72ec..61353512 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,12 @@ configure_package_config_file( INSTALL_DESTINATION "${config_install_dir}" ) +configure_file( + "Build/pkgconfig/bento4.pc.in" + "${generated_dir}/bento4.pc" + @ONLY +) + install( TARGETS ap4 ${BENTO4_APPS_LOWERCASE} EXPORT "${TARGETS_EXPORT_NAME}" @@ -143,6 +149,11 @@ install( DESTINATION "${config_install_dir}" ) +install( + FILES "${generated_dir}/bento4.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" +) + install( EXPORT "${TARGETS_EXPORT_NAME}" NAMESPACE "${namespace}"