summaryrefslogtreecommitdiff
path: root/gr-uhd
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2015-02-26 17:29:48 -0500
committerTom Rondeau <tom@trondeau.com>2015-02-26 17:29:48 -0500
commitb4ec7372c73bc140d08735d84a6f15b3355bc36f (patch)
tree3fb28dc5e1517ac01ce79446b33668f4fff20887 /gr-uhd
parent8ecfd13af0f55818d178fde17182de12b60ba4f1 (diff)
uhd: adding ability to build static library of gr-uhd.
Requires UHD v3.8.2; cmake checks for this and only builds if that version is met.
Diffstat (limited to 'gr-uhd')
-rw-r--r--gr-uhd/lib/CMakeLists.txt31
1 files changed, 31 insertions, 0 deletions
diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt
index e0a9db8cc2..b3ead137af 100644
--- a/gr-uhd/lib/CMakeLists.txt
+++ b/gr-uhd/lib/CMakeLists.txt
@@ -75,3 +75,34 @@ list(APPEND uhd_libs
add_library(gnuradio-uhd SHARED ${gr_uhd_sources})
target_link_libraries(gnuradio-uhd ${uhd_libs})
GR_LIBRARY_FOO(gnuradio-uhd RUNTIME_COMPONENT "uhd_runtime" DEVEL_COMPONENT "uhd_devel")
+
+########################################################################
+# Build static libraries if enabled
+########################################################################
+if(ENABLE_STATIC_LIBS)
+ if(UHD_VERSION VERSION_GREATER "3.8.1")
+ if(ENABLE_GR_CTRLPORT)
+ # Remove GR_CTRLPORT set this target's definitions.
+ # Makes sure we don't try to use ControlPort stuff in source files
+ GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
+ list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
+ SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
+
+ # readd it to the target since we removed it from the directory-wide list.
+ SET_PROPERTY(TARGET gnuradio-uhd APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
+ endif(ENABLE_GR_CTRLPORT)
+
+ add_library(gnuradio-uhd_static STATIC ${gr_uhd_sources})
+
+ if(NOT WIN32)
+ set_target_properties(gnuradio-uhd_static
+ PROPERTIES OUTPUT_NAME gnuradio-uhd)
+ endif(NOT WIN32)
+
+ install(TARGETS gnuradio-uhd_static
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "uhd_devel" # .lib file
+ )
+ else(UHD_VERSION VERSION_GREATER "3.8.1")
+ message(STATUS "Not building gr-uhd static library; requires UHD >= 3.8.2")
+ endif(UHD_VERSION VERSION_GREATER "3.8.1")
+endif(ENABLE_STATIC_LIBS)