From 60e1d1cd9e42c35d17899137d1084e8296d3e365 Mon Sep 17 00:00:00 2001 From: DreamNik Date: Tue, 3 Sep 2024 19:16:23 +0300 Subject: [PATCH] Fix compilation for Android with Qt6 --- CMakeLists.txt | 2 ++ plugins/feature/map/CMakeLists.txt | 9 +++++---- sdrgui/gui/glshaderspectrogram.cpp | 8 +++++++- sdrgui/gui/glshadertvarray.h | 4 ++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6421b2a7..5b25306a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -587,6 +587,7 @@ elseif(ANDROID) CACHE INTERNAL "" ) endif() + add_compile_definitions(ANDROID) endif() # When building a bundle on MacOS, we want to keep build paths in the library @@ -667,6 +668,7 @@ if (BUILD_GUI) if (ENABLE_QT6) find_package(Qt6 REQUIRED COMPONENTS + Location OpenGL OpenGLWidgets Quick diff --git a/plugins/feature/map/CMakeLists.txt b/plugins/feature/map/CMakeLists.txt index 77726118e..b43cfc270 100644 --- a/plugins/feature/map/CMakeLists.txt +++ b/plugins/feature/map/CMakeLists.txt @@ -83,15 +83,16 @@ if(NOT SERVER_MODE) ) set(TARGET_NAME ${PLUGINS_PREFIX}map) + set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Svg Qt::Positioning Qt::Location) set(TARGET_LIB_GUI "sdrgui") set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR}) if(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngine_FOUND) - set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Svg Qt::Positioning Qt::Location Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets) + set(TARGET_LIB ${TARGET_LIB} Qt::WebEngine Qt::WebEngineCore Qt::WebEngineWidgets) elseif(Qt${QT_DEFAULT_MAJOR_VERSION}WebEngineCore_FOUND) - set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Svg Qt::SvgWidgets Qt::Positioning Qt::Location Qt::WebEngineCore Qt::WebEngineWidgets) - else() - set(TARGET_LIB "Qt::Widgets" Qt::Quick Qt::QuickWidgets Qt::Svg Qt::Positioning Qt::Location) + set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets Qt::WebEngineCore Qt::WebEngineWidgets) + elseif(ANDROID) + set(TARGET_LIB ${TARGET_LIB} Qt::SvgWidgets) endif() else() set(TARGET_NAME ${PLUGINSSRV_PREFIX}mapsrv) diff --git a/sdrgui/gui/glshaderspectrogram.cpp b/sdrgui/gui/glshaderspectrogram.cpp index 467f90c30..d17a36138 100644 --- a/sdrgui/gui/glshaderspectrogram.cpp +++ b/sdrgui/gui/glshaderspectrogram.cpp @@ -18,7 +18,13 @@ #include #include -#include +#if defined(ANDROID) +#include +#else +#include +#include +#include +#endif #include #include #include diff --git a/sdrgui/gui/glshadertvarray.h b/sdrgui/gui/glshadertvarray.h index d6c183e4c..884205827 100644 --- a/sdrgui/gui/glshadertvarray.h +++ b/sdrgui/gui/glshadertvarray.h @@ -24,9 +24,13 @@ #include #include +#if defined(ANDROID) +#include +#else #include #include #include +#endif #include #include #include