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} Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND=${Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND})")
endif()

# WebEngine on Qt5, WebEngineCore on Qt6
if(ENABLE_FEATURE_SKYMAP AND (Qt${QT_DEFAULT_MAJOR_VERSION}WebEngine_FOUND OR Qt${QT_DEFAULT_MAJOR_VERSION}WebEngineCore_FOUND) AND Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND)
    add_subdirectory(skymap)
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)
    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 (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 CSPICE_FOUND AND Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND)
    add_subdirectory(startracker)
else()
    message(STATUS "Not building startracker (ENABLE_FEATURE_STARTRACKER=${ENABLE_FEATURE_STARTRACKER} CSPICE_FOUND=${CSPICE_FOUND} 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()

if (ENABLE_FEATURE_SID)
    add_subdirectory(sid)
else()
    message(STATUS "Not building SID (ENABLE_FEATURE_SID=${ENABLE_FEATURE_SID})")
endif()

if (ENABLE_FEATURE_MORSEDECODER AND GGMORSE_FOUND)
    add_subdirectory(morsedecoder)
else()
    message(STATUS "Not building morsedecoder (ENABLE_FEATURE_MORSEDECODER=${ENABLE_FEATURE_MORSEDECODER} GGMODSE_FOUND=${GGMORSE_FOUND})")
endif()

if (ENABLE_FEATURE_DENOISER AND RNNOISE_FOUND)
    add_subdirectory(denoiser)
else()
    message(STATUS "Not building denoiser (ENABLE_FEATURE_DENOISER=${ENABLE_FEATURE_DENOISER} RNNOISE_FOUND=${RNNOISE_FOUND})")
endif()

if (ENABLE_FEATURE_FREQDISPLAY)
    add_subdirectory(freqdisplay)
else()
    message(STATUS "Not building freqdisplay (ENABLE_FEATURE_FREQDISPLAY=${ENABLE_FEATURE_FREQDISPLAY})")
endif()
