aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r--lib/CMakeLists.txt193
1 files changed, 94 insertions, 99 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 1bb8655..d95109b 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,32 +1,41 @@
# Copyright 2011 Free Software Foundation, Inc.
#
-# This file is part of gr-osmosdr
+# This file is part of GNU Radio
#
-# gr-osmosdr is free software; you can redistribute it and/or modify
+# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
-# gr-osmosdr is distributed in the hope that it will be useful,
+# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with gr-osmosdr; see the file COPYING. If not, write to
+# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Setup library
########################################################################
-include(GrPlatform) #define LIB_SUFFIX
+INCLUDE(GrPlatform) #define LIB_SUFFIX
+INCLUDE(GrMiscUtils)
+INCLUDE(GrComponent)
########################################################################
-# Setup target
+# Helpful Macros
########################################################################
+MACRO(GR_OSMOSDR_APPEND_SRCS)
+ LIST(APPEND gr_osmosdr_srcs ${ARGV})
+ENDMACRO(GR_OSMOSDR_APPEND_SRCS)
-list(APPEND gr_osmosdr_srcs
+MACRO(GR_OSMOSDR_APPEND_LIBS)
+ LIST(APPEND gr_osmosdr_libs ${ARGV})
+ENDMACRO(GR_OSMOSDR_APPEND_LIBS)
+
+GR_OSMOSDR_APPEND_SRCS(
source_impl.cc
sink_impl.cc
ranges.cc
@@ -34,44 +43,28 @@ list(APPEND gr_osmosdr_srcs
time_spec.cc
)
+set(CMAKE_CXX_STANDARD 11)
+
#-pthread Adds support for multithreading with the pthreads library.
#This option sets flags for both the preprocessor and linker. (man gcc)
if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND Boost_LIBRARIES -pthread)
endif()
-#dirty macro to allow appending from subdirs
-#this appends all unnamed implicit macro args!
-MACRO (APPEND_LIB_LIST)
- SET (gr_osmosdr_libs "${gr_osmosdr_libs};${ARGN}" CACHE INTERNAL "lib list")
-ENDMACRO (APPEND_INTERNAL_LIST)
-
-set(gr_osmosdr_libs "" CACHE INTERNAL "lib that accumulates link targets")
-
-add_library(gnuradio-osmosdr SHARED)
-APPEND_LIB_LIST(${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
-target_include_directories(gnuradio-osmosdr
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
- PUBLIC ${Boost_INCLUDE_DIRS}
- PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
- PUBLIC $<INSTALL_INTERFACE:include>
- )
-set_target_properties(gnuradio-osmosdr PROPERTIES DEFINE_SYMBOL "gnuradio_osmosdr_EXPORTS")
-
-if(APPLE)
- set_target_properties(gnuradio-osmosdr PROPERTIES
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
- )
-endif(APPLE)
+GR_OSMOSDR_APPEND_LIBS(
+ ${Boost_LIBRARIES}
+ gnuradio::gnuradio-blocks
+ ${GNURADIO_ALL_LIBRARIES}
+)
########################################################################
# Setup defines for high resolution timing
########################################################################
-message(STATUS "")
-message(STATUS "Configuring high resolution timing...")
-include(CheckCXXSourceCompiles)
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Configuring high resolution timing...")
+INCLUDE(CheckCXXSourceCompiles)
-set(CMAKE_REQUIRED_LIBRARIES -lrt)
+SET(CMAKE_REQUIRED_LIBRARIES -lrt)
CHECK_CXX_SOURCE_COMPILES("
#include <ctime>
int main(){
@@ -80,9 +73,9 @@ CHECK_CXX_SOURCE_COMPILES("
}
" HAVE_CLOCK_GETTIME
)
-unset(CMAKE_REQUIRED_LIBRARIES)
+UNSET(CMAKE_REQUIRED_LIBRARIES)
-include(CheckCXXSourceCompiles)
+INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#include <mach/mach_time.h>
int main(){
@@ -105,22 +98,22 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_QUERY_PERFORMANCE_COUNTER
)
-if(HAVE_CLOCK_GETTIME)
- message(STATUS " High resolution timing supported through clock_gettime.")
- set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
- APPEND_LIB_LIST( "-lrt")
-elseif(HAVE_MACH_ABSOLUTE_TIME)
- message(STATUS " High resolution timing supported through mach_absolute_time.")
- set(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME)
-elseif(HAVE_QUERY_PERFORMANCE_COUNTER)
- message(STATUS " High resolution timing supported through QueryPerformanceCounter.")
- set(TIME_SPEC_DEFS HAVE_QUERY_PERFORMANCE_COUNTER)
-else()
- message(STATUS " High resolution timing supported through microsec_clock.")
- set(TIME_SPEC_DEFS HAVE_MICROSEC_CLOCK)
-endif()
-
-set_source_files_properties(
+IF(HAVE_CLOCK_GETTIME)
+ MESSAGE(STATUS " High resolution timing supported through clock_gettime.")
+ SET(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
+ GR_OSMOSDR_APPEND_LIBS("-lrt")
+ELSEIF(HAVE_MACH_ABSOLUTE_TIME)
+ MESSAGE(STATUS " High resolution timing supported through mach_absolute_time.")
+ SET(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME)
+ELSEIF(HAVE_QUERY_PERFORMANCE_COUNTER)
+ MESSAGE(STATUS " High resolution timing supported through QueryPerformanceCounter.")
+ SET(TIME_SPEC_DEFS HAVE_QUERY_PERFORMANCE_COUNTER)
+ELSE()
+ MESSAGE(STATUS " High resolution timing supported through microsec_clock.")
+ SET(TIME_SPEC_DEFS HAVE_MICROSEC_CLOCK)
+ENDIF()
+
+SET_SOURCE_FILES_PROPERTIES(
time_spec.cc
PROPERTIES COMPILE_DEFINITIONS "${TIME_SPEC_DEFS}"
)
@@ -128,27 +121,27 @@ set_source_files_properties(
########################################################################
# Setup IQBalance component
########################################################################
-GR_REGISTER_COMPONENT("Osmocom IQ Imbalance Correction" ENABLE_IQBALANCE gnuradio-iqbalance_FOUND)
+GR_REGISTER_COMPONENT("Osmocom IQ Imbalance Correction" ENABLE_IQBALANCE GNURADIO_IQBALANCE_FOUND)
if(ENABLE_IQBALANCE)
- add_definitions(-DHAVE_IQBALANCE=1)
- target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS})
- APPEND_LIB_LIST( gnuradio::gnuradio-iqbalance)
+add_definitions(-DHAVE_IQBALANCE=1)
+include_directories(${GNURADIO_IQBALANCE_INCLUDE_DIRS})
+GR_OSMOSDR_APPEND_LIBS(${GNURADIO_IQBALANCE_LIBRARIES})
endif(ENABLE_IQBALANCE)
########################################################################
-# Setup FCD component
+# Setup OsmoSDR component
########################################################################
-GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FCDPP_FOUND)
-if(ENABLE_FCD)
- add_subdirectory(fcd)
-endif(ENABLE_FCD)
+GR_REGISTER_COMPONENT("sysmocom OsmoSDR" ENABLE_OSMOSDR LIBOSMOSDR_FOUND)
+if(ENABLE_OSMOSDR)
+GR_INCLUDE_SUBDIRECTORY(osmosdr)
+endif(ENABLE_OSMOSDR)
########################################################################
# Setup File component
########################################################################
-GR_REGISTER_COMPONENT("IQ File Source & Sink" ENABLE_FILE gnuradio-blocks_FOUND)
+GR_REGISTER_COMPONENT("IQ File Source & Sink" ENABLE_FILE GNURADIO_BLOCKS_FOUND)
if(ENABLE_FILE)
- add_subdirectory(file)
+GR_INCLUDE_SUBDIRECTORY(file)
endif(ENABLE_FILE)
########################################################################
@@ -156,32 +149,40 @@ endif(ENABLE_FILE)
########################################################################
GR_REGISTER_COMPONENT("Osmocom RTLSDR" ENABLE_RTL LIBRTLSDR_FOUND)
if(ENABLE_RTL)
- add_subdirectory(rtl)
+GR_INCLUDE_SUBDIRECTORY(rtl)
endif(ENABLE_RTL)
########################################################################
# Setup RTL_TCP component
########################################################################
-GR_REGISTER_COMPONENT("RTLSDR TCP Client" ENABLE_RTL_TCP gnuradio-blocks_FOUND)
+GR_REGISTER_COMPONENT("RTLSDR TCP Client" ENABLE_RTL_TCP GNURADIO_BLOCKS_FOUND)
if(ENABLE_RTL_TCP)
- add_subdirectory(rtl_tcp)
+GR_INCLUDE_SUBDIRECTORY(rtl_tcp)
endif(ENABLE_RTL_TCP)
########################################################################
# Setup UHD component
########################################################################
-GR_REGISTER_COMPONENT("Ettus USRP Devices" ENABLE_UHD UHD_FOUND gnuradio-uhd_FOUND)
+GR_REGISTER_COMPONENT("Ettus USRP Devices" ENABLE_UHD UHD_FOUND GNURADIO_UHD_FOUND)
if(ENABLE_UHD)
- add_subdirectory(uhd)
+GR_INCLUDE_SUBDIRECTORY(uhd)
endif(ENABLE_UHD)
########################################################################
+# Setup MiriSDR component
+########################################################################
+GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND)
+if(ENABLE_MIRI)
+GR_INCLUDE_SUBDIRECTORY(miri)
+endif(ENABLE_MIRI)
+
+########################################################################
# Setup SDRplay component
########################################################################
if(ENABLE_NONFREE)
GR_REGISTER_COMPONENT("SDRplay RSP (NONFREE)" ENABLE_SDRPLAY LIBSDRPLAY_FOUND)
if(ENABLE_SDRPLAY)
- add_subdirectory(sdrplay)
+GR_INCLUDE_SUBDIRECTORY(sdrplay)
endif(ENABLE_SDRPLAY)
endif(ENABLE_NONFREE)
@@ -190,7 +191,7 @@ endif(ENABLE_NONFREE)
########################################################################
GR_REGISTER_COMPONENT("HackRF & rad1o Badge" ENABLE_HACKRF LIBHACKRF_FOUND)
if(ENABLE_HACKRF)
- add_subdirectory(hackrf)
+GR_INCLUDE_SUBDIRECTORY(hackrf)
endif(ENABLE_HACKRF)
########################################################################
@@ -198,7 +199,7 @@ endif(ENABLE_HACKRF)
########################################################################
GR_REGISTER_COMPONENT("nuand bladeRF" ENABLE_BLADERF LIBBLADERF_FOUND)
if(ENABLE_BLADERF)
- add_subdirectory(bladerf)
+GR_INCLUDE_SUBDIRECTORY(bladerf)
endif(ENABLE_BLADERF)
########################################################################
@@ -206,7 +207,7 @@ endif(ENABLE_BLADERF)
########################################################################
GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE)
if(ENABLE_RFSPACE)
- add_subdirectory(rfspace)
+GR_INCLUDE_SUBDIRECTORY(rfspace)
endif(ENABLE_RFSPACE)
########################################################################
@@ -214,23 +215,15 @@ endif(ENABLE_RFSPACE)
########################################################################
GR_REGISTER_COMPONENT("AIRSPY Receiver" ENABLE_AIRSPY LIBAIRSPY_FOUND)
if(ENABLE_AIRSPY)
- add_subdirectory(airspy)
+GR_INCLUDE_SUBDIRECTORY(airspy)
endif(ENABLE_AIRSPY)
########################################################################
-# Setup AIRSPYHF component
-########################################################################
-GR_REGISTER_COMPONENT("AIRSPY HF+ Receiver" ENABLE_AIRSPYHF LIBAIRSPYHF_FOUND)
-if(ENABLE_AIRSPYHF)
- add_subdirectory(airspyhf)
-endif(ENABLE_AIRSPYHF)
-
-########################################################################
# Setup SoapySDR component
########################################################################
GR_REGISTER_COMPONENT("SoapySDR support" ENABLE_SOAPY SoapySDR_FOUND)
if(ENABLE_SOAPY)
- add_subdirectory(soapy)
+GR_INCLUDE_SUBDIRECTORY(soapy)
endif(ENABLE_SOAPY)
########################################################################
@@ -238,7 +231,7 @@ endif(ENABLE_SOAPY)
########################################################################
GR_REGISTER_COMPONENT("Red Pitaya SDR" ENABLE_REDPITAYA)
if(ENABLE_REDPITAYA)
- add_subdirectory(redpitaya)
+GR_INCLUDE_SUBDIRECTORY(redpitaya)
endif(ENABLE_REDPITAYA)
########################################################################
@@ -246,35 +239,37 @@ endif(ENABLE_REDPITAYA)
########################################################################
GR_REGISTER_COMPONENT("FreeSRP support" ENABLE_FREESRP LIBFREESRP_FOUND)
if(ENABLE_FREESRP)
- add_subdirectory(freesrp)
+GR_INCLUDE_SUBDIRECTORY(freesrp)
endif(ENABLE_FREESRP)
########################################################################
-# Setup XTRX component
-########################################################################
-GR_REGISTER_COMPONENT("XTRX SDR" ENABLE_XTRX LIBXTRX_FOUND)
-if(ENABLE_XTRX)
- add_subdirectory(xtrx)
-endif(ENABLE_XTRX)
-
-########################################################################
# Setup configuration file
########################################################################
-add_definitions(-DHAVE_CONFIG_H=1)
+ADD_DEFINITIONS(-DHAVE_CONFIG_H=1)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-configure_file(
+CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
@ONLY)
########################################################################
-# Finalize target
+# Set up Windows DLL resource files
########################################################################
-set_target_properties(gnuradio-osmosdr PROPERTIES SOURCES "${gr_osmosdr_srcs}")
-target_link_libraries(gnuradio-osmosdr ${gr_osmosdr_libs})
+IF(MSVC)
+ include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-osmosdr.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.rc
+ @ONLY)
+
+ GR_OSMOSDR_APPEND_SRCS(${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.rc)
+ENDIF(MSVC)
########################################################################
-# Install built library files
+# Setup libgnuradio-osmosdr library
########################################################################
-include(GrMiscUtils)
+ADD_LIBRARY(gnuradio-osmosdr SHARED ${gr_osmosdr_srcs})
+TARGET_LINK_LIBRARIES(gnuradio-osmosdr ${gr_osmosdr_libs})
+SET_TARGET_PROPERTIES(gnuradio-osmosdr PROPERTIES DEFINE_SYMBOL "gnuradio_osmosdr_EXPORTS")
GR_LIBRARY_FOO(gnuradio-osmosdr)