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
This commit is contained in:
Steve Wills 2018-09-03 11:48:05 -04:00 committed by jp9000
parent 47285c2ba6
commit 2f51abf994
2 changed files with 19 additions and 0 deletions

View File

@ -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

11
libobs/libobs.pc.in Normal file
View File

@ -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@