1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
########################################################################
# Build Soapy SDR support module for RTL-SDR Devices
########################################################################
cmake_minimum_required(VERSION 2.8.12...3.10)
project(SoapyRTLSDR CXX)
find_package(SoapySDR "0.4.0" NO_MODULE REQUIRED)
if (NOT SoapySDR_FOUND)
message(FATAL_ERROR "Soapy SDR development files not found...")
endif ()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(RTLSDR)
if (NOT RTLSDR_FOUND)
message(FATAL_ERROR "RTL-SDR development files not found...")
endif ()
message(STATUS "RTLSDR_INCLUDE_DIRS - ${RTLSDR_INCLUDE_DIRS}")
message(STATUS "RTLSDR_LIBRARIES - ${RTLSDR_LIBRARIES}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${RTLSDR_INCLUDE_DIRS})
# Test for Atomics
include(CheckAtomic)
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
set(ATOMIC_LIBS "atomic")
endif()
#enable c++11 features
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
#C++11 is a required language feature for this project
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_STD_CXX11)
if(HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else(HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
#Thread support enabled (not the same as -lpthread)
list(APPEND RTLSDR_LIBRARIES -pthread)
#disable warnings for unused parameters
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
endif()
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wc++11-extensions")
endif(APPLE)
# check if rtlsdr library includes support for bias-tee and dithering
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${RTLSDR_LIBRARIES})
check_function_exists(rtlsdr_set_bias_tee HAS_RTLSDR_SET_BIAS_TEE)
check_function_exists(rtlsdr_set_dithering HAS_RTLSDR_SET_DITHERING)
unset(CMAKE_REQUIRED_LIBRARIES)
if (HAS_RTLSDR_SET_BIAS_TEE)
add_definitions(-DHAS_RTLSDR_SET_BIAS_TEE)
endif()
if (HAS_RTLSDR_SET_DITHERING)
add_definitions(-DHAS_RTLSDR_SET_DITHERING)
endif()
set(OTHER_LIBS "" CACHE STRING "Other libraries")
SOAPY_SDR_MODULE_UTIL(
TARGET rtlsdrSupport
SOURCES
SoapyRTLSDR.hpp
Registration.cpp
Settings.cpp
Streaming.cpp
LIBRARIES
${RTLSDR_LIBRARIES}
${ATOMIC_LIBS}
${OTHER_LIBS}
)
########################################################################
# uninstall target
########################################################################
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
|