From 907fe25d3c08560d8bed7c5cb439a304c181a32e Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 21 Oct 2024 17:09:32 +0100 Subject: [PATCH] Fix plugin names for Qt6 Android --- plugins/feature/antennatools/CMakeLists.txt | 14 ++++++++++---- sdrbase/plugin/pluginmanager.cpp | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/feature/antennatools/CMakeLists.txt b/plugins/feature/antennatools/CMakeLists.txt index 69cc6dd9d..117ad444f 100644 --- a/plugins/feature/antennatools/CMakeLists.txt +++ b/plugins/feature/antennatools/CMakeLists.txt @@ -41,11 +41,17 @@ else() set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR}) endif() -add_library(${TARGET_NAME} SHARED - ${antennatools_SOURCES} -) +if(NOT Qt6_FOUND) + add_library(${TARGET_NAME} ${antennatools_SOURCES}) +else() + qt_add_plugin(${TARGET_NAME} CLASS_NAME AntennaToolsPlugin ${antennatools_SOURCES}) +endif() -target_link_libraries(${TARGET_NAME} +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 diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index 4f59fa07c..de5109e49 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -81,7 +81,10 @@ void PluginManager::loadPluginsPart(const QString& pluginsSubDir) // on make install [PREFIX]/bin and [PREFIX]/lib/sdrangel #if defined(ANDROID) PluginsPath = QStringList({applicationDirPath}); - filter = QStringList({"libsdrangel_" + pluginsSubDir + "_*.so"}); + // Qt5 add_library gives libsdrangel_plugins_antennatools.so + // Qt6 qt_add_plugin gives libplugins__sdrangel_plugins_antennatools.so + // Assuming PLUGINS_PREFIX=sdrangel_plugins_ + filter = QStringList({"lib*sdrangel_" + pluginsSubDir + "_*.so"}); #else filter = QStringList({"*"}); PluginsPath << applicationDirPath + "/../" + LIB + "/sdrangel/" + pluginsSubDir;