build: Update build system to GR 3.8 standards

Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2019-12-08 16:05:07 +01:00
parent e9890283ca
commit 5d59e56ff9
22 changed files with 403 additions and 502 deletions

View File

@ -20,11 +20,14 @@
######################################################################## ########################################################################
# Project setup # Project setup
######################################################################## ########################################################################
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 3.8)
include(GNUInstallDirs)
project(gr-osmosdr CXX C) project(gr-osmosdr CXX C)
enable_testing() 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 #select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
@ -33,170 +36,215 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") 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 the version information here
set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_MAJOR 0)
set(VERSION_INFO_API_COMPAT 1) set(VERSION_API 2)
set(VERSION_INFO_MINOR_VERSION 5) set(VERSION_ABI 0)
set(VERSION_INFO_MAINT_VERSION 0) set(VERSION_PATCH 0)
include(GrVersion) #setup version info include(GrVersion) #setup version info
######################################################################## ########################################################################
# Compiler specific setup # Compiler specific setup
######################################################################## ########################################################################
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86") if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions") CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
ELSE() AND NOT WIN32)
SET(USE_SIMD "no" CACHE STRING "Use SIMD instructions") #http://gcc.gnu.org/wiki/Visibility
ENDIF() add_definitions(-fvisibility=hidden)
SET(USE_SIMD_VALUES "no" "SSE2" "AVX") add_definitions(-fvisibility-inlines-hidden)
SET_PROPERTY(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES}) endif()
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") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_COMPILER_IS_CLANGXX 1) set(CMAKE_CXX_STANDARD 11)
ENDIF() 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()
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) # Misc options
ADD_DEFINITIONS(-Wall) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
ADD_DEFINITIONS(-Wextra) CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
ADD_DEFINITIONS(-Wno-unused-parameter) add_definitions(-Wall)
ADD_DEFINITIONS(-Wsign-compare) add_definitions(-Wextra)
#ADD_DEFINITIONS(-Wconversion) add_definitions(-Wno-unused-parameter)
#ADD_DEFINITIONS(-pedantic) add_definitions(-Wsign-compare)
#ADD_DEFINITIONS(-ansi) #add_definitions(-Wconversion)
IF(NOT WIN32) #add_definitions(-pedantic)
#only export symbols that are declared to be part of the api (non dll platforms) #add_definitions(-ansi)
ADD_DEFINITIONS(-fvisibility=hidden) endif()
ADD_DEFINITIONS(-fvisibility-inlines-hidden)
ENDIF(NOT WIN32) # SIMD
IF(USE_SIMD MATCHES SSE2) if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
ADD_DEFINITIONS(-msse2) set(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
ADD_DEFINITIONS(-DUSE_SSE2) else()
ENDIF() set(USE_SIMD "no" CACHE STRING "Use SIMD instructions")
IF(USE_SIMD MATCHES AVX) endif()
ADD_DEFINITIONS(-march=native) set(USE_SIMD_VALUES "no" "SSE2" "AVX")
ADD_DEFINITIONS(-DUSE_AVX) set_property(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES})
ENDIF() list(FIND USE_SIMD_VALUES ${USE_SIMD} USE_SIMD_INDEX)
ELSEIF(MSVC) if(${USE_SIMD_INDEX} EQUAL -1)
IF(USE_SIMD MATCHES SSE2) message(FATAL_ERROR "Option ${USE_SIMD} not supported, valid entries are ${USE_SIMD_VALUES}")
ADD_DEFINITIONS(/arch:SSE2) endif()
ADD_DEFINITIONS(-DUSE_SSE2)
ENDIF() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
IF(USE_SIMD MATCHES AVX) CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
ADD_DEFINITIONS(/arch:AVX) if(USE_SIMD MATCHES SSE2)
ADD_DEFINITIONS(-DUSE_AVX) add_definitions(-msse2)
ENDIF() add_definitions(-DUSE_SSE2)
ENDIF() 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()
######################################################################## ########################################################################
# Setup boost # Find boost
######################################################################## ########################################################################
MESSAGE(STATUS "Configuring Boost C++ Libraries...") find_package(Boost "1.65" REQUIRED chrono thread system)
# Although not required on my system, some users have linking issues without
SET(BOOST_REQUIRED_COMPONENTS
thread
system
)
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"
)
find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
if(NOT Boost_FOUND) if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME}) message(FATAL_ERROR "Boost required to compile osmosdr")
endif() endif()
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) ########################################################################
# Find build dependencies and setup options
########################################################################
######################################################################## include(GrComponent)
# Install directories
########################################################################
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})
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)
######################################################################## set(ENABLE_NONFREE FALSE CACHE BOOL "Enable or disable nonfree components.")
# Find build dependencies
########################################################################
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)
# 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(UHD)
find_package(GnuradioUHD) message (STATUS " Found UHD Driver: ${UHD_FOUND}")
find_package(GnuradioFCD)
find_package(GnuradioFCDPP) 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(LibOsmoSDR)
find_package(LibRTLSDR) find_package(LibRTLSDR)
find_package(LibMiriSDR) find_package(LibMiriSDR)
if(ENABLE_NONFREE) if(ENABLE_NONFREE)
find_package(LibSDRplay) find_package(LibSDRplay)
endif(ENABLE_NONFREE) endif(ENABLE_NONFREE)
find_package(LibHackRF) find_package(LibHackRF)
find_package(LibAIRSPY) find_package(LibAIRSPY)
find_package(Volk)
find_package(LibbladeRF) find_package(LibbladeRF)
find_package(SoapySDR NO_MODULE) find_package(SoapySDR NO_MODULE)
find_package(LibFreeSRP) find_package(LibFreeSRP)
find_package(Doxygen) find_package(Doxygen)
if(NOT GNURADIO_RUNTIME_FOUND) # Python
message(FATAL_ERROR "GnuRadio Runtime required to build " ${CMAKE_PROJECT_NAME}) ##########
endif()
######################################################################## find_package(PythonLibs 3)
# Setup the include and linker paths find_package(SWIG)
########################################################################
include_directories( if(SWIG_FOUND)
${CMAKE_SOURCE_DIR}/include message(STATUS "Minimum SWIG version required is 1.3.31")
${CMAKE_SOURCE_DIR}/lib set(SWIG_VERSION_CHECK FALSE)
${Boost_INCLUDE_DIRS} if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
${GNURADIO_ALL_INCLUDE_DIRS} set(SWIG_VERSION_CHECK TRUE)
endif()
endif(SWIG_FOUND)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
) )
link_directories( ########################################################################
${Boost_LIBRARY_DIRS} # Install directories
${GNURADIO_ALL_LIBRARY_DIRS} ########################################################################
) include(GrPlatform) #define LIB_SUFFIX
# Set component parameters if(NOT CMAKE_MODULES_DIR)
set(GR_OSMOSDR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
set(GR_OSMOSDR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) 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 # Create uninstall target
@ -208,28 +256,7 @@ configure_file(
add_custom_target(uninstall add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
) )
########################################################################
# Enable python component
########################################################################
find_package(PythonLibs 2)
find_package(SWIG)
if(SWIG_FOUND)
message(STATUS "Minimum SWIG version required is 1.3.31")
set(SWIG_VERSION_CHECK FALSE)
if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
set(SWIG_VERSION_CHECK TRUE)
endif()
endif(SWIG_FOUND)
include(GrComponent)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
)
######################################################################## ########################################################################
# Add subdirectories # Add subdirectories
@ -240,57 +267,20 @@ if(ENABLE_PYTHON)
add_subdirectory(swig) add_subdirectory(swig)
add_subdirectory(python) add_subdirectory(python)
add_subdirectory(grc) add_subdirectory(grc)
add_subdirectory(apps) #Apps not ported to Qt
#add_subdirectory(apps)
endif(ENABLE_PYTHON) endif(ENABLE_PYTHON)
add_subdirectory(docs) 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 # Print Summary
######################################################################## ########################################################################
GR_PRINT_COMPONENT_SUMMARY() GR_PRINT_COMPONENT_SUMMARY()
if(ENABLE_NONFREE) if(ENABLE_NONFREE)
MESSAGE(STATUS MESSAGE(STATUS
"NONFREE components have been enabled. The resulting "NONFREE components have been enabled. The resulting
binaries cannot be distributed under GPL terms. binaries cannot be distributed under GPL terms.
" ")
)
endif(ENABLE_NONFREE) endif(ENABLE_NONFREE)
MESSAGE(STATUS "Building for version: ${VERSION} / ${LIBVER}") MESSAGE(STATUS "Building for version: ${VERSION} / ${LIBVER}")

View File

@ -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")

View File

@ -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@

View File

@ -20,22 +20,13 @@
######################################################################## ########################################################################
# Setup library # Setup library
######################################################################## ########################################################################
INCLUDE(GrPlatform) #define LIB_SUFFIX include(GrPlatform) #define LIB_SUFFIX
INCLUDE(GrMiscUtils)
INCLUDE(GrComponent)
######################################################################## ########################################################################
# 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_srcs
LIST(APPEND gr_osmosdr_libs ${ARGV})
ENDMACRO(GR_OSMOSDR_APPEND_LIBS)
GR_OSMOSDR_APPEND_SRCS(
source_impl.cc source_impl.cc
sink_impl.cc sink_impl.cc
ranges.cc ranges.cc
@ -49,19 +40,30 @@ if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND Boost_LIBRARIES -pthread) list(APPEND Boost_LIBRARIES -pthread)
endif() endif()
GR_OSMOSDR_APPEND_LIBS( add_library(gnuradio-osmosdr SHARED)
${Boost_LIBRARIES} target_link_libraries(gnuradio-osmosdr ${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
${GNURADIO_ALL_LIBRARIES} 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 # Setup defines for high resolution timing
######################################################################## ########################################################################
MESSAGE(STATUS "") message(STATUS "")
MESSAGE(STATUS "Configuring high resolution timing...") message(STATUS "Configuring high resolution timing...")
INCLUDE(CheckCXXSourceCompiles) include(CheckCXXSourceCompiles)
SET(CMAKE_REQUIRED_LIBRARIES -lrt) set(CMAKE_REQUIRED_LIBRARIES -lrt)
CHECK_CXX_SOURCE_COMPILES(" CHECK_CXX_SOURCE_COMPILES("
#include <ctime> #include <ctime>
int main(){ int main(){
@ -70,9 +72,9 @@ CHECK_CXX_SOURCE_COMPILES("
} }
" HAVE_CLOCK_GETTIME " HAVE_CLOCK_GETTIME
) )
UNSET(CMAKE_REQUIRED_LIBRARIES) unset(CMAKE_REQUIRED_LIBRARIES)
INCLUDE(CheckCXXSourceCompiles) include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(" CHECK_CXX_SOURCE_COMPILES("
#include <mach/mach_time.h> #include <mach/mach_time.h>
int main(){ int main(){
@ -95,22 +97,22 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_QUERY_PERFORMANCE_COUNTER " HAVE_QUERY_PERFORMANCE_COUNTER
) )
IF(HAVE_CLOCK_GETTIME) if(HAVE_CLOCK_GETTIME)
MESSAGE(STATUS " High resolution timing supported through clock_gettime.") message(STATUS " High resolution timing supported through clock_gettime.")
SET(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME) set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
GR_OSMOSDR_APPEND_LIBS("-lrt") target_link_libraries(gnuradio-osmosdr "-lrt")
ELSEIF(HAVE_MACH_ABSOLUTE_TIME) elseif(HAVE_MACH_ABSOLUTE_TIME)
MESSAGE(STATUS " High resolution timing supported through mach_absolute_time.") message(STATUS " High resolution timing supported through mach_absolute_time.")
SET(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME) set(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME)
ELSEIF(HAVE_QUERY_PERFORMANCE_COUNTER) elseif(HAVE_QUERY_PERFORMANCE_COUNTER)
MESSAGE(STATUS " High resolution timing supported through QueryPerformanceCounter.") message(STATUS " High resolution timing supported through QueryPerformanceCounter.")
SET(TIME_SPEC_DEFS HAVE_QUERY_PERFORMANCE_COUNTER) set(TIME_SPEC_DEFS HAVE_QUERY_PERFORMANCE_COUNTER)
ELSE() else()
MESSAGE(STATUS " High resolution timing supported through microsec_clock.") message(STATUS " High resolution timing supported through microsec_clock.")
SET(TIME_SPEC_DEFS HAVE_MICROSEC_CLOCK) set(TIME_SPEC_DEFS HAVE_MICROSEC_CLOCK)
ENDIF() endif()
SET_SOURCE_FILES_PROPERTIES( set_source_files_properties(
time_spec.cc time_spec.cc
PROPERTIES COMPILE_DEFINITIONS "${TIME_SPEC_DEFS}" PROPERTIES COMPILE_DEFINITIONS "${TIME_SPEC_DEFS}"
) )
@ -118,11 +120,11 @@ SET_SOURCE_FILES_PROPERTIES(
######################################################################## ########################################################################
# Setup IQBalance component # 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) if(ENABLE_IQBALANCE)
add_definitions(-DHAVE_IQBALANCE=1) add_definitions(-DHAVE_IQBALANCE=1)
include_directories(${GNURADIO_IQBALANCE_INCLUDE_DIRS}) target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS})
GR_OSMOSDR_APPEND_LIBS(${GNURADIO_IQBALANCE_LIBRARIES}) target_link_libraries(gnuradio-osmosdr gnuradio::gnuradio-iqbalance)
endif(ENABLE_IQBALANCE) endif(ENABLE_IQBALANCE)
######################################################################## ########################################################################
@ -130,30 +132,15 @@ endif(ENABLE_IQBALANCE)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("sysmocom OsmoSDR" ENABLE_OSMOSDR LIBOSMOSDR_FOUND) GR_REGISTER_COMPONENT("sysmocom OsmoSDR" ENABLE_OSMOSDR LIBOSMOSDR_FOUND)
if(ENABLE_OSMOSDR) if(ENABLE_OSMOSDR)
GR_INCLUDE_SUBDIRECTORY(osmosdr) add_subdirectory(osmosdr)
endif(ENABLE_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 # 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) if(ENABLE_FILE)
GR_INCLUDE_SUBDIRECTORY(file) add_subdirectory(file)
endif(ENABLE_FILE) endif(ENABLE_FILE)
######################################################################## ########################################################################
@ -161,23 +148,23 @@ endif(ENABLE_FILE)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("Osmocom RTLSDR" ENABLE_RTL LIBRTLSDR_FOUND) GR_REGISTER_COMPONENT("Osmocom RTLSDR" ENABLE_RTL LIBRTLSDR_FOUND)
if(ENABLE_RTL) if(ENABLE_RTL)
GR_INCLUDE_SUBDIRECTORY(rtl) add_subdirectory(rtl)
endif(ENABLE_RTL) endif(ENABLE_RTL)
######################################################################## ########################################################################
# Setup RTL_TCP component # 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) if(ENABLE_RTL_TCP)
GR_INCLUDE_SUBDIRECTORY(rtl_tcp) add_subdirectory(rtl_tcp)
endif(ENABLE_RTL_TCP) endif(ENABLE_RTL_TCP)
######################################################################## ########################################################################
# Setup UHD component # 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) if(ENABLE_UHD)
GR_INCLUDE_SUBDIRECTORY(uhd) add_subdirectory(uhd)
endif(ENABLE_UHD) endif(ENABLE_UHD)
######################################################################## ########################################################################
@ -185,7 +172,7 @@ endif(ENABLE_UHD)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND) GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND)
if(ENABLE_MIRI) if(ENABLE_MIRI)
GR_INCLUDE_SUBDIRECTORY(miri) add_subdirectory(miri)
endif(ENABLE_MIRI) endif(ENABLE_MIRI)
######################################################################## ########################################################################
@ -194,7 +181,7 @@ endif(ENABLE_MIRI)
if(ENABLE_NONFREE) if(ENABLE_NONFREE)
GR_REGISTER_COMPONENT("SDRplay RSP (NONFREE)" ENABLE_SDRPLAY LIBSDRPLAY_FOUND) GR_REGISTER_COMPONENT("SDRplay RSP (NONFREE)" ENABLE_SDRPLAY LIBSDRPLAY_FOUND)
if(ENABLE_SDRPLAY) if(ENABLE_SDRPLAY)
GR_INCLUDE_SUBDIRECTORY(sdrplay) add_subdirectory(sdrplay)
endif(ENABLE_SDRPLAY) endif(ENABLE_SDRPLAY)
endif(ENABLE_NONFREE) endif(ENABLE_NONFREE)
@ -203,7 +190,7 @@ endif(ENABLE_NONFREE)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("HackRF & rad1o Badge" ENABLE_HACKRF LIBHACKRF_FOUND) GR_REGISTER_COMPONENT("HackRF & rad1o Badge" ENABLE_HACKRF LIBHACKRF_FOUND)
if(ENABLE_HACKRF) if(ENABLE_HACKRF)
GR_INCLUDE_SUBDIRECTORY(hackrf) add_subdirectory(hackrf)
endif(ENABLE_HACKRF) endif(ENABLE_HACKRF)
######################################################################## ########################################################################
@ -211,7 +198,7 @@ endif(ENABLE_HACKRF)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("nuand bladeRF" ENABLE_BLADERF LIBBLADERF_FOUND) GR_REGISTER_COMPONENT("nuand bladeRF" ENABLE_BLADERF LIBBLADERF_FOUND)
if(ENABLE_BLADERF) if(ENABLE_BLADERF)
GR_INCLUDE_SUBDIRECTORY(bladerf) add_subdirectory(bladerf)
endif(ENABLE_BLADERF) endif(ENABLE_BLADERF)
######################################################################## ########################################################################
@ -219,7 +206,7 @@ endif(ENABLE_BLADERF)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE) GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE)
if(ENABLE_RFSPACE) if(ENABLE_RFSPACE)
GR_INCLUDE_SUBDIRECTORY(rfspace) add_subdirectory(rfspace)
endif(ENABLE_RFSPACE) endif(ENABLE_RFSPACE)
######################################################################## ########################################################################
@ -227,7 +214,7 @@ endif(ENABLE_RFSPACE)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("AIRSPY Receiver" ENABLE_AIRSPY LIBAIRSPY_FOUND) GR_REGISTER_COMPONENT("AIRSPY Receiver" ENABLE_AIRSPY LIBAIRSPY_FOUND)
if(ENABLE_AIRSPY) if(ENABLE_AIRSPY)
GR_INCLUDE_SUBDIRECTORY(airspy) add_subdirectory(airspy)
endif(ENABLE_AIRSPY) endif(ENABLE_AIRSPY)
######################################################################## ########################################################################
@ -235,7 +222,7 @@ endif(ENABLE_AIRSPY)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("SoapySDR support" ENABLE_SOAPY SoapySDR_FOUND) GR_REGISTER_COMPONENT("SoapySDR support" ENABLE_SOAPY SoapySDR_FOUND)
if(ENABLE_SOAPY) if(ENABLE_SOAPY)
GR_INCLUDE_SUBDIRECTORY(soapy) add_subdirectory(soapy)
endif(ENABLE_SOAPY) endif(ENABLE_SOAPY)
######################################################################## ########################################################################
@ -243,7 +230,7 @@ endif(ENABLE_SOAPY)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("Red Pitaya SDR" ENABLE_REDPITAYA) GR_REGISTER_COMPONENT("Red Pitaya SDR" ENABLE_REDPITAYA)
if(ENABLE_REDPITAYA) if(ENABLE_REDPITAYA)
GR_INCLUDE_SUBDIRECTORY(redpitaya) add_subdirectory(redpitaya)
endif(ENABLE_REDPITAYA) endif(ENABLE_REDPITAYA)
######################################################################## ########################################################################
@ -251,37 +238,26 @@ endif(ENABLE_REDPITAYA)
######################################################################## ########################################################################
GR_REGISTER_COMPONENT("FreeSRP support" ENABLE_FREESRP LIBFREESRP_FOUND) GR_REGISTER_COMPONENT("FreeSRP support" ENABLE_FREESRP LIBFREESRP_FOUND)
if(ENABLE_FREESRP) if(ENABLE_FREESRP)
GR_INCLUDE_SUBDIRECTORY(freesrp) add_subdirectory(freesrp)
endif(ENABLE_FREESRP) endif(ENABLE_FREESRP)
######################################################################## ########################################################################
# Setup configuration file # Setup configuration file
######################################################################## ########################################################################
ADD_DEFINITIONS(-DHAVE_CONFIG_H=1) add_definitions(-DHAVE_CONFIG_H=1)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
CONFIGURE_FILE( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h ${CMAKE_CURRENT_BINARY_DIR}/config.h
@ONLY) @ONLY)
######################################################################## ########################################################################
# Set up Windows DLL resource files # Finalize target
######################################################################## ########################################################################
IF(MSVC) set_target_properties(gnuradio-osmosdr PROPERTIES SOURCES "${gr_osmosdr_srcs}")
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)
######################################################################## ########################################################################
# Setup libgnuradio-osmosdr library # Install built library files
######################################################################## ########################################################################
ADD_LIBRARY(gnuradio-osmosdr SHARED ${gr_osmosdr_srcs}) include(GrMiscUtils)
TARGET_LINK_LIBRARIES(gnuradio-osmosdr ${gr_osmosdr_libs})
SET_TARGET_PROPERTIES(gnuradio-osmosdr PROPERTIES DEFINE_SYMBOL "gnuradio_osmosdr_EXPORTS")
GR_LIBRARY_FOO(gnuradio-osmosdr) GR_LIBRARY_FOO(gnuradio-osmosdr)

View File

@ -21,17 +21,18 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBAIRSPY_INCLUDE_DIRS} ${LIBAIRSPY_INCLUDE_DIRS}
) )
set(airspy_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/airspy_source_c.cc gnuradio::filter
${Gnuradio-blocks_LIBRARIES}
${LIBAIRSPY_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-osmosdr library sources ${CMAKE_CURRENT_SOURCE_DIR}/airspy_source_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${airspy_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
list(APPEND gr_osmosdr_libs ${LIBAIRSPY_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -21,20 +21,20 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBBLADERF_INCLUDE_DIRS} ${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_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/bladerf_sink_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/bladerf_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/bladerf_common.cc ${CMAKE_CURRENT_SOURCE_DIR}/bladerf_common.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${bladerf_srcs})
list(APPEND gr_osmosdr_libs ${LIBBLADERF_LIBRARIES} ${VOLK_LIBRARIES})

View File

@ -21,29 +21,29 @@
# This file included, use CMake directory variables # 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})
endif(ENABLE_FCD)
if(ENABLE_FCDPP)
include_directories(${GNURADIO_FCDPP_INCLUDE_DIRS})
endif(ENABLE_FCDPP)
set(fcd_srcs
${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc
) )
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${fcd_srcs})
if(ENABLE_FCD) if(ENABLE_FCD)
list(APPEND gr_osmosdr_libs ${GNURADIO_FCD_LIBRARIES}) target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcd_INCLUDE_DIRS}
)
target_link_libraries(gnuradio-osmosdr PRIVATE
${Gnuradio-fcd_LIBRARIES}
)
endif(ENABLE_FCD) endif(ENABLE_FCD)
if(ENABLE_FCDPP) if(ENABLE_FCDPP)
list(APPEND gr_osmosdr_libs ${GNURADIO_FCDPP_LIBRARIES}) target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcdpp_INCLUDE_DIRS}
)
target_link_libraries(gnuradio-osmosdr PRIVATE
${Gnuradio-fcdpp_LIBRARIES}
)
endif(ENABLE_FCDPP) endif(ENABLE_FCDPP)
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc
)
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)

View File

@ -21,18 +21,17 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${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_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/file_sink_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/file_sink_c.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${file_srcs})
#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -21,19 +21,18 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBFREESRP_INCLUDE_DIRS} ${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_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/freesrp_source_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/freesrp_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/freesrp_sink_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/freesrp_sink_c.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${freesrp_srcs})
list(APPEND gr_osmosdr_libs ${LIBFREESRP_LIBRARIES})

View File

@ -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

View File

@ -21,27 +21,26 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBHACKRF_INCLUDE_DIRS} ${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_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/hackrf_sink_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}) set(CMAKE_REQUIRED_LIBRARIES ${LIBHACKRF_LIBRARIES})
CHECK_FUNCTION_EXISTS(hackrf_device_list LIBHACKRF_HAVE_DEVICE_LIST) CHECK_FUNCTION_EXISTS(hackrf_device_list LIBHACKRF_HAVE_DEVICE_LIST)
if(LIBHACKRF_HAVE_DEVICE_LIST) if(LIBHACKRF_HAVE_DEVICE_LIST)
message(STATUS "HackRF multiple device support enabled") 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) endif(LIBHACKRF_HAVE_DEVICE_LIST)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${hackrf_srcs})
list(APPEND gr_osmosdr_libs ${LIBHACKRF_LIBRARIES})

View File

@ -21,17 +21,16 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBMIRISDR_INCLUDE_DIRS} ${LIBMIRISDR_INCLUDE_DIRS}
) )
set(mirisdr_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/miri_source_c.cc ${LIBMIRISDR_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-mirisdr library sources ${CMAKE_CURRENT_SOURCE_DIR}/miri_source_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${mirisdr_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
list(APPEND gr_osmosdr_libs ${LIBMIRISDR_LIBRARIES})

View File

@ -21,17 +21,16 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBOSMOSDR_INCLUDE_DIRS} ${LIBOSMOSDR_INCLUDE_DIRS}
) )
set(osmosdr_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/osmosdr_src_c.cc ${LIBOSMOSDR_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-osmosdr library sources ${CMAKE_CURRENT_SOURCE_DIR}/osmosdr_src_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${osmosdr_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
list(APPEND gr_osmosdr_libs ${LIBOSMOSDR_LIBRARIES})

View File

@ -21,18 +21,17 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${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_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_sink_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_common.cc ${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_common.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${redpitaya_srcs})
#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -21,17 +21,11 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
set(rfspace_srcs list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/rfspace_source_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/rfspace_source_c.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${rfspace_srcs})
#list(APPEND gr_osmosdr_libs ...)

View File

@ -21,18 +21,16 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBRTLSDR_INCLUDE_DIRS} ${LIBRTLSDR_INCLUDE_DIRS}
) )
set(rtl_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/rtl_source_c.cc ${LIBRTLSDR_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-osmosdr library sources ${CMAKE_CURRENT_SOURCE_DIR}/rtl_source_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${rtl_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
list(APPEND gr_osmosdr_libs ${LIBRTLSDR_LIBRARIES})

View File

@ -21,17 +21,15 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
set(rtl_tcp_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/rtl_tcp_source_c.cc ${Gnuradio-blocks_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-osmosdr library sources ${CMAKE_CURRENT_SOURCE_DIR}/rtl_tcp_source_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${rtl_tcp_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -21,17 +21,16 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${LIBSDRPLAY_INCLUDE_DIRS} ${LIBSDRPLAY_INCLUDE_DIRS}
) )
set(sdrplay_srcs target_link_libraries(gnuradio-osmosdr
${CMAKE_CURRENT_SOURCE_DIR}/sdrplay_source_c.cc ${LIBSDRPLAY_LIBRARIES}
) )
######################################################################## list(APPEND gr_osmosdr_srcs
# Append gnuradio-sdrplay library sources ${CMAKE_CURRENT_SOURCE_DIR}/sdrplay_source_c.cc
######################################################################## )
list(APPEND gr_osmosdr_srcs ${sdrplay_srcs}) set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
list(APPEND gr_osmosdr_libs ${LIBSDRPLAY_LIBRARIES})

View File

@ -21,19 +21,18 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${SoapySDR_INCLUDE_DIRS} ${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_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/soapy_source_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/soapy_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/soapy_sink_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/soapy_sink_c.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${soapy_srcs})
list(APPEND gr_osmosdr_libs ${SoapySDR_LIBRARIES})

View File

@ -21,19 +21,19 @@
# This file included, use CMake directory variables # This file included, use CMake directory variables
######################################################################## ########################################################################
include_directories( target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${GNURADIO_UHD_INCLUDE_DIRS} ${gnuradio-uhd_INCLUDE_DIRS}
${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_sink_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/uhd_source_c.cc ${CMAKE_CURRENT_SOURCE_DIR}/uhd_source_c.cc
) )
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${uhd_srcs})
list(APPEND gr_osmosdr_libs ${GNURADIO_UHD_LIBRARIES} ${UHD_LIBRARIES})

View File

@ -22,8 +22,4 @@
This is the GNU Radio OsmoSDR module. This is the GNU Radio OsmoSDR module.
''' '''
# import swig generated symbols into the osmosdr namespace from .osmosdr_swig import *
from osmosdr_swig import *
# import any pure python here
#

View File

@ -21,7 +21,7 @@
# Include swig generation macros # Include swig generation macros
######################################################################## ########################################################################
find_package(SWIG) find_package(SWIG)
find_package(PythonLibs 2) find_package(PythonLibs 3)
if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
return() return()
endif() endif()
@ -31,13 +31,13 @@ include(GrPython)
######################################################################## ########################################################################
# Setup swig generation # Setup swig generation
######################################################################## ########################################################################
foreach(incdir ${GNURADIO_ALL_INCLUDE_DIRS}) set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:gnuradio::runtime_swig,INTERFACE_INCLUDE_DIRECTORIES>)
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) set(GR_SWIG_TARGET_DEPS gnuradio::runtime_swig)
endforeach(incdir)
set(GR_SWIG_LIBRARIES gnuradio-osmosdr) set(GR_SWIG_LIBRARIES gnuradio-osmosdr)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/osmosdr_swig_doc.i) 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) GR_SWIG_MAKE(osmosdr_swig osmosdr_swig.i)