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
########################################################################
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,170 +36,215 @@ 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_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(CMAKE_CXX_COMPILER MATCHES ".*clang")
SET(CMAKE_COMPILER_IS_CLANGXX 1)
ENDIF()
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()
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()
# 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()
# 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()
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()
########################################################################
# Setup boost
# Find 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(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})
find_package(Boost "1.65" REQUIRED chrono thread system)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME})
message(FATAL_ERROR "Boost required to compile osmosdr")
endif()
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
########################################################################
# Find build dependencies and setup options
########################################################################
########################################################################
# 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)
include(GrComponent)
########################################################################
# 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()
set(ENABLE_NONFREE FALSE CACHE BOOL "Enable or disable nonfree components.")
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(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()
# Python
##########
########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/lib
${Boost_INCLUDE_DIRS}
${GNURADIO_ALL_INCLUDE_DIRS}
find_package(PythonLibs 3)
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)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
)
link_directories(
${Boost_LIBRARY_DIRS}
${GNURADIO_ALL_LIBRARY_DIRS}
)
########################################################################
# Install directories
########################################################################
include(GrPlatform) #define LIB_SUFFIX
# 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)
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
@ -208,28 +256,7 @@ configure_file(
add_custom_target(uninstall
${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
@ -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}")

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
########################################################################
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)

View File

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

View File

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

View File

@ -21,29 +21,29 @@
# This file included, use CMake directory variables
########################################################################
include_directories(${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
target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
########################################################################
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${fcd_srcs})
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)
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)
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
########################################################################
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)

View File

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

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
########################################################################
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)
#######