Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMakeLists.txt to allow static libraries to be built #2252

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,26 @@ option(SANITIZE_MEMORY "Activate detection of leaked memory (LeakSanitizer)" OFF
option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" ON)
option(BUILD_SERVER "Build Server" ON)
option(BUILD_GUI "Build GUI" ON)
option(BUILD_BENCH "Build benchmark" ON)
option(HIDE_CONSOLE "Hide console when running GUI on Windows" ON)
option(BUNDLE "Enable distribution bundle" OFF)
set(ARCH_OPT "native" CACHE STRING "Specify instruction set to use. Will be passed directly as `-march` or `/arch:` argument on supported compilers. \
'native' option will figure out host machine compatibilities and set flags accordingly (even with MSVC).")
option(ENABLE_QT6 "Build with Qt6 rather than Qt5" OFF)
option(ENABLE_PROFILER "Enable runtime profiler" OFF)
set(VKFFT_BACKEND 1 CACHE STRING "vkFFT Backend: 0 - Vulkan, 1 - CUDA")
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

# Sampling devices enablers
option(ENABLE_AARONIARTSA "Enable AaroniaRTSA support" ON)
option(ENABLE_AIRSPY "Enable AirSpy support" ON)
option(ENABLE_AIRSPYHF "Enable AirSpyHF support" ON)
option(ENABLE_BLADERF "Enable bladeRF support" ON)
option(ENABLE_FUNCUBE "Enable FUNcube support" ON)
option(ENABLE_HACKRF "Enable HackRF support" ON)
option(ENABLE_IIO "Enable liniio support like PlutoSDR" ON)
option(ENABLE_LIMESUITE "Enable limesuite support" ON)
option(ENABLE_METIS "Enable Metis support" ON)
option(ENABLE_MIRISDR "Enable LibMiri for old SDRPlay" ON)
option(ENABLE_PERSEUS "Enable perseus support" ON)
option(ENABLE_RTLSDR "Enable rtl-sdr support" ON)
Expand Down Expand Up @@ -182,15 +186,15 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
endif()

find_program(CCACHE "ccache")
if(CCACHE)
if(CCACHE AND NOT EMSCRIPTEN)
message(STATUS "Using ccache ${CCACHE}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
if(APPLE)
set(CMAKE_OBJCXX_COMPILER_LAUNCHER ${CCACHE})
endif()
set(ENV{CCACHE_SLOPPINESS} pch_defines,time_macros)
endif(CCACHE)
endif()

set(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}" CACHE INTERNAL "")
message(STATUS "${APPLICATION_NAME} Version: ${sdrangel_VERSION}")
Expand Down Expand Up @@ -866,7 +870,9 @@ if (FFTW3F_FOUND)
set(WDSP_SUPPORT ON CACHE INTERNAL "")
endif()

if (BUILD_BENCH)
add_subdirectory(sdrbench)
endif()

if (BUILD_GUI)
add_subdirectory(sdrgui)
Expand Down Expand Up @@ -937,6 +943,7 @@ else()
endif()

############ build sdrangel benchmark ################
if (BUILD_BENCH)
set(sdrangelbench_SOURCES
appbench/main.cpp
)
Expand All @@ -950,6 +957,7 @@ target_link_libraries(sdrangelbench
sdrbench
logging
)
endif()

############ build sdrangel gui ################
if (BUILD_GUI)
Expand Down Expand Up @@ -1043,7 +1051,9 @@ if (BUILD_SERVER)
endif()

############ install ##################
if (BUILD_BENCH)
install(TARGETS sdrangelbench DESTINATION ${INSTALL_BIN_DIR})
endif()
if (BUILD_GUI)
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${INSTALL_BIN_DIR})
endif()
Expand Down
6 changes: 5 additions & 1 deletion ft8/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ include_directories(
${CMAKE_SOURCE_DIR}/sdrbase
)

add_library(ft8 SHARED
add_library(ft8
${ft8_SOURCES}
)

if(DEFINED FFTW3F_DEPENDS)
add_dependencies(ft8 "${FFTW3F_DEPENDS}")
endif()

target_link_libraries(ft8
Boost::disable_autolinking
${FFTW3F_LIBRARIES}
Expand Down
2 changes: 1 addition & 1 deletion httpserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/exports
)

add_library(httpserver SHARED
add_library(httpserver
${httpserver_SOURCES}
)

Expand Down
2 changes: 1 addition & 1 deletion logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/exports
)

add_library(logging SHARED
add_library(logging
${logging_SOURCES}
)

Expand Down
2 changes: 1 addition & 1 deletion modemm17/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/exports
)

add_library(modemm17 SHARED
add_library(modemm17
${modemm17_SOURCES}
)

Expand Down
14 changes: 10 additions & 4 deletions plugins/channelmimo/beamsteeringcwmod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${beamsteeringcwmod_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${beamsteeringcwmod_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME BeamSteeringCWModPlugin ${beamsteeringcwmod_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelmimo/doa2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${doa2_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${doa2_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME DOA2Plugin ${doa2_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelmimo/interferometer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${interferometer_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${interferometer_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME InterferometerPlugin ${interferometer_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/chanalyzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ include_directories(
set(TARGET_NAME chanalyzer)
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})

add_library(${TARGET_NAME} SHARED
${chanalyzer_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${chanalyzer_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME ChannelAnalyzerPlugin ${chanalyzer_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
Qt::Widgets
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/channelpower/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${channelpower_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${channelpower_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME ChannelPowerPlugin ${channelpower_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/demodais/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${demodais_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${demodais_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME AISDemodPlugin ${demodais_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/demodam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${am_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${am_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME AMDemodPlugin ${am_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/demodatv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ include_directories(
set(TARGET_NAME demodatv)
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})

add_library(${TARGET_NAME} SHARED
${atv_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${atv_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME ATVDemodPlugin ${atv_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
Qt::Widgets
sdrbase
Expand Down
15 changes: 11 additions & 4 deletions plugins/channelrx/demodbfm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${bfm_SOURCES}
)

target_link_libraries(${TARGET_NAME}
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${bfm_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME BFMPlugin ${bfm_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
15 changes: 11 additions & 4 deletions plugins/channelrx/demodchirpchat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${chirpchat_SOURCES}
)

target_link_libraries(${TARGET_NAME}
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${chirpchat_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME ChirpChatDemodPlugin ${chirpchat_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
14 changes: 10 additions & 4 deletions plugins/channelrx/demoddab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${demoddab_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${demoddab_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME DABDemodPlugin ${demoddab_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
${TARGET_LIB}
sdrbase
Expand Down
16 changes: 11 additions & 5 deletions plugins/channelrx/demoddatv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ include_directories(
set(TARGET_NAME demoddatv)
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})

add_library(${TARGET_NAME} SHARED
${datv_SOURCES}
${ldpc_SOURCES}
)

target_link_libraries(${TARGET_NAME}
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${datv_SOURCES} ${ldpc_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME DATVDemodPlugin ${datv_SOURCES} ${ldpc_SOURCES})
endif()

if(NOT BUILD_SHARED_LIBS)
set_property(GLOBAL APPEND PROPERTY STATIC_PLUGINS_PROPERTY ${TARGET_NAME})
endif()

target_link_libraries(${TARGET_NAME} PRIVATE
Qt::Core
Qt::Widgets
Qt::Multimedia
Expand Down
Loading
Loading