From 2f51abf994bb1853f2704862410f67f79ac4f166 Mon Sep 17 00:00:00 2001 From: Steve Wills Date: Mon, 3 Sep 2018 11:48:05 -0400 Subject: [PATCH] libobs: Add pkgconfig support Based on: http://dailycommit.blogspot.com/2016/10/how-to-generate-pkg-config-file-with.html https://people.freedesktop.org/~dbn/pkg-config-guide.html Should allow third party plugins to find and use libobs more easily. Closes obsproject/obs-studio#1467 --- libobs/CMakeLists.txt | 8 ++++++++ libobs/libobs.pc.in | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 libobs/libobs.pc.in diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index 09f7cc08d..23ce82f5a 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -447,6 +447,14 @@ if(BUILD_CAPTIONS) endif() add_library(libobs SHARED ${libobs_SOURCES} ${libobs_HEADERS}) +if(UNIX AND NOT APPLE) + set(DEST_DIR "${CMAKE_INSTALL_PREFIX}") + foreach(LIB "obs" "rt") + set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}") + endforeach() + CONFIGURE_FILE("libobs.pc.in" "libobs.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libobs.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") +endif() set_target_properties(libobs PROPERTIES OUTPUT_NAME obs diff --git a/libobs/libobs.pc.in b/libobs/libobs.pc.in new file mode 100644 index 000000000..03fe4cdd0 --- /dev/null +++ b/libobs/libobs.pc.in @@ -0,0 +1,11 @@ +prefix=@DEST_DIR@ +exec_prefix=${prefix} +libdir=${prefix}/@OBS_LIBRARY_DESTINATION@ +includedir=${prefix}/include + +Name: libobs +Description: OBS Studio Library +Version: @OBS_VERSION@ +Requires: x11 +Cflags: -I${includedir} +Libs: -L${libdir} @PRIVATE_LIBS@ -- GitLab