2020-09-19 10:48:34 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2020-10-24 13:33:00 +00:00
|
|
|
project(sdrpp)
|
2020-06-10 02:13:56 +00:00
|
|
|
|
2021-02-14 22:14:42 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX "/usr")
|
2021-02-11 22:32:56 +00:00
|
|
|
|
2020-12-22 13:50:26 +00:00
|
|
|
option(OPT_BUILD_RTL_TCP_SOURCE "Build RTL-TCP Source Module (no dependencies required)" ON)
|
2021-02-12 21:44:29 +00:00
|
|
|
option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" OFF)
|
2020-12-22 13:50:26 +00:00
|
|
|
option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Depedencies: soapysdr)" ON)
|
|
|
|
option(OPT_BUILD_AIRSPYHF_SOURCE "Build Airspy HF+ Source Module (Depedencies: libairspyhf)" ON)
|
2021-01-28 20:10:08 +00:00
|
|
|
option(OPT_BUILD_AIRSPY_SOURCE "Build Airspy Source Module (Depedencies: libairspy)" ON)
|
2021-03-20 20:53:44 +00:00
|
|
|
option(OPT_BUILD_BLADERF_SOURCE "Build BladeRF Source Module (Depedencies: libbladeRF)" OFF)
|
2021-02-12 21:44:29 +00:00
|
|
|
option(OPT_BUILD_SDRPLAY_SOURCE "Build SDRplay Source Module (Depedencies: libsdrplay)" OFF)
|
2020-12-22 13:50:26 +00:00
|
|
|
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Depedencies: libiio, libad9361)" ON)
|
2021-02-12 21:44:29 +00:00
|
|
|
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Depedencies: libhackrf)" OFF)
|
2021-02-13 19:43:29 +00:00
|
|
|
option(OPT_BUILD_RTL_SDR_SOURCE "Build HackRF Source Module (Depedencies: libhackrf)" ON)
|
2021-02-22 23:26:35 +00:00
|
|
|
option(OPT_BUILD_AUDIO_SINK "Build Audio Sink Module (Depedencies: rtaudio)" ON)
|
2021-03-21 18:51:38 +00:00
|
|
|
option(OPT_BUILD_FALCON9_DECODER "Build the falcon9 live decoder" OFF)
|
2020-12-08 03:36:37 +00:00
|
|
|
# Core of SDR++
|
2020-09-19 10:48:34 +00:00
|
|
|
add_subdirectory("core")
|
2020-12-08 03:36:37 +00:00
|
|
|
|
2020-12-22 13:50:26 +00:00
|
|
|
# Base modules
|
2020-09-19 10:48:34 +00:00
|
|
|
add_subdirectory("radio")
|
2020-10-01 11:46:12 +00:00
|
|
|
add_subdirectory("recorder")
|
2021-02-07 22:47:17 +00:00
|
|
|
add_subdirectory("file_source")
|
2020-12-22 13:50:26 +00:00
|
|
|
|
|
|
|
# Source modules
|
|
|
|
if (OPT_BUILD_RTL_TCP_SOURCE)
|
|
|
|
add_subdirectory("rtl_tcp_source")
|
|
|
|
endif (OPT_BUILD_RTL_TCP_SOURCE)
|
|
|
|
|
|
|
|
if (OPT_BUILD_SPYSERVER_SOURCE)
|
|
|
|
add_subdirectory("spyserver_source")
|
|
|
|
endif (OPT_BUILD_SPYSERVER_SOURCE)
|
|
|
|
|
|
|
|
if (OPT_BUILD_SOAPY_SOURCE)
|
2020-12-08 03:36:37 +00:00
|
|
|
add_subdirectory("soapy_source")
|
2020-12-22 13:50:26 +00:00
|
|
|
endif (OPT_BUILD_SOAPY_SOURCE)
|
|
|
|
|
|
|
|
if (OPT_BUILD_AIRSPYHF_SOURCE)
|
2020-12-15 22:05:11 +00:00
|
|
|
add_subdirectory("airspyhf_source")
|
2020-12-22 13:50:26 +00:00
|
|
|
endif (OPT_BUILD_AIRSPYHF_SOURCE)
|
|
|
|
|
2021-01-28 20:10:08 +00:00
|
|
|
if (OPT_BUILD_AIRSPY_SOURCE)
|
|
|
|
add_subdirectory("airspy_source")
|
|
|
|
endif (OPT_BUILD_AIRSPY_SOURCE)
|
|
|
|
|
2021-03-20 20:53:44 +00:00
|
|
|
if (OPT_BUILD_BLADERF_SOURCE)
|
|
|
|
add_subdirectory("bladerf_source")
|
|
|
|
endif(OPT_BUILD_BLADERF_SOURCE)
|
|
|
|
|
2021-02-10 20:35:56 +00:00
|
|
|
if (OPT_BUILD_SDRPLAY_SOURCE)
|
|
|
|
add_subdirectory("sdrplay_source")
|
|
|
|
endif (OPT_BUILD_SDRPLAY_SOURCE)
|
|
|
|
|
2020-12-22 13:50:26 +00:00
|
|
|
if (OPT_BUILD_PLUTOSDR_SOURCE)
|
2020-11-25 20:52:37 +00:00
|
|
|
add_subdirectory("plutosdr_source")
|
2020-12-22 13:50:26 +00:00
|
|
|
endif (OPT_BUILD_PLUTOSDR_SOURCE)
|
|
|
|
|
2020-12-25 23:42:15 +00:00
|
|
|
if (OPT_BUILD_HACKRF_SOURCE)
|
|
|
|
add_subdirectory("hackrf_source")
|
|
|
|
endif (OPT_BUILD_HACKRF_SOURCE)
|
|
|
|
|
2021-02-13 19:43:29 +00:00
|
|
|
if (OPT_BUILD_RTL_SDR_SOURCE)
|
|
|
|
add_subdirectory("rtl_sdr_source")
|
|
|
|
endif (OPT_BUILD_RTL_SDR_SOURCE)
|
|
|
|
|
2020-12-22 13:50:26 +00:00
|
|
|
if (OPT_BUILD_AUDIO_SINK)
|
|
|
|
add_subdirectory("audio_sink")
|
|
|
|
endif (OPT_BUILD_AUDIO_SINK)
|
2020-09-06 13:39:09 +00:00
|
|
|
|
2021-03-21 18:51:38 +00:00
|
|
|
if (OPT_BUILD_FALCON9_DECODER)
|
|
|
|
add_subdirectory("falcon9_decoder")
|
|
|
|
endif (OPT_BUILD_FALCON9_DECODER)
|
|
|
|
|
2020-10-07 20:44:54 +00:00
|
|
|
if (MSVC)
|
2020-12-12 04:34:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
|
2020-10-07 20:44:54 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
|
|
|
|
endif (MSVC)
|
|
|
|
|
2020-09-19 10:48:34 +00:00
|
|
|
add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
|
|
|
|
target_link_libraries(sdrpp PRIVATE sdrpp_core)
|
2020-06-22 14:45:57 +00:00
|
|
|
|
2020-09-19 10:48:34 +00:00
|
|
|
# Copy dynamic libs over
|
2020-08-16 01:39:05 +00:00
|
|
|
if (MSVC)
|
2020-09-19 10:48:34 +00:00
|
|
|
add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
|
2020-10-23 09:06:10 +00:00
|
|
|
add_custom_target(do_always_volk ALL xcopy /s \"C:/Program Files/PothosSDR/bin\\volk.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
|
2020-07-19 22:43:36 +00:00
|
|
|
endif (MSVC)
|
2020-07-19 13:59:44 +00:00
|
|
|
|
2020-10-24 15:09:25 +00:00
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
2020-10-24 15:34:18 +00:00
|
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
2020-10-24 15:09:25 +00:00
|
|
|
endif ()
|
|
|
|
|
2021-02-17 15:59:30 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
target_link_libraries(sdrpp PUBLIC pthread)
|
|
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
|
|
|
endif ()
|
|
|
|
|
2020-10-22 00:28:43 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2020-10-24 15:34:18 +00:00
|
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
2020-10-22 00:28:43 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2020-10-24 15:34:18 +00:00
|
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.dylib\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
2020-10-22 00:28:43 +00:00
|
|
|
endif ()
|
|
|
|
|
2021-03-21 18:51:38 +00:00
|
|
|
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|
2021-02-11 21:49:33 +00:00
|
|
|
|
|
|
|
# Install directives
|
|
|
|
install(TARGETS sdrpp DESTINATION bin)
|
|
|
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/bandplans DESTINATION share/sdrpp)
|
|
|
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/colormaps DESTINATION share/sdrpp)
|
|
|
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/fonts DESTINATION share/sdrpp)
|
|
|
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/icons DESTINATION share/sdrpp)
|
2021-02-11 23:03:30 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/sdrpp.desktop ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop @ONLY)
|
2021-02-11 23:18:20 +00:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop DESTINATION /usr/share/applications)
|
2021-02-11 21:49:33 +00:00
|
|
|
|
|
|
|
# Create uninstall target
|
2021-02-11 23:03:30 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
|
2021-02-17 15:59:30 +00:00
|
|
|
add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|