Skip to content

Commit

Permalink
Merge pull request f4exb#2254 from srcejon/freq_scanner
Browse files Browse the repository at this point in the history
Allow plugins to be compiled as static libs, part 2.
  • Loading branch information
f4exb authored Sep 20, 2024
2 parents f522d88 + 24d80f8 commit 7d1beb9
Show file tree
Hide file tree
Showing 38 changed files with 1,010 additions and 152 deletions.
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,27 @@ if (BUILD_GUI)
endif()
endif()

# List of static plugins to link with - This is appended to by each pluging CMakeLists.txt
set_property(GLOBAL PROPERTY STATIC_PLUGINS_PROPERTY "")

if(Qt${QT_DEFAULT_MAJOR_VERSION}Positioning_FOUND)
add_compile_definitions(QT_POSITIONING_FOUND)
endif()
if(Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND)
add_compile_definitions(QT_LOCATION_FOUND)
endif()
if(Qt${QT_DEFAULT_MAJOR_VERSION}Charts_FOUND)
add_compile_definitions(QT_CHARTS_FOUND)
endif()
if(Qt${QT_DEFAULT_MAJOR_VERSION}TextToSpeech_FOUND)
add_compile_definitions(QT_TEXTTOSPEECH_FOUND)
endif()
if(BUILD_SHARED_LIBS)
add_compile_definitions(BUILD_SHARED_LIBS)
endif()

# other requirements
if(NOT ANDROID)
if(NOT ANDROID AND NOT EMSCRIPTEN)
find_package(PkgConfig REQUIRED)
endif()

Expand Down
26 changes: 19 additions & 7 deletions plugins/channelrx/demodadsb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ if(NOT SERVER_MODE)
adsbdemodnotificationdialog.cpp
adsbdemodnotificationdialog.ui
adsbosmtemplateserver.cpp
adsbdemodmap.qrc
adsbdemodicons.qrc
airlinelogos.qrc
flags.qrc
map.qrc
icons.qrc
)
set(adsb_HEADERS
${adsb_HEADERS}
Expand All @@ -60,7 +60,13 @@ if(NOT SERVER_MODE)
)

set(TARGET_NAME ${PLUGINS_PREFIX}demodadsb)
set(TARGET_LIB Qt::Widgets Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::Location Qt::TextToSpeech)
set(TARGET_LIB Qt::Widgets Qt::Quick Qt::QuickWidgets Qt::Positioning)
if(Qt${QT_DEFAULT_MAJOR_VERSION}Location_FOUND)
list(APPEND TARGET_LIB Qt::Location)
endif()
if(Qt${QT_DEFAULT_MAJOR_VERSION}TextToSpeech_FOUND)
list(APPEND TARGET_LIB Qt::TextToSpeech)
endif()
set(TARGET_LIB_GUI "sdrgui")
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
else()
Expand All @@ -70,15 +76,21 @@ else()
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
endif()

add_library(${TARGET_NAME} SHARED
${adsb_SOURCES}
)
if(NOT Qt6_FOUND)
add_library(${TARGET_NAME} ${adsb_SOURCES})
else()
qt_add_plugin(${TARGET_NAME} CLASS_NAME ADSBPlugin ${adsb_SOURCES})
endif()

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

if (NOT WIN32)
link_directories(${Boost_LIBRARY_DIRS})
endif()

target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
Boost::disable_autolinking
Qt::Core
${TARGET_LIB}
Expand Down
2 changes: 2 additions & 0 deletions plugins/channelrx/demodadsb/adsbdemod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ void ADSBDemod::stop()
m_basebandSink->stopWork();
m_worker->stopWork();
m_thread->exit();
#ifndef __EMSCRIPTEN__
m_thread->wait();
#endif
}

bool ADSBDemod::handleMessage(const Message& cmd)
Expand Down
6 changes: 6 additions & 0 deletions plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
///////////////////////////////////////////////////////////////////////////////////

#include <QFontDialog>
#ifdef QT_LOCATION_FOUND
#include <QGeoServiceProvider>
#endif
#include <QDebug>

#include "adsbdemoddisplaydialog.h"
Expand All @@ -30,13 +32,17 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid
{
ui->setupUi(this);

#ifdef QT_LOCATION_FOUND
QStringList mapProviders = QGeoServiceProvider::availableServiceProviders();
if (!mapProviders.contains("osm")) {
ui->mapProvider->removeItem(ui->mapProvider->findText("osm"));
}
if (!mapProviders.contains("mapboxgl")) {
ui->mapProvider->removeItem(ui->mapProvider->findText("mapboxgl"));
}
#else
QStringList mapProviders;
#endif

ui->timeout->setValue(settings->m_removeTimeout);
ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom);
Expand Down
Loading

0 comments on commit 7d1beb9

Please sign in to comment.