[PATCH] Add back pkg-config

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

argilo at gmail.com argilo at gmail.com
Wed Nov 18 12:51:54 UTC 2020


From: Clayton Smith <argilo at gmail.com>

When gr-osmosdr was updated to GNU Radio 3.8, generation of
gnuradio-osmosdr.pc was removed. Other software uses pkg-config to find
gr-osmosdr, so I think we should add it back.

This fixes http://osmocom.org/issues/4423
---
 CMakeLists.txt         | 37 +++++++++++++++++++++++++++++++++++++
 gnuradio-osmosdr.pc.in | 15 +++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 gnuradio-osmosdr.pc.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c23cb49530..868057dcc8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,6 +275,43 @@ if(ENABLE_PYTHON)
 endif(ENABLE_PYTHON)
 add_subdirectory(docs)
 
+########################################################################
+# Create Pkg Config File
+########################################################################
+FOREACH(inc ${Boost_INCLUDE_DIRS})
+    LIST(APPEND GR_OSMOSDR_PC_CFLAGS "-I${inc}")
+ENDFOREACH(inc)
+
+FOREACH(lib ${Boost_LIBRARY_DIRS})
+    LIST(APPEND GR_OSMOSDR_PC_LIBS "-L${lib}")
+ENDFOREACH(lib)
+
+# use space-separation format for the pc file
+STRING(REPLACE ";" " " GR_OSMOSDR_PC_REQUIRES "${GR_OSMOSDR_PC_REQUIRES}")
+STRING(REPLACE ";" " " GR_OSMOSDR_PC_CFLAGS "${GR_OSMOSDR_PC_CFLAGS}")
+STRING(REPLACE ";" " " GR_OSMOSDR_PC_LIBS "${GR_OSMOSDR_PC_LIBS}")
+
+# unset these vars to avoid hard-coded paths to cross environment
+IF(CMAKE_CROSSCOMPILING)
+    UNSET(GR_OSMOSDR_PC_CFLAGS)
+    UNSET(GR_OSMOSDR_PC_LIBS)
+ENDIF(CMAKE_CROSSCOMPILING)
+
+# fake gnuradio cpack behavior as long as we don't use it directly
+set(CPACK_PACKAGE_NAME "gnuradio-osmosdr")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio block for various radio hardware")
+set(CPACK_PACKAGE_VERSION ${VERSION})
+
+CONFIGURE_FILE(
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-osmosdr.pc.in
+    ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
+ at ONLY)
+
+INSTALL(
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
+    DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+)
+
 ########################################################################
 # Print Summary
 ########################################################################
diff --git a/gnuradio-osmosdr.pc.in b/gnuradio-osmosdr.pc.in
new file mode 100644
index 0000000000..5f1ae694e3
--- /dev/null
+++ b/gnuradio-osmosdr.pc.in
@@ -0,0 +1,15 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@GR_LIBRARY_DIR@
+includedir=${prefix}/@GR_INCLUDE_DIR@
+
+Name: @CPACK_PACKAGE_NAME@
+Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
+URL: http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
+Version: @CPACK_PACKAGE_VERSION@
+Requires: gnuradio-runtime gnuradio-blocks
+Requires.private: @GR_OSMOSDR_PC_REQUIRES@
+Conflicts:
+Cflags: -I${includedir} @GR_OSMOSDR_PC_CFLAGS@
+Libs: -L${libdir} -lgnuradio-osmosdr
+Libs.private: @GR_OSMOSDR_PC_LIBS@
-- 
2.25.1




More information about the osmocom-sdr mailing list