mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-26 02:48:31 +01:00
211 lines
7.6 KiB
CMake
211 lines
7.6 KiB
CMake
cmake_minimum_required(VERSION 3.13)
|
|
project(sdrpp)
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
|
else()
|
|
set(CMAKE_INSTALL_PREFIX "/usr")
|
|
endif()
|
|
|
|
# Compatibility Options
|
|
option(OPT_OVERRIDE_STD_FILESYSTEM "Use a local version of std::filesystem on systems that don't have it yet" OFF)
|
|
|
|
# Sources
|
|
option(OPT_BUILD_AIRSPY_SOURCE "Build Airspy Source Module (Dependencies: libairspy)" ON)
|
|
option(OPT_BUILD_AIRSPYHF_SOURCE "Build Airspy HF+ Source Module (Dependencies: libairspyhf)" ON)
|
|
option(OPT_BUILD_BLADERF_SOURCE "Build BladeRF Source Module (Dependencies: libbladeRF)" OFF)
|
|
option(OPT_BUILD_FILE_SOURCE "Wav file source" ON)
|
|
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" ON)
|
|
option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Dependencies: liblimesuite)" OFF)
|
|
option(OPT_BUILD_SDDC_SOURCE "Build SDDC Source Module (Dependencies: libusb-1.0)" OFF)
|
|
option(OPT_BUILD_RTL_SDR_SOURCE "Build RTL-SDR Source Module (Dependencies: 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 (Dependencies: libsdrplay)" OFF)
|
|
option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Dependencies: soapysdr)" ON)
|
|
option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" ON)
|
|
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" ON)
|
|
|
|
# Sinks
|
|
option(OPT_BUILD_AUDIO_SINK "Build Audio Sink Module (Dependencies: rtaudio)" ON)
|
|
option(OPT_BUILD_PORTAUDIO_SINK "Build PortAudio Sink Module (Dependencies: portaudio)" OFF)
|
|
option(OPT_BUILD_NETWORK_SINK "Build Audio Sink Module (no dependencies required)" ON)
|
|
option(OPT_BUILD_NEW_PORTAUDIO_SINK "Build the new PortAudio Sink Module (Dependencies: portaudio)" OFF)
|
|
|
|
# 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)
|
|
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)
|
|
|
|
# Misc
|
|
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
|
|
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
|
|
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
|
|
option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" 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 ()
|
|
|
|
# Core of SDR++
|
|
add_subdirectory("core")
|
|
|
|
|
|
# Source modules
|
|
if (OPT_BUILD_AIRSPY_SOURCE)
|
|
add_subdirectory("airspy_source")
|
|
endif (OPT_BUILD_AIRSPY_SOURCE)
|
|
|
|
if (OPT_BUILD_AIRSPYHF_SOURCE)
|
|
add_subdirectory("airspyhf_source")
|
|
endif (OPT_BUILD_AIRSPYHF_SOURCE)
|
|
|
|
if (OPT_BUILD_BLADERF_SOURCE)
|
|
add_subdirectory("bladerf_source")
|
|
endif (OPT_BUILD_BLADERF_SOURCE)
|
|
|
|
if (OPT_BUILD_FILE_SOURCE)
|
|
add_subdirectory("file_source")
|
|
endif (OPT_BUILD_FILE_SOURCE)
|
|
|
|
if (OPT_BUILD_HACKRF_SOURCE)
|
|
add_subdirectory("hackrf_source")
|
|
endif (OPT_BUILD_HACKRF_SOURCE)
|
|
|
|
if (OPT_BUILD_LIMESDR_SOURCE)
|
|
add_subdirectory("limesdr_source")
|
|
endif (OPT_BUILD_LIMESDR_SOURCE)
|
|
|
|
if (OPT_BUILD_SDDC_SOURCE)
|
|
add_subdirectory("sddc_source")
|
|
endif (OPT_BUILD_SDDC_SOURCE)
|
|
|
|
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
|
|
if (OPT_BUILD_AUDIO_SINK)
|
|
add_subdirectory("audio_sink")
|
|
endif (OPT_BUILD_AUDIO_SINK)
|
|
|
|
if (OPT_BUILD_PORTAUDIO_SINK)
|
|
add_subdirectory("portaudio_sink")
|
|
endif (OPT_BUILD_PORTAUDIO_SINK)
|
|
|
|
if (OPT_BUILD_NETWORK_SINK)
|
|
add_subdirectory("network_sink")
|
|
endif (OPT_BUILD_NETWORK_SINK)
|
|
|
|
if (OPT_BUILD_NEW_PORTAUDIO_SINK)
|
|
add_subdirectory("new_portaudio_sink")
|
|
endif (OPT_BUILD_NEW_PORTAUDIO_SINK)
|
|
|
|
|
|
# Decoders
|
|
if (OPT_BUILD_FALCON9_DECODER)
|
|
add_subdirectory("falcon9_decoder")
|
|
endif (OPT_BUILD_FALCON9_DECODER)
|
|
|
|
if (OPT_BUILD_METEOR_DEMODULATOR)
|
|
add_subdirectory("meteor_demodulator")
|
|
endif (OPT_BUILD_METEOR_DEMODULATOR)
|
|
|
|
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)
|
|
|
|
|
|
# Misc
|
|
if (OPT_BUILD_DISCORD_PRESENCE)
|
|
add_subdirectory("discord_integration")
|
|
endif (OPT_BUILD_DISCORD_PRESENCE)
|
|
|
|
if (OPT_BUILD_FREQUENCY_MANAGER)
|
|
add_subdirectory("frequency_manager")
|
|
endif (OPT_BUILD_FREQUENCY_MANAGER)
|
|
|
|
if (OPT_BUILD_RECORDER)
|
|
add_subdirectory("recorder")
|
|
endif (OPT_BUILD_RECORDER)
|
|
|
|
if (OPT_BUILD_RIGCTL_SERVER)
|
|
add_subdirectory("rigctl_server")
|
|
endif (OPT_BUILD_RIGCTL_SERVER)
|
|
|
|
|
|
add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
|
|
target_link_libraries(sdrpp PRIVATE sdrpp_core)
|
|
|
|
# Copy dynamic libs over
|
|
if (MSVC)
|
|
add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
|
|
add_custom_target(do_always_volk ALL xcopy /s \"C:/Program Files/PothosSDR/bin\\volk.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
|
|
endif ()
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
|
endif ()
|
|
|
|
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 ()
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
|
endif ()
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/libsdrpp_core.dylib\" \"$<TARGET_FILE_DIR:sdrpp>\")
|
|
endif ()
|
|
|
|
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON
|
|
|
|
# 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)
|
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/themes DESTINATION share/sdrpp)
|
|
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 ()
|
|
|
|
# Create uninstall target
|
|
configure_file(${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
|
|
add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |