From 3d55ce50ef43ceae6497409feec15e82cbf6ca83 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sun, 30 Jul 2023 13:05:00 +0100 Subject: [PATCH] Move find_package from external/CMakeLists.txt to root CMakeLists.txt so variables remain in scope. --- CMakeLists.txt | 28 +++++++++++++--- cmake/ci/build_codec2.sh | 2 +- external/CMakeLists.txt | 24 -------------- plugins/feature/CMakeLists.txt | 58 ++++++++++++++++++++++++++++------ 4 files changed, 73 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49f1525e4..9d9137ab2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,10 +198,6 @@ if(NOT DEBUG_OUTPUT) add_definitions("-DQT_NO_DEBUG_OUTPUT") endif() -if(ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO") - set(AUTO_EXTERNAL_LIBRARIES ON CACHE INTERNAL "") -endif() - # declare build structures # !! change sdrbase/plugins/pluginmanager.cpp too !! add_definitions("-DLIB=\"lib${LIB_SUFFIX}\"") @@ -714,7 +710,31 @@ if(WIN32) endif() # When ENABLE_EXTERNAL_LIBRARIES is ON, we can build most of the required 3rd party libraries from source +# When ENABLE_EXTERNAL_LIBRARIES is AUTO, we only build 3rd party libraries that aren't already available if(ENABLE_EXTERNAL_LIBRARIES) + if (ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO") + find_package(Codec2) + find_package(CM256cc) + find_package(LibMbe) + find_package(SerialDV) + find_package(LibDSDcc) + find_package(LimeSuite) + find_package(LibBLADERF) + find_package(LibMiriSDR) + find_package(LibIIO) + find_package(LibAIRSPYHF) + find_package(LibPerseus) + find_package(LibRTLSDR) + find_package(LibUSB) + find_package(Opus) + find_package(Boost) + find_package(ZLIB) + find_package(UHD) + find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE) + find_package(FAAD) + find_package(FFTW3F) + find_package(OpenCV OPTIONAL_COMPONENTS core highgui imgproc imgcodecs videoio) + endif (ENABLE_EXTERNAL_LIBRARIES STREQUAL "AUTO") add_subdirectory(external) find_package(Boost REQUIRED) else() diff --git a/cmake/ci/build_codec2.sh b/cmake/ci/build_codec2.sh index dc5b6e364..da55fd55d 100644 --- a/cmake/ci/build_codec2.sh +++ b/cmake/ci/build_codec2.sh @@ -6,7 +6,7 @@ cd $HOME mkdir -p external && cd external mkdir -p drowe67 && cd drowe67 -git clone https://github.com/drowe67/codec2.git +git clone https://github.com/drowe67/codec2-dev.git codec2 cd codec2 git reset --hard "v1.0.3" diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d901a31d6..69a46d32e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -171,30 +171,6 @@ endif (WIN32) set(MACOS_EXTERNAL_LIBS_FIXUP "${CMAKE_BINARY_DIR}/${INSTALL_LIB_DIR}") -if (AUTO_EXTERNAL_LIBRARIES) - find_package(Codec2) - find_package(CM256cc) - find_package(LibMbe) - find_package(SerialDV) - find_package(LibDSDcc) - find_package(LimeSuite) - find_package(LibBLADERF) - find_package(LibMiriSDR) - find_package(LibIIO) - find_package(LibAIRSPYHF) - find_package(LibPerseus) - find_package(LibRTLSDR) - find_package(LibUSB) - find_package(Opus) - find_package(Boost) - find_package(ZLIB) - find_package(UHD) - find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE) - find_package(FAAD) - find_package(FFTW3F) - find_package(OpenCV OPTIONAL_COMPONENTS core highgui imgproc imgcodecs videoio) -endif (AUTO_EXTERNAL_LIBRARIES) - # While some of the following projects are not installed (to save time & space), some have to # be so that on MacOS, the paths embedded in the libraries to other libraries are correct (as they are set to # install path, not build). This is required for macdeployqt to be able to find them diff --git a/plugins/feature/CMakeLists.txt b/plugins/feature/CMakeLists.txt index e9abffe2c..8f882653a 100644 --- a/plugins/feature/CMakeLists.txt +++ b/plugins/feature/CMakeLists.txt @@ -2,78 +2,116 @@ project(feature) if (ENABLE_FEATURE_GS232CONTROLLER AND Qt${QT_DEFAULT_MAJOR_VERSION}SerialPort_FOUND) add_subdirectory(gs232controller) +else() + message(STATUS "Not building gs232controller (ENABLE_FEATURE_GS232CONTROLLER=${ENABLE_FEATURE_GS232CONTROLLER} Qt${QT_DEFAULT_MAJOR_VERSION}SerialPort_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}SerialPort_FOUND)") endif() if (ENABLE_FEATURE_MAP AND Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND) add_subdirectory(map) +else() + message(STATUS "Not building map (ENABLE_FEATURE_MAP=${ENABLE_FEATURE_MAP} Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND} AND Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND=${ AND Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND})") endif() if (ENABLE_FEATURE_VORLOCALIZER AND Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND) add_subdirectory(vorlocalizer) +else() + message(STATUS "Not building vorlocalizer (ENABLE_FEATURE_VORLOCALIZER=${ENABLE_FEATURE_VORLOCALIZER} Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Quick_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}QuickWidgets_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND})") endif() if (ENABLE_FEATURE_AFC) add_subdirectory(afc) +else() + message(STATUS "Not building afc (ENABLE_FEATURE_AFC=${ENABLE_FEATURE_AFC})") endif() if (ENABLE_FEATURE_AIS) add_subdirectory(ais) +else() + message(STATUS "Not building ais (ENABLE_FEATURE_AIS=${ENABLE_FEATURE_AIS})") endif() if (ENABLE_FEATURE_ANTENNATOOLS) add_subdirectory(antennatools) +else() + message(STATUS "Not building antennatools (ENABLE_FEATURE_ANTENNATOOLS=${ENABLE_FEATURE_ANTENNATOOLS})") endif() if (ENABLE_FEATURE_APRS) add_subdirectory(aprs) +else() + message(STATUS "Not building aprs (ENABLE_FEATURE_APRS=${ENABLE_FEATURE_APRS})") endif() if (ENABLE_FEATURE_DEMODANALYZER) add_subdirectory(demodanalyzer) +else() + message(STATUS "Not building demodanalyzer (ENABLE_FEATURE_DEMODANALYZER=${ENABLE_FEATURE_DEMODANALYZER})") endif() if (ENABLE_FEATURE_PERTESTER) add_subdirectory(pertester) +else() + message(STATUS "Not building pertester (ENABLE_FEATURE_PERTESTER=${ENABLE_FEATURE_PERTESTER})") endif() if (ENABLE_FEATURE_RIGCTLSERVER) add_subdirectory(rigctlserver) +else() + message(STATUS "Not building rigctlserver (ENABLE_FEATURE_RIGCTLSERVER=${ENABLE_FEATURE_RIGCTLSERVER})") endif() if (ENABLE_FEATURE_SIMPLEPTT) add_subdirectory(simpleptt) +else() + message(STATUS "Not building simpleptt (ENABLE_FEATURE_SIMPLEPTT=${ENABLE_FEATURE_SIMPLEPTT})") endif() if (NOT SERVER_MODE) if (ENABLE_FEATURE_SATELLITETRACKER AND SGP4_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}TextToSpeech_FOUND) add_subdirectory(satellitetracker) - endif() - if (ENABLE_FEATURE_JOGDIALCONTROLLER) - add_subdirectory(jogdialcontroller) + else() + message(STATUS "Not building satellitetracker (ENABLE_FEATURE_SATELLITETRACKER=${ENABLE_FEATURE_SATELLITETRACKER} SGP4_FOUND=${SGP4_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}TextToSpeech_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}TextToSpeech_FOUND})") endif() else() if (ENABLE_FEATURE_SATELLITETRACKER AND SGP4_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND) add_subdirectory(satellitetracker) + else() + message(STATUS "Not building satellitetracker (ENABLE_FEATURE_SATELLITETRACKER=${ENABLE_FEATURE_SATELLITETRACKER} SGP4_FOUND=${SGP4_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND} Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND})") endif() endif() -if (Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND) - if (ENABLE_FEATURE_RADIOSONDE) - add_subdirectory(radiosonde) - endif() - if (ENABLE_FEATURE_STARTRACKER) - add_subdirectory(startracker) - endif() +if (ENABLE_FEATURE_JOGDIALCONTROLLER AND NOT SERVER_MODE) + add_subdirectory(jogdialcontroller) +else() + message(STATUS "Not building jogdialcontroller (ENABLE_FEATURE_JOGDIALCONTROLLER=${ENABLE_FEATURE_JOGDIALCONTROLLER} SERVER_MODE=${SERVER_MODE})") +endif() + +if (ENABLE_FEATURE_RADIOSONDE AND Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND) + add_subdirectory(radiosonde) +else() + message(STATUS "Not building radiosonde (ENABLE_FEATURE_RADIOSONDE=${ENABLE_FEATURE_RADIOSONDE} Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND})") +endif() + +if (ENABLE_FEATURE_STARTRACKER AND Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND) + add_subdirectory(startracker) +else() + message(STATUS "Not building startracker (ENABLE_FEATURE_STARTRACKER=${ENABLE_FEATURE_STARTRACKER} Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND})") endif() if (ENABLE_FEATURE_LIMERFE AND ENABLE_LIMESUITE AND LIMESUITE_FOUND) add_subdirectory(limerfe) +else() + message(STATUS "Not building limerfe (ENABLE_FEATURE_LIMERFE=${ENABLE_FEATURE_LIMERFE} ENABLE_LIMESUITE=${ENABLE_LIMESUITE} LIMESUITE_FOUND=${LIMESUITE_FOUND})") endif() if (ENABLE_FEATURE_AMBE AND LIBSERIALDV_FOUND) add_subdirectory(ambe) +else() + message(STATUS "Not building ambe (ENABLE_FEATURE_AMBE=${ENABLE_FEATURE_AMBE} LIBSERIALDV_FOUND=${LIBSERIALDV_FOUND})") endif() if (ENABLE_FEATURE_REMOTECONTROL) add_subdirectory(remotecontrol) +else() + message(STATUS "Not building remotecontrol (ENABLE_FEATURE_REMOTECONTROL=${ENABLE_FEATURE_REMOTECONTROL})") endif()