From da435e3db6033e2bff2388e3d35ea48b029e9ebd Mon Sep 17 00:00:00 2001 From: Gavin John Date: Sat, 27 Jun 2026 16:00:57 -0400 Subject: [PATCH 1/2] feat: add pkg-config support --- cmake/Installation.cmake | 14 ++++++++++++++ lsl.pc.in | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 lsl.pc.in diff --git a/cmake/Installation.cmake b/cmake/Installation.cmake index 4114d29a..4ed7d6e6 100644 --- a/cmake/Installation.cmake +++ b/cmake/Installation.cmake @@ -83,6 +83,20 @@ install( DESTINATION ${LSL_CONFIG_INSTALL_DIR} ) +# Generate pkg-config file +if(LSL_UNIXFOLDERS AND NOT LSL_FRAMEWORK) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/lsl.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/lsl.pc + @ONLY + ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/lsl.pc + COMPONENT liblsl + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif() + if(APPLE AND LSL_FRAMEWORK AND NOT IOS) # Create symlinks for the framework. The variables we want to use to identify the symlink locations # are not available at install time. Instead, we create a script during configuration time that will diff --git a/lsl.pc.in b/lsl.pc.in new file mode 100644 index 00000000..49f90967 --- /dev/null +++ b/lsl.pc.in @@ -0,0 +1,9 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: liblsl +Description: @PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -llsl +Cflags: -I${includedir} From 491f4518a5966823f140f466cbb4f0847e4139a8 Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Sat, 19 Sep 2026 17:13:32 -0400 Subject: [PATCH 2/2] Use platform-aware framework default and pkg-config condition --- cmake/Installation.cmake | 2 +- cmake/ProjectOptions.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Installation.cmake b/cmake/Installation.cmake index 4ed7d6e6..19e57233 100644 --- a/cmake/Installation.cmake +++ b/cmake/Installation.cmake @@ -84,7 +84,7 @@ install( ) # Generate pkg-config file -if(LSL_UNIXFOLDERS AND NOT LSL_FRAMEWORK) +if(LSL_UNIXFOLDERS AND NOT (APPLE AND LSL_FRAMEWORK)) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lsl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lsl.pc diff --git a/cmake/ProjectOptions.cmake b/cmake/ProjectOptions.cmake index 35e6f8a0..edc41e92 100644 --- a/cmake/ProjectOptions.cmake +++ b/cmake/ProjectOptions.cmake @@ -6,7 +6,7 @@ string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "Debug" _LSL_DEBUGLOG_DEFAULT) option(LSL_DEBUGLOG "Enable (lots of) additional debug messages" ${_LSL_DEBUGLOG_DEFAULT}) option(LSL_UNIXFOLDERS "Use the unix folder layout for install targets" ON) option(LSL_BUILD_STATIC "Build LSL as a static library." OFF) -option(LSL_FRAMEWORK "Build LSL as an Apple Framework (Mac only)" ON) +option(LSL_FRAMEWORK "Build LSL as an Apple framework" ${APPLE}) option(LSL_LEGACY_CPP_ABI "Build legacy C++ ABI into lsl-static" OFF) option(LSL_OPTIMIZATIONS "Enable some more compiler optimizations" ON) option(LSL_BUNDLED_BOOST "Use the bundled Boost by default" ON)