SDRPlusPlus/CMakeLists.txt

193 lines
6.8 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.13)
2020-10-24 15:33:00 +02:00
project(sdrpp)
2020-06-10 04:13:56 +02:00
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_PREFIX "/usr/local")
else()
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
2021-06-28 02:22:51 +02:00
# Sources
option(OPT_BUILD_AIRSPY_SOURCE "Build Airspy Source Module (Depedencies: libairspy)" ON)
2021-06-28 02:22:51 +02:00
option(OPT_BUILD_AIRSPYHF_SOURCE "Build Airspy HF+ Source Module (Depedencies: libairspyhf)" ON)
option(OPT_BUILD_BLADERF_SOURCE "Build BladeRF Source Module (Depedencies: libbladeRF)" OFF)
option(OPT_BUILD_FILE_SOURCE "Wav file source" ON)
2021-04-13 18:35:31 +02:00
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Depedencies: libhackrf)" ON)
2021-06-28 02:22:51 +02:00
option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Depedencies: liblimesuite)" OFF)
2021-05-13 17:31:40 +02:00
option(OPT_BUILD_SDDC_SOURCE "Build SDDC Source Module (Depedencies: libusb-1.0)" OFF)
2021-06-28 02:22:51 +02:00
option(OPT_BUILD_RTL_SDR_SOURCE "Build RTL-SDR Source Module (Depedencies: librtlsdr)" ON)
option(OPT_BUILD_RTL_TCP_SOURCE "Build RTL-TCP Source Module (no dependencies required)" ON)
option(OPT_BUILD_SDRPLAY_SOURCE "Build SDRplay Source Module (Depedencies: libsdrplay)" OFF)
option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Depedencies: soapysdr)" ON)
option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" OFF)
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Depedencies: libiio, libad9361)" ON)
# Sinks
2021-02-23 00:26:35 +01:00
option(OPT_BUILD_AUDIO_SINK "Build Audio Sink Module (Depedencies: rtaudio)" ON)
2021-06-29 18:14:26 +02:00
option(OPT_BUILD_PORTAUDIO_SINK "Build PortAudio Sink Module (Depedencies: portaudio)" OFF)
2021-06-28 02:22:51 +02:00
# Decoders
option(OPT_BUILD_FALCON9_DECODER "Build the falcon9 live decoder (Dependencies: ffplay)" OFF)
option(OPT_BUILD_METEOR_DEMODULATOR "Build the meteor demodulator module (no dependencies required)" ON)
2021-06-28 02:22:51 +02:00
option(OPT_BUILD_RADIO "Main audio modulation decoder (AM, FM, SSB, etc...)" ON)
option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependencies required)" ON)
2021-06-28 02:22:51 +02:00
# Misc
2021-04-22 01:19:36 +02:00
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
2021-07-03 19:46:21 +02:00
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
2021-06-28 02:22:51 +02:00
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
# Compiler arguments for each platform
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
endif ()
2021-05-18 02:26:55 +02:00
2020-12-08 04:36:37 +01:00
# Core of SDR++
2020-09-19 12:48:34 +02:00
add_subdirectory("core")
2020-12-08 04:36:37 +01:00
2020-12-22 14:50:26 +01:00
# Source modules
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_AIRSPY_SOURCE)
add_subdirectory("airspy_source")
endif (OPT_BUILD_AIRSPY_SOURCE)
2020-12-22 14:50:26 +01:00
if (OPT_BUILD_AIRSPYHF_SOURCE)
2020-12-15 23:05:11 +01:00
add_subdirectory("airspyhf_source")
2020-12-22 14:50:26 +01:00
endif (OPT_BUILD_AIRSPYHF_SOURCE)
2021-03-20 21:53:44 +01:00
if (OPT_BUILD_BLADERF_SOURCE)
add_subdirectory("bladerf_source")
2021-06-28 02:22:51 +02:00
endif (OPT_BUILD_BLADERF_SOURCE)
2021-03-20 21:53:44 +01:00
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_FILE_SOURCE)
add_subdirectory("file_source")
endif (OPT_BUILD_FILE_SOURCE)
2020-12-22 14:50:26 +01:00
2020-12-26 00:42:15 +01:00
if (OPT_BUILD_HACKRF_SOURCE)
add_subdirectory("hackrf_source")
endif (OPT_BUILD_HACKRF_SOURCE)
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_LIMESDR_SOURCE)
add_subdirectory("limesdr_source")
endif (OPT_BUILD_LIMESDR_SOURCE)
2021-02-13 20:43:29 +01:00
2021-05-13 17:31:40 +02:00
if (OPT_BUILD_SDDC_SOURCE)
add_subdirectory("sddc_source")
endif (OPT_BUILD_SDDC_SOURCE)
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_RTL_SDR_SOURCE)
add_subdirectory("rtl_sdr_source")
endif (OPT_BUILD_RTL_SDR_SOURCE)
if (OPT_BUILD_RTL_TCP_SOURCE)
add_subdirectory("rtl_tcp_source")
endif (OPT_BUILD_RTL_TCP_SOURCE)
if (OPT_BUILD_SDRPLAY_SOURCE)
add_subdirectory("sdrplay_source")
endif (OPT_BUILD_SDRPLAY_SOURCE)
if (OPT_BUILD_SOAPY_SOURCE)
add_subdirectory("soapy_source")
endif (OPT_BUILD_SOAPY_SOURCE)
if (OPT_BUILD_SPYSERVER_SOURCE)
add_subdirectory("spyserver_source")
endif (OPT_BUILD_SPYSERVER_SOURCE)
if (OPT_BUILD_PLUTOSDR_SOURCE)
add_subdirectory("plutosdr_source")
endif (OPT_BUILD_PLUTOSDR_SOURCE)
# Sink modules
2020-12-22 14:50:26 +01:00
if (OPT_BUILD_AUDIO_SINK)
add_subdirectory("audio_sink")
endif (OPT_BUILD_AUDIO_SINK)
2020-09-06 15:39:09 +02:00
2021-06-29 18:14:26 +02:00
if (OPT_BUILD_PORTAUDIO_SINK)
add_subdirectory("portaudio_sink")
endif (OPT_BUILD_PORTAUDIO_SINK)
2021-06-28 02:22:51 +02:00
# Decoders
2021-03-21 19:51:38 +01:00
if (OPT_BUILD_FALCON9_DECODER)
add_subdirectory("falcon9_decoder")
endif (OPT_BUILD_FALCON9_DECODER)
2021-04-01 16:54:16 +02:00
if (OPT_BUILD_METEOR_DEMODULATOR)
add_subdirectory("meteor_demodulator")
endif (OPT_BUILD_METEOR_DEMODULATOR)
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_RADIO)
add_subdirectory("radio")
endif (OPT_BUILD_RADIO)
if (OPT_BUILD_WEATHER_SAT_DECODER)
add_subdirectory("weather_sat_decoder")
endif (OPT_BUILD_WEATHER_SAT_DECODER)
2021-06-28 02:22:51 +02:00
# Misc
if (OPT_BUILD_DISCORD_PRESENCE)
add_subdirectory("discord_integration")
endif (OPT_BUILD_DISCORD_PRESENCE)
2021-05-12 06:03:31 +02:00
if (OPT_BUILD_FREQUENCY_MANAGER)
add_subdirectory("frequency_manager")
endif (OPT_BUILD_FREQUENCY_MANAGER)
2021-06-28 02:22:51 +02:00
if (OPT_BUILD_RECORDER)
add_subdirectory("recorder")
endif (OPT_BUILD_RECORDER)
2020-09-19 12:48:34 +02:00
add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
target_link_libraries(sdrpp PRIVATE sdrpp_core)
2020-06-22 16:45:57 +02:00
2020-09-19 12:48:34 +02:00
# Copy dynamic libs over
2020-08-16 03:39:05 +02:00
if (MSVC)
2020-09-19 12:48:34 +02:00
add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
2020-10-23 11:06:10 +02:00
add_custom_target(do_always_volk ALL xcopy /s \"C:/Program Files/PothosSDR/bin\\volk.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
2021-04-18 19:12:07 +02:00
endif ()
2020-07-19 15:59:44 +02:00
2020-10-24 17:09:25 +02:00
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
2020-10-24 17:34:18 +02:00
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
2020-10-24 17:09:25 +02:00
endif ()
2021-02-17 16:59:30 +01: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 02:28:43 +02:00
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
2020-10-24 17:34:18 +02:00
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
2020-10-22 02:28:43 +02:00
endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
2020-10-24 17:34:18 +02:00
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.dylib\" \"$<TARGET_FILE_DIR:sdrpp>\")
2020-10-22 02:28:43 +02:00
endif ()
2021-03-21 19:51:38 +01:00
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
2021-02-11 22:49:33 +01: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-06-24 03:23:30 +02:00
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/themes DESTINATION share/sdrpp)
2021-02-12 00:03:30 +01:00
configure_file(${CMAKE_SOURCE_DIR}/sdrpp.desktop ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop @ONLY)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop DESTINATION /usr/share/applications)
endif ()
2021-02-11 22:49:33 +01:00
# Create uninstall target
2021-02-12 00:03:30 +01:00
configure_file(${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
2021-02-17 16:59:30 +01:00
add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)