aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2019-12-08 16:05:07 +0100
committerSylvain Munaut <tnt@246tNt.com>2020-02-16 09:52:00 +0100
commit5d59e56ff90258e32a0606121c8dea522c45cb17 (patch)
tree72314123c0b6cf5a109376ad452f55532590ea4a
parente9890283ca4470ed3a7c04ffbbe584486ccfe672 (diff)
build: Update build system to GR 3.8 standards
Part of GNURadio 3.8 migration Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--CMakeLists.txt372
-rw-r--r--cmake/Modules/targetConfig.cmake.in26
-rw-r--r--gnuradio-osmosdr.pc.in15
-rw-r--r--lib/CMakeLists.txt156
-rw-r--r--lib/airspy/CMakeLists.txt17
-rw-r--r--lib/bladerf/CMakeLists.txt18
-rw-r--r--lib/fcd/CMakeLists.txt34
-rw-r--r--lib/file/CMakeLists.txt17
-rw-r--r--lib/freesrp/CMakeLists.txt15
-rw-r--r--lib/gnuradio-osmosdr.rc.in55
-rw-r--r--lib/hackrf/CMakeLists.txt19
-rw-r--r--lib/miri/CMakeLists.txt15
-rw-r--r--lib/osmosdr/CMakeLists.txt15
-rw-r--r--lib/redpitaya/CMakeLists.txt15
-rw-r--r--lib/rfspace/CMakeLists.txt12
-rw-r--r--lib/rtl/CMakeLists.txt16
-rw-r--r--lib/rtl_tcp/CMakeLists.txt16
-rw-r--r--lib/sdrplay/CMakeLists.txt15
-rw-r--r--lib/soapy/CMakeLists.txt15
-rw-r--r--lib/uhd/CMakeLists.txt18
-rw-r--r--python/__init__.py6
-rw-r--r--swig/CMakeLists.txt10
22 files changed, 399 insertions, 498 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43b30d7..c99a7f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,11 +20,14 @@
########################################################################
# Project setup
########################################################################
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.8)
+include(GNUInstallDirs)
project(gr-osmosdr CXX C)
enable_testing()
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+#policy setup
+cmake_policy(SET CMP0011 NEW)
+cmake_policy(SET CMP0079 NEW)
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
@@ -33,187 +36,153 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
-set(ENABLE_NONFREE FALSE CACHE BOOL "Enable or disable nonfree components.")
+########################################################################
+# GNURadio setup
+########################################################################
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+# Find GNURadio (pmt and runtime are core, always included)
+find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter)
# Set the version information here
-set(VERSION_INFO_MAJOR_VERSION 0)
-set(VERSION_INFO_API_COMPAT 1)
-set(VERSION_INFO_MINOR_VERSION 5)
-set(VERSION_INFO_MAINT_VERSION 0)
+set(VERSION_MAJOR 0)
+set(VERSION_API 2)
+set(VERSION_ABI 0)
+set(VERSION_PATCH 0)
include(GrVersion) #setup version info
########################################################################
# Compiler specific setup
########################################################################
-IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
- SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
-ELSE()
- SET(USE_SIMD "no" CACHE STRING "Use SIMD instructions")
-ENDIF()
- SET(USE_SIMD_VALUES "no" "SSE2" "AVX")
- SET_PROPERTY(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES})
- LIST(FIND USE_SIMD_VALUES ${USE_SIMD} USE_SIMD_INDEX)
- IF(${USE_SIMD_INDEX} EQUAL -1)
- message(FATAL_ERROR "Option ${USE_SIMD} not supported, valid entries are ${USE_SIMD_VALUES}")
- ENDIF()
-
-IF(CMAKE_CXX_COMPILER MATCHES ".*clang")
- SET(CMAKE_COMPILER_IS_CLANGXX 1)
-ENDIF()
-
-IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
- ADD_DEFINITIONS(-Wall)
- ADD_DEFINITIONS(-Wextra)
- ADD_DEFINITIONS(-Wno-unused-parameter)
- ADD_DEFINITIONS(-Wsign-compare)
- #ADD_DEFINITIONS(-Wconversion)
- #ADD_DEFINITIONS(-pedantic)
- #ADD_DEFINITIONS(-ansi)
- IF(NOT WIN32)
- #only export symbols that are declared to be part of the api (non dll platforms)
- ADD_DEFINITIONS(-fvisibility=hidden)
- ADD_DEFINITIONS(-fvisibility-inlines-hidden)
- ENDIF(NOT WIN32)
- IF(USE_SIMD MATCHES SSE2)
- ADD_DEFINITIONS(-msse2)
- ADD_DEFINITIONS(-DUSE_SSE2)
- ENDIF()
- IF(USE_SIMD MATCHES AVX)
- ADD_DEFINITIONS(-march=native)
- ADD_DEFINITIONS(-DUSE_AVX)
- ENDIF()
-ELSEIF(MSVC)
- IF(USE_SIMD MATCHES SSE2)
- ADD_DEFINITIONS(/arch:SSE2)
- ADD_DEFINITIONS(-DUSE_SSE2)
- ENDIF()
- IF(USE_SIMD MATCHES AVX)
- ADD_DEFINITIONS(/arch:AVX)
- ADD_DEFINITIONS(-DUSE_AVX)
- ENDIF()
-ENDIF()
-
-########################################################################
-# Setup boost
-########################################################################
-MESSAGE(STATUS "Configuring Boost C++ Libraries...")
-
-# Although not required on my system, some users have linking issues without
-SET(BOOST_REQUIRED_COMPONENTS
- thread
- system
-)
+if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ AND NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ add_definitions(-fvisibility=hidden)
+ add_definitions(-fvisibility-inlines-hidden)
+endif()
-if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
- list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
-endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
-
-set(Boost_ADDITIONAL_VERSIONS
- "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
- "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
- "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
- "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
- "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
- "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
- "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
-)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_CXX_STANDARD 11)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ set(CMAKE_CXX_STANDARD 11)
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ set(CMAKE_CXX_STANDARD 11)
+else()
+ message(WARNING "C++ standard could not be set because compiler is not GNU, Clang or MSVC.")
+endif()
-find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
+# Misc options
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ add_definitions(-Wall)
+ add_definitions(-Wextra)
+ add_definitions(-Wno-unused-parameter)
+ add_definitions(-Wsign-compare)
+ #add_definitions(-Wconversion)
+ #add_definitions(-pedantic)
+ #add_definitions(-ansi)
+endif()
-if(NOT Boost_FOUND)
- message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME})
+# SIMD
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
+ set(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
+else()
+ set(USE_SIMD "no" CACHE STRING "Use SIMD instructions")
+endif()
+set(USE_SIMD_VALUES "no" "SSE2" "AVX")
+set_property(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES})
+list(FIND USE_SIMD_VALUES ${USE_SIMD} USE_SIMD_INDEX)
+if(${USE_SIMD_INDEX} EQUAL -1)
+ message(FATAL_ERROR "Option ${USE_SIMD} not supported, valid entries are ${USE_SIMD_VALUES}")
endif()
-ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if(USE_SIMD MATCHES SSE2)
+ add_definitions(-msse2)
+ add_definitions(-DUSE_SSE2)
+ endif()
+ if(USE_SIMD MATCHES AVX)
+ add_definitions(-march=native)
+ add_definitions(-DUSE_AVX)
+ endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ if(USE_SIMD MATCHES SSE2)
+ add_definitions(/arch:SSE2)
+ add_definitions(-DUSE_SSE2)
+ endif()
+ if(USE_SIMD MATCHES AVX)
+ add_definitions(/arch:AVX)
+ add_definitions(-DUSE_AVX)
+ endif()
+endif()
########################################################################
-# Install directories
+# Find boost
########################################################################
-include(GrPlatform) #define LIB_SUFFIX
-set(GR_RUNTIME_DIR bin)
-set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
-set(GR_INCLUDE_DIR include)
-set(GR_DATA_DIR share)
-set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
-set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
-if (NOT GR_PKG_DOC_DIR)
- set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
+find_package(Boost "1.65" REQUIRED chrono thread system)
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "Boost required to compile osmosdr")
endif()
-set(GR_CONF_DIR etc)
-set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
-set(GR_LIBEXEC_DIR libexec)
-set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
-set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
########################################################################
-# Find build dependencies
+# Find build dependencies and setup options
########################################################################
-set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS)
-set(MIN_GR_VERSION "3.7.10")
-find_package(Gnuradio REQUIRED)
-if("${Gnuradio_VERSION}" VERSION_LESS MIN_GR_VERSION)
- MESSAGE(FATAL_ERROR "GnuRadio version required: >=\"" ${MIN_GR_VERSION} "\" found: \"" ${Gnuradio_VERSION} "\"")
-endif()
-find_package(GnuradioIQBalance)
+include(GrComponent)
+
+set(ENABLE_NONFREE FALSE CACHE BOOL "Enable or disable nonfree components.")
+
+
+ # GNURadio components & OOTs
+ ##############################
+
+
+ # Note this is not supposed to be lique that for GR components
+ # but ATM GR's handling of components is broken
+message(STATUS "Searching for GNURadio-Blocks...")
+find_package(gnuradio-blocks PATHS ${Gnuradio_DIR})
+message(STATUS " Found GNURadio-Blocks: ${gnuradio-blocks_FOUND}")
+
+message(STATUS "Searching for IQ Balance...")
+find_package(gnuradio-iqbalance PATHS ${Gnuradio_DIR})
+message (STATUS " Found IQ Balance: ${gnuradio-iqbalance_FOUND}")
+
+message(STATUS "Searching for UHD Drivers...")
find_package(UHD)
-find_package(GnuradioUHD)
-find_package(GnuradioFCD)
-find_package(GnuradioFCDPP)
+message (STATUS " Found UHD Driver: ${UHD_FOUND}")
+
+message(STATUS "Searching for UHD Block...")
+find_package(gnuradio-uhd PATHS ${Gnuradio_DIR})
+message (STATUS " Found UHD Block: ${gnuradio-uhd_FOUND}")
+
+message(STATUS "Searching for Volk...")
+find_package(Volk REQUIRED)
+message (STATUS " Found Volk: ${Volk_FOUND}")
+
+ # Hardware drivers
+ ####################
+
find_package(LibOsmoSDR)
find_package(LibRTLSDR)
find_package(LibMiriSDR)
if(ENABLE_NONFREE)
-find_package(LibSDRplay)
+ find_package(LibSDRplay)
endif(ENABLE_NONFREE)
find_package(LibHackRF)
find_package(LibAIRSPY)
-find_package(Volk)
find_package(LibbladeRF)
find_package(SoapySDR NO_MODULE)
find_package(LibFreeSRP)
find_package(Doxygen)
-if(NOT GNURADIO_RUNTIME_FOUND)
- message(FATAL_ERROR "GnuRadio Runtime required to build " ${CMAKE_PROJECT_NAME})
-endif()
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/lib
- ${Boost_INCLUDE_DIRS}
- ${GNURADIO_ALL_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
- ${GNURADIO_ALL_LIBRARY_DIRS}
-)
-
-# Set component parameters
-set(GR_OSMOSDR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
-set(GR_OSMOSDR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
-
-########################################################################
-# Create uninstall target
-########################################################################
-configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
-@ONLY)
+ # Python
+ ##########
-add_custom_target(uninstall
- ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
-)
-
-########################################################################
-# Enable python component
-########################################################################
-find_package(PythonLibs 2)
+find_package(PythonLibs 3)
find_package(SWIG)
if(SWIG_FOUND)
@@ -224,7 +193,6 @@ if(SWIG_FOUND)
endif()
endif(SWIG_FOUND)
-include(GrComponent)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
@@ -232,6 +200,65 @@ GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
)
########################################################################
+# Install directories
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+
+if(NOT CMAKE_MODULES_DIR)
+ set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
+endif(NOT CMAKE_MODULES_DIR)
+
+set(GR_INCLUDE_DIR include)
+set(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/osmosdr)
+set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
+set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
+
+########################################################################
+# On Apple only, set install name and use rpath correctly, if not already set
+########################################################################
+if(APPLE)
+ if(NOT CMAKE_INSTALL_NAME_DIR)
+ set(CMAKE_INSTALL_NAME_DIR
+ ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
+ PATH "Library Install Name Destination Directory" FORCE)
+ endif(NOT CMAKE_INSTALL_NAME_DIR)
+ if(NOT CMAKE_INSTALL_RPATH)
+ set(CMAKE_INSTALL_RPATH
+ ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
+ PATH "Library Install RPath" FORCE)
+ endif(NOT CMAKE_INSTALL_RPATH)
+ if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
+ BOOL "Do Build Using Library Install RPath" FORCE)
+ endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+endif(APPLE)
+
+########################################################################
+# Setup doxygen option
+########################################################################
+find_package(Doxygen)
+
+if(DOXYGEN_FOUND)
+ option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
+else(DOXYGEN_FOUND)
+ option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
+endif(DOXYGEN_FOUND)
+
+########################################################################
+# Create uninstall target
+########################################################################
+configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+@ONLY)
+
+add_custom_target(uninstall
+ ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+ )
+
+########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/osmosdr)
@@ -240,57 +267,20 @@ if(ENABLE_PYTHON)
add_subdirectory(swig)
add_subdirectory(python)
add_subdirectory(grc)
- add_subdirectory(apps)
+ #Apps not ported to Qt
+ #add_subdirectory(apps)
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
-@ONLY)
-
-INSTALL(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
- DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
-)
-
-########################################################################
# Print Summary
########################################################################
GR_PRINT_COMPONENT_SUMMARY()
if(ENABLE_NONFREE)
-MESSAGE(STATUS
- "NONFREE components have been enabled. The resulting
+ MESSAGE(STATUS
+ "NONFREE components have been enabled. The resulting
binaries cannot be distributed under GPL terms.
- "
-)
+ ")
endif(ENABLE_NONFREE)
MESSAGE(STATUS "Building for version: ${VERSION} / ${LIBVER}")
diff --git a/cmake/Modules/targetConfig.cmake.in b/cmake/Modules/targetConfig.cmake.in
new file mode 100644
index 0000000..79e4a28
--- /dev/null
+++ b/cmake/Modules/targetConfig.cmake.in
@@ -0,0 +1,26 @@
+# Copyright 2018 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# 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.
+#
+# 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+include(CMakeFindDependencyMacro)
+
+set(target_deps "@TARGET_DEPENDENCIES@")
+foreach(dep IN LISTS target_deps)
+ find_dependency(${dep})
+endforeach()
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")
diff --git a/gnuradio-osmosdr.pc.in b/gnuradio-osmosdr.pc.in
deleted file mode 100644
index 5f1ae69..0000000
--- a/gnuradio-osmosdr.pc.in
+++ /dev/null
@@ -1,15 +0,0 @@
-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@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cdf0583..a5ea712 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -20,22 +20,13 @@
########################################################################
# Setup library
########################################################################
-INCLUDE(GrPlatform) #define LIB_SUFFIX
-INCLUDE(GrMiscUtils)
-INCLUDE(GrComponent)
+include(GrPlatform) #define LIB_SUFFIX
########################################################################
-# Helpful Macros
+# Setup target
########################################################################
-MACRO(GR_OSMOSDR_APPEND_SRCS)
- LIST(APPEND gr_osmosdr_srcs ${ARGV})
-ENDMACRO(GR_OSMOSDR_APPEND_SRCS)
-MACRO(GR_OSMOSDR_APPEND_LIBS)
- LIST(APPEND gr_osmosdr_libs ${ARGV})
-ENDMACRO(GR_OSMOSDR_APPEND_LIBS)
-
-GR_OSMOSDR_APPEND_SRCS(
+list(APPEND gr_osmosdr_srcs
source_impl.cc
sink_impl.cc
ranges.cc
@@ -49,19 +40,30 @@ if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND Boost_LIBRARIES -pthread)
endif()
-GR_OSMOSDR_APPEND_LIBS(
- ${Boost_LIBRARIES}
- ${GNURADIO_ALL_LIBRARIES}
-)
+add_library(gnuradio-osmosdr SHARED)
+target_link_libraries(gnuradio-osmosdr ${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)
########################################################################
# 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(){
@@ -70,9 +72,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(){
@@ -95,22 +97,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)
- 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()
+if(HAVE_CLOCK_GETTIME)
+ message(STATUS " High resolution timing supported through clock_gettime.")
+ set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
+ target_link_libraries(gnuradio-osmosdr "-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(
+set_source_files_properties(
time_spec.cc
PROPERTIES COMPILE_DEFINITIONS "${TIME_SPEC_DEFS}"
)
@@ -118,11 +120,11 @@ 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)
-include_directories(${GNURADIO_IQBALANCE_INCLUDE_DIRS})
-GR_OSMOSDR_APPEND_LIBS(${GNURADIO_IQBALANCE_LIBRARIES})
+ add_definitions(-DHAVE_IQBALANCE=1)
+ target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS})
+ target_link_libraries(gnuradio-osmosdr gnuradio::gnuradio-iqbalance)
endif(ENABLE_IQBALANCE)
########################################################################
@@ -130,30 +132,15 @@ endif(ENABLE_IQBALANCE)
########################################################################
GR_REGISTER_COMPONENT("sysmocom OsmoSDR" ENABLE_OSMOSDR LIBOSMOSDR_FOUND)
if(ENABLE_OSMOSDR)
-GR_INCLUDE_SUBDIRECTORY(osmosdr)
+ add_subdirectory(osmosdr)
endif(ENABLE_OSMOSDR)
########################################################################
-# Setup FCD component
-########################################################################
-GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FCD_FOUND)
-GR_REGISTER_COMPONENT("FUNcube Dongle Pro+" ENABLE_FCDPP GNURADIO_FCDPP_FOUND)
-if(ENABLE_FCD)
-add_definitions(-DHAVE_FCD=1)
-endif(ENABLE_FCD)
-if(ENABLE_FCDPP)
-add_definitions(-DHAVE_FCDPP=1)
-endif(ENABLE_FCDPP)
-if(ENABLE_FCD OR ENABLE_FCDPP)
-GR_INCLUDE_SUBDIRECTORY(fcd)
-endif(ENABLE_FCD OR ENABLE_FCDPP)
-
-########################################################################
# 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)
-GR_INCLUDE_SUBDIRECTORY(file)
+ add_subdirectory(file)
endif(ENABLE_FILE)
########################################################################
@@ -161,23 +148,23 @@ endif(ENABLE_FILE)
########################################################################
GR_REGISTER_COMPONENT("Osmocom RTLSDR" ENABLE_RTL LIBRTLSDR_FOUND)
if(ENABLE_RTL)
-GR_INCLUDE_SUBDIRECTORY(rtl)
+ add_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)
-GR_INCLUDE_SUBDIRECTORY(rtl_tcp)
+ add_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)
-GR_INCLUDE_SUBDIRECTORY(uhd)
+ add_subdirectory(uhd)
endif(ENABLE_UHD)
########################################################################
@@ -185,7 +172,7 @@ endif(ENABLE_UHD)
########################################################################
GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND)
if(ENABLE_MIRI)
-GR_INCLUDE_SUBDIRECTORY(miri)
+ add_subdirectory(miri)
endif(ENABLE_MIRI)
########################################################################
@@ -194,7 +181,7 @@ endif(ENABLE_MIRI)
if(ENABLE_NONFREE)
GR_REGISTER_COMPONENT("SDRplay RSP (NONFREE)" ENABLE_SDRPLAY LIBSDRPLAY_FOUND)
if(ENABLE_SDRPLAY)
-GR_INCLUDE_SUBDIRECTORY(sdrplay)
+ add_subdirectory(sdrplay)
endif(ENABLE_SDRPLAY)
endif(ENABLE_NONFREE)
@@ -203,7 +190,7 @@ endif(ENABLE_NONFREE)
########################################################################
GR_REGISTER_COMPONENT("HackRF & rad1o Badge" ENABLE_HACKRF LIBHACKRF_FOUND)
if(ENABLE_HACKRF)
-GR_INCLUDE_SUBDIRECTORY(hackrf)
+ add_subdirectory(hackrf)
endif(ENABLE_HACKRF)
########################################################################
@@ -211,7 +198,7 @@ endif(ENABLE_HACKRF)
########################################################################
GR_REGISTER_COMPONENT("nuand bladeRF" ENABLE_BLADERF LIBBLADERF_FOUND)
if(ENABLE_BLADERF)
-GR_INCLUDE_SUBDIRECTORY(bladerf)
+ add_subdirectory(bladerf)
endif(ENABLE_BLADERF)
########################################################################
@@ -219,7 +206,7 @@ endif(ENABLE_BLADERF)
########################################################################
GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE)
if(ENABLE_RFSPACE)
-GR_INCLUDE_SUBDIRECTORY(rfspace)
+ add_subdirectory(rfspace)
endif(ENABLE_RFSPACE)
########################################################################
@@ -227,7 +214,7 @@ endif(ENABLE_RFSPACE)
########################################################################
GR_REGISTER_COMPONENT("AIRSPY Receiver" ENABLE_AIRSPY LIBAIRSPY_FOUND)
if(ENABLE_AIRSPY)
-GR_INCLUDE_SUBDIRECTORY(airspy)
+ add_subdirectory(airspy)
endif(ENABLE_AIRSPY)
########################################################################
@@ -235,7 +222,7 @@ endif(ENABLE_AIRSPY)
########################################################################
GR_REGISTER_COMPONENT("SoapySDR support" ENABLE_SOAPY SoapySDR_FOUND)
if(ENABLE_SOAPY)
-GR_INCLUDE_SUBDIRECTORY(soapy)
+ add_subdirectory(soapy)
endif(ENABLE_SOAPY)
########################################################################
@@ -243,7 +230,7 @@ endif(ENABLE_SOAPY)
########################################################################
GR_REGISTER_COMPONENT("Red Pitaya SDR" ENABLE_REDPITAYA)
if(ENABLE_REDPITAYA)
-GR_INCLUDE_SUBDIRECTORY(redpitaya)
+ add_subdirectory(redpitaya)
endif(ENABLE_REDPITAYA)
########################################################################
@@ -251,37 +238,26 @@ endif(ENABLE_REDPITAYA)
########################################################################
GR_REGISTER_COMPONENT("FreeSRP support" ENABLE_FREESRP LIBFREESRP_FOUND)
if(ENABLE_FREESRP)
-GR_INCLUDE_SUBDIRECTORY(freesrp)
+ add_subdirectory(freesrp)
endif(ENABLE_FREESRP)
########################################################################
# 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)
########################################################################
-# Set up Windows DLL resource files
+# Finalize target
########################################################################
-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)
+set_target_properties(gnuradio-osmosdr PROPERTIES SOURCES "${gr_osmosdr_srcs}")
########################################################################
-# Setup libgnuradio-osmosdr library
+# Install built library files
########################################################################
-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")
+include(GrMiscUtils)
GR_LIBRARY_FOO(gnuradio-osmosdr)
diff --git a/lib/airspy/CMakeLists.txt b/lib/airspy/CMakeLists.txt
index f2edbcc..7577086 100644
--- a/lib/airspy/CMakeLists.txt
+++ b/lib/airspy/CMakeLists.txt
@@ -21,17 +21,18 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBAIRSPY_INCLUDE_DIRS}
)
-set(airspy_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/airspy_source_c.cc
+target_link_libraries(gnuradio-osmosdr
+ gnuradio::filter
+ ${Gnuradio-blocks_LIBRARIES}
+ ${LIBAIRSPY_LIBRARIES}
)
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${airspy_srcs})
-list(APPEND gr_osmosdr_libs ${LIBAIRSPY_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/airspy_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/bladerf/CMakeLists.txt b/lib/bladerf/CMakeLists.txt
index fa28fe1..e09a4d7 100644
--- a/lib/bladerf/CMakeLists.txt
+++ b/lib/bladerf/CMakeLists.txt
@@ -21,20 +21,20 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBBLADERF_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
+ ${Volk_INCLUDE_DIRS}
)
-set(bladerf_srcs
+target_link_libraries(gnuradio-osmosdr
+ ${LIBBLADERF_LIBRARIES}
+ ${Volk_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/bladerf_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/bladerf_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/bladerf_common.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${bladerf_srcs})
-list(APPEND gr_osmosdr_libs ${LIBBLADERF_LIBRARIES} ${VOLK_LIBRARIES})
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt
index 028d972..146191f 100644
--- a/lib/fcd/CMakeLists.txt
+++ b/lib/fcd/CMakeLists.txt
@@ -21,29 +21,29 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(gnuradio-osmosdr PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
if(ENABLE_FCD)
-include_directories(${GNURADIO_FCD_INCLUDE_DIRS})
+ target_include_directories(gnuradio-osmosdr PRIVATE
+ ${Gnuradio-fcd_INCLUDE_DIRS}
+ )
+ target_link_libraries(gnuradio-osmosdr PRIVATE
+ ${Gnuradio-fcd_LIBRARIES}
+ )
endif(ENABLE_FCD)
if(ENABLE_FCDPP)
-include_directories(${GNURADIO_FCDPP_INCLUDE_DIRS})
+ target_include_directories(gnuradio-osmosdr PRIVATE
+ ${Gnuradio-fcdpp_INCLUDE_DIRS}
+ )
+ target_link_libraries(gnuradio-osmosdr PRIVATE
+ ${Gnuradio-fcdpp_LIBRARIES}
+ )
endif(ENABLE_FCDPP)
-set(fcd_srcs
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${fcd_srcs})
-
-if(ENABLE_FCD)
-list(APPEND gr_osmosdr_libs ${GNURADIO_FCD_LIBRARIES})
-endif(ENABLE_FCD)
-
-if(ENABLE_FCDPP)
-list(APPEND gr_osmosdr_libs ${GNURADIO_FCDPP_LIBRARIES})
-endif(ENABLE_FCDPP)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/file/CMakeLists.txt b/lib/file/CMakeLists.txt
index f7e5029..2897589 100644
--- a/lib/file/CMakeLists.txt
+++ b/lib/file/CMakeLists.txt
@@ -21,18 +21,17 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
-set(file_srcs
+target_link_libraries(gnuradio-osmosdr
+ gnuradio::gnuradio-blocks
+)
+message(STATUS ${gnuradio-blocks_LIBRARIES})
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/file_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/file_sink_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${file_srcs})
-#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})
-
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/freesrp/CMakeLists.txt b/lib/freesrp/CMakeLists.txt
index 66c754b..85eb64d 100644
--- a/lib/freesrp/CMakeLists.txt
+++ b/lib/freesrp/CMakeLists.txt
@@ -21,19 +21,18 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBFREESRP_INCLUDE_DIRS}
)
-set(freesrp_srcs
+target_link_libraries(gnuradio-osmosdr
+ ${LIBFREESRP_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/freesrp_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/freesrp_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/freesrp_sink_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${freesrp_srcs})
-list(APPEND gr_osmosdr_libs ${LIBFREESRP_LIBRARIES})
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/gnuradio-osmosdr.rc.in b/lib/gnuradio-osmosdr.rc.in
deleted file mode 100644
index 62fd5ea..0000000
--- a/lib/gnuradio-osmosdr.rc.in
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * 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.
- *
- * 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <afxres.h>
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
- PRODUCTVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
- FILEFLAGSMASK 0x3fL
-#ifndef NDEBUG
- FILEFLAGS 0x0L
-#else
- FILEFLAGS 0x1L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_DRV_INSTALLABLE
- BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "FileDescription", "gnuradio-osmosdr"
- VALUE "FileVersion", "@VERSION@"
- VALUE "InternalName", "gnuradio-osmosdr.dll"
- VALUE "LegalCopyright", "Licensed under GPLv3 or any later version"
- VALUE "OriginalFilename", "gnuradio-osmosdr.dll"
- VALUE "ProductName", "gnuradio-osmosdr"
- VALUE "ProductVersion", "@VERSION@"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
- END
diff --git a/lib/hackrf/CMakeLists.txt b/lib/hackrf/CMakeLists.txt
index 971c0a6..b817518 100644
--- a/lib/hackrf/CMakeLists.txt
+++ b/lib/hackrf/CMakeLists.txt
@@ -21,27 +21,26 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBHACKRF_INCLUDE_DIRS}
)
-set(hackrf_srcs
+target_link_libraries(gnuradio-osmosdr
+ ${LIBHACKRF_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/hackrf_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/hackrf_sink_c.cc
)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
-INCLUDE(CheckFunctionExists)
+include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${LIBHACKRF_LIBRARIES})
CHECK_FUNCTION_EXISTS(hackrf_device_list LIBHACKRF_HAVE_DEVICE_LIST)
if(LIBHACKRF_HAVE_DEVICE_LIST)
message(STATUS "HackRF multiple device support enabled")
- add_definitions(-DLIBHACKRF_HAVE_DEVICE_LIST)
+ target_compile_definitions(gnuradio-osmosdr PRIVATE -DLIBHACKRF_HAVE_DEVICE_LIST)
endif(LIBHACKRF_HAVE_DEVICE_LIST)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${hackrf_srcs})
-list(APPEND gr_osmosdr_libs ${LIBHACKRF_LIBRARIES})
diff --git a/lib/miri/CMakeLists.txt b/lib/miri/CMakeLists.txt
index b9a1cf9..5415a9d 100644
--- a/lib/miri/CMakeLists.txt
+++ b/lib/miri/CMakeLists.txt
@@ -21,17 +21,16 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBMIRISDR_INCLUDE_DIRS}
)
-set(mirisdr_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/miri_source_c.cc
+target_link_libraries(gnuradio-osmosdr
+ ${LIBMIRISDR_LIBRARIES}
)
-########################################################################
-# Append gnuradio-mirisdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${mirisdr_srcs})
-list(APPEND gr_osmosdr_libs ${LIBMIRISDR_LIBRARIES})
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/miri_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/osmosdr/CMakeLists.txt b/lib/osmosdr/CMakeLists.txt
index 2f2a884..83d6dbc 100644
--- a/lib/osmosdr/CMakeLists.txt
+++ b/lib/osmosdr/CMakeLists.txt
@@ -21,17 +21,16 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBOSMOSDR_INCLUDE_DIRS}
)
-set(osmosdr_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/osmosdr_src_c.cc
+target_link_libraries(gnuradio-osmosdr
+ ${LIBOSMOSDR_LIBRARIES}
)
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${osmosdr_srcs})
-list(APPEND gr_osmosdr_libs ${LIBOSMOSDR_LIBRARIES})
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/osmosdr_src_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/redpitaya/CMakeLists.txt b/lib/redpitaya/CMakeLists.txt
index f2fec0d..0d13c48 100644
--- a/lib/redpitaya/CMakeLists.txt
+++ b/lib/redpitaya/CMakeLists.txt
@@ -21,18 +21,17 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
-set(redpitaya_srcs
+target_link_libraries(gnuradio-osmosdr
+ ${Gnuradio-blocks_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_common.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${redpitaya_srcs})
-#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/rfspace/CMakeLists.txt b/lib/rfspace/CMakeLists.txt
index b73f396..c096550 100644
--- a/lib/rfspace/CMakeLists.txt
+++ b/lib/rfspace/CMakeLists.txt
@@ -21,17 +21,11 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
-set(rfspace_srcs
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/rfspace_source_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${rfspace_srcs})
-#list(APPEND gr_osmosdr_libs ...)
-
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/rtl/CMakeLists.txt b/lib/rtl/CMakeLists.txt
index b6d2928..ad3a7dc 100644
--- a/lib/rtl/CMakeLists.txt
+++ b/lib/rtl/CMakeLists.txt
@@ -21,18 +21,16 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBRTLSDR_INCLUDE_DIRS}
)
-set(rtl_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/rtl_source_c.cc
+target_link_libraries(gnuradio-osmosdr
+ ${LIBRTLSDR_LIBRARIES}
)
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${rtl_srcs})
-list(APPEND gr_osmosdr_libs ${LIBRTLSDR_LIBRARIES})
-
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/rtl_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/rtl_tcp/CMakeLists.txt b/lib/rtl_tcp/CMakeLists.txt
index 9fe9432..7acb614 100644
--- a/lib/rtl_tcp/CMakeLists.txt
+++ b/lib/rtl_tcp/CMakeLists.txt
@@ -21,17 +21,15 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
-set(rtl_tcp_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/rtl_tcp_source_c.cc
+target_link_libraries(gnuradio-osmosdr
+ ${Gnuradio-blocks_LIBRARIES}
)
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${rtl_tcp_srcs})
-#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})
-
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/rtl_tcp_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/sdrplay/CMakeLists.txt b/lib/sdrplay/CMakeLists.txt
index 5ed26b0..c310f5d 100644
--- a/lib/sdrplay/CMakeLists.txt
+++ b/lib/sdrplay/CMakeLists.txt
@@ -21,17 +21,16 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBSDRPLAY_INCLUDE_DIRS}
)
-set(sdrplay_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/sdrplay_source_c.cc
+target_link_libraries(gnuradio-osmosdr
+ ${LIBSDRPLAY_LIBRARIES}
)
-########################################################################
-# Append gnuradio-sdrplay library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${sdrplay_srcs})
-list(APPEND gr_osmosdr_libs ${LIBSDRPLAY_LIBRARIES})
+list(APPEND gr_osmosdr_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/sdrplay_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/soapy/CMakeLists.txt b/lib/soapy/CMakeLists.txt
index ded6c98..d2a725b 100644
--- a/lib/soapy/CMakeLists.txt
+++ b/lib/soapy/CMakeLists.txt
@@ -21,19 +21,18 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${SoapySDR_INCLUDE_DIRS}
)
-set(soapy_srcs
+target_link_libraries(gnuradio-osmosdr
+ ${SoapySDR_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/soapy_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/soapy_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/soapy_sink_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${soapy_srcs})
-list(APPEND gr_osmosdr_libs ${SoapySDR_LIBRARIES})
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/lib/uhd/CMakeLists.txt b/lib/uhd/CMakeLists.txt
index ab2c6f2..f9fb196 100644
--- a/lib/uhd/CMakeLists.txt
+++ b/lib/uhd/CMakeLists.txt
@@ -21,19 +21,19 @@
# This file included, use CMake directory variables
########################################################################
-include_directories(
+target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
- ${GNURADIO_UHD_INCLUDE_DIRS}
+ ${gnuradio-uhd_INCLUDE_DIRS}
${UHD_INCLUDE_DIRS}
)
-set(uhd_srcs
+target_link_libraries(gnuradio-osmosdr
+ gnuradio::gnuradio-uhd
+ ${UHD_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/uhd_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/uhd_source_c.cc
)
-
-########################################################################
-# Append gnuradio-osmosdr library sources
-########################################################################
-list(APPEND gr_osmosdr_srcs ${uhd_srcs})
-list(APPEND gr_osmosdr_libs ${GNURADIO_UHD_LIBRARIES} ${UHD_LIBRARIES})
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
diff --git a/python/__init__.py b/python/__init__.py
index c7310e1..1cb090f 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -22,8 +22,4 @@
This is the GNU Radio OsmoSDR module.
'''
-# import swig generated symbols into the osmosdr namespace
-from osmosdr_swig import *
-
-# import any pure python here
-#
+from .osmosdr_swig import *
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
index 2a19665..159f212 100644
--- a/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -21,7 +21,7 @@
# Include swig generation macros
########################################################################
find_package(SWIG)
-find_package(PythonLibs 2)
+find_package(PythonLibs 3)
if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
return()
endif()
@@ -31,13 +31,13 @@ include(GrPython)
########################################################################
# Setup swig generation
########################################################################
-foreach(incdir ${GNURADIO_ALL_INCLUDE_DIRS})
- list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
-endforeach(incdir)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:gnuradio::runtime_swig,INTERFACE_INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS gnuradio::runtime_swig)
set(GR_SWIG_LIBRARIES gnuradio-osmosdr)
+
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/osmosdr_swig_doc.i)
-set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/osmosdr)
GR_SWIG_MAKE(osmosdr_swig osmosdr_swig.i)