
Fix previous version not building anymore, as seen on v21.03 branch: https://builds.sr.ht/~postmarketos/job/433826
113 lines
3.4 KiB
Diff
113 lines
3.4 KiB
Diff
From e18467d755f470b26f61f6893eddd76ecf0816e6 Mon Sep 17 00:00:00 2001
|
|
From: Rinigus <rinigus.git@gmail.com>
|
|
Date: Sun, 22 Nov 2020 18:47:41 +0200
|
|
Subject: [PATCH] [build][qt] Add support for qmapboxgl installation
|
|
|
|
Adds install target for Qt version of the library. Allows to
|
|
select which parts of Qt platform are built
|
|
---
|
|
platform/qt/qt.cmake | 58 +++++++++++++++++++++++++++++++++++++++++---
|
|
1 file changed, 54 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake
|
|
index 8184d5079c5..858833a85a5 100644
|
|
--- a/platform/qt/qt.cmake
|
|
+++ b/platform/qt/qt.cmake
|
|
@@ -1,9 +1,16 @@
|
|
# Note: Using Sqlite instead of QSqlDatabase for better compatibility.
|
|
|
|
+option(MBGL_WITH_QT_LIB_ONLY "Build only qmapboxgl library" OFF)
|
|
+option(MBGL_WITH_QT_HEADLESS "Build Mapbox GL Qt with headless support" ON)
|
|
+
|
|
+include(GNUInstallDirs)
|
|
find_package(Qt5Gui REQUIRED)
|
|
find_package(Qt5Network REQUIRED)
|
|
-find_package(Qt5OpenGL REQUIRED)
|
|
-find_package(Qt5Widgets REQUIRED)
|
|
+
|
|
+if(MBGL_WITH_QT_HEADLESS OR NOT MBGL_WITH_QT_LIB_ONLY)
|
|
+ find_package(Qt5OpenGL REQUIRED)
|
|
+ find_package(Qt5Widgets REQUIRED)
|
|
+endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
add_definitions("-DQT_COMPILING_QIMAGE_COMPAT_CPP")
|
|
@@ -50,7 +57,6 @@ target_sources(
|
|
${PROJECT_SOURCE_DIR}/platform/qt/src/async_task_impl.hpp
|
|
${PROJECT_SOURCE_DIR}/platform/qt/src/number_format.cpp
|
|
${PROJECT_SOURCE_DIR}/platform/qt/src/gl_functions.cpp
|
|
- ${PROJECT_SOURCE_DIR}/platform/qt/src/headless_backend_qt.cpp
|
|
$<$<BOOL:${MBGL_PUBLIC_BUILD}>:${PROJECT_SOURCE_DIR}/platform/qt/src/http_file_source.cpp>
|
|
$<$<BOOL:${MBGL_PUBLIC_BUILD}>:${PROJECT_SOURCE_DIR}/platform/qt/src/http_file_source.hpp>
|
|
$<$<BOOL:${MBGL_PUBLIC_BUILD}>:${PROJECT_SOURCE_DIR}/platform/qt/src/http_request.cpp>
|
|
@@ -68,6 +74,15 @@ target_sources(
|
|
${PROJECT_SOURCE_DIR}/platform/qt/src/utf.cpp
|
|
)
|
|
|
|
+if(MBGL_WITH_QT_HEADLESS OR NOT MBGL_WITH_QT_LIB_ONLY)
|
|
+ target_sources(
|
|
+ mbgl-core
|
|
+ PRIVATE
|
|
+ ${PROJECT_SOURCE_DIR}/platform/qt/src/headless_backend_qt.cpp
|
|
+ )
|
|
+endif()
|
|
+
|
|
+
|
|
target_compile_definitions(
|
|
mbgl-core
|
|
PRIVATE QT_IMAGE_DECODERS
|
|
@@ -91,11 +106,18 @@ target_link_libraries(
|
|
Qt5::Core
|
|
Qt5::Gui
|
|
Qt5::Network
|
|
- Qt5::OpenGL
|
|
mbgl-vendor-nunicode
|
|
mbgl-vendor-sqlite
|
|
)
|
|
|
|
+if(MBGL_WITH_QT_HEADLESS)
|
|
+ target_link_libraries(
|
|
+ mbgl-core
|
|
+ PRIVATE
|
|
+ Qt5::OpenGL
|
|
+ )
|
|
+endif()
|
|
+
|
|
add_library(
|
|
qmapboxgl SHARED
|
|
${PROJECT_SOURCE_DIR}/platform/qt/include/qmapbox.hpp
|
|
@@ -141,6 +163,34 @@ target_link_libraries(
|
|
mbgl-core
|
|
)
|
|
|
|
+# install library and headers
|
|
+install(
|
|
+ DIRECTORY include/mbgl
|
|
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
|
+ COMPONENT development
|
|
+)
|
|
+
|
|
+install(
|
|
+ TARGETS qmapboxgl
|
|
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shared NAMELINK_SKIP
|
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT development
|
|
+)
|
|
+
|
|
+install(
|
|
+ FILES
|
|
+ platform/qt/include/QMapbox
|
|
+ platform/qt/include/QMapboxGL
|
|
+ platform/qt/include/qmapbox.hpp
|
|
+ platform/qt/include/qmapboxgl.hpp
|
|
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qt5"
|
|
+ COMPONENT development
|
|
+)
|
|
+
|
|
+# stop here if only library is requested
|
|
+if(MBGL_WITH_QT_LIB_ONLY)
|
|
+ return()
|
|
+endif()
|
|
+
|
|
add_executable(
|
|
mbgl-qt
|
|
${PROJECT_SOURCE_DIR}/platform/qt/app/main.cpp
|