Use maplibre-native-qt dependency instead of mapbox-gl-native

This commit is contained in:
Dan Paulat 2024-02-27 23:13:08 -06:00
parent 31ade020ac
commit db0d26a4ad
4 changed files with 54 additions and 9 deletions

View file

@ -48,3 +48,5 @@ add_subdirectory(external)
add_subdirectory(wxdata) add_subdirectory(wxdata)
add_subdirectory(scwx-qt) add_subdirectory(scwx-qt)
add_subdirectory(test) add_subdirectory(test)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER CMakePredefinedTargets)

View file

@ -8,7 +8,7 @@ set_property(DIRECTORY
date.cmake date.cmake
hsluv-c.cmake hsluv-c.cmake
imgui.cmake imgui.cmake
mapbox-gl-native.cmake maplibre-native-qt.cmake
stb.cmake stb.cmake
textflowcpp.cmake textflowcpp.cmake
units.cmake) units.cmake)
@ -17,7 +17,7 @@ include(aws-sdk-cpp.cmake)
include(date.cmake) include(date.cmake)
include(hsluv-c.cmake) include(hsluv-c.cmake)
include(imgui.cmake) include(imgui.cmake)
include(mapbox-gl-native.cmake) include(maplibre-native-qt.cmake)
include(stb.cmake) include(stb.cmake)
include(textflowcpp.cmake) include(textflowcpp.cmake)
include(units.cmake) include(units.cmake)

43
external/maplibre-native-qt.cmake vendored Normal file
View file

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.20)
set(PROJECT_NAME scwx-mln)
set(gtest_disable_pthreads ON)
set(MLN_WITH_QT ON)
set(MLN_QT_WITH_INTERNAL_ICU ON)
set(MLN_QT_WITH_LOCATION OFF)
add_subdirectory(maplibre-native-qt)
find_package(ZLIB)
target_include_directories(mbgl-core PRIVATE ${ZLIB_INCLUDE_DIRS})
target_link_libraries(mbgl-core INTERFACE ${ZLIB_LIBRARIES})
if (MSVC)
# Produce PDB file for debug
target_compile_options(mbgl-core PRIVATE "$<$<CONFIG:Release>:/Zi>")
target_compile_options(Core PRIVATE "$<$<CONFIG:Release>:/Zi>")
target_link_options(Core PRIVATE "$<$<CONFIG:Release>:/DEBUG>")
target_link_options(Core PRIVATE "$<$<CONFIG:Release>:/OPT:REF>")
target_link_options(Core PRIVATE "$<$<CONFIG:Release>:/OPT:ICF>")
else()
target_compile_options(mbgl-core PRIVATE "$<$<CONFIG:Release>:-g>")
target_compile_options(Core PRIVATE "$<$<CONFIG:Release>:-g>")
endif()
set(MLN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/maplibre-native-qt/vendor/maplibre-native/include
${CMAKE_CURRENT_SOURCE_DIR}/maplibre-native-qt/src/core/include
${CMAKE_CURRENT_BINARY_DIR}/maplibre-native-qt/src/core/include PARENT_SCOPE)
set_target_properties(test_mln_core PROPERTIES EXCLUDE_FROM_ALL True)
set_target_properties(test_mln_widgets PROPERTIES EXCLUDE_FROM_ALL True)
set_target_properties(Widgets PROPERTIES EXCLUDE_FROM_ALL True)
set_target_properties(test_mln_core PROPERTIES FOLDER mln/exclude)
set_target_properties(test_mln_widgets PROPERTIES FOLDER mln/exclude)
set_target_properties(Widgets PROPERTIES FOLDER mln/exclude)
set_target_properties(Core PROPERTIES FOLDER mln)
set_target_properties(mbgl-core PROPERTIES FOLDER mln)
set_target_properties(mbgl-vendor-csscolorparser PROPERTIES FOLDER mln)
set_target_properties(mbgl-vendor-nunicode PROPERTIES FOLDER mln)
set_target_properties(mbgl-vendor-parsedate PROPERTIES FOLDER mln)
set_target_properties(mbgl-vendor-sqlite PROPERTIES FOLDER mln)

View file

@ -496,7 +496,7 @@ endif()
target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source
${FTGL_INCLUDE_DIR} ${FTGL_INCLUDE_DIR}
${IMGUI_INCLUDE_DIRS} ${IMGUI_INCLUDE_DIRS}
${MBGL_INCLUDE_DIR} ${MLN_INCLUDE_DIRS}
${STB_INCLUDE_DIR} ${STB_INCLUDE_DIR}
${TEXTFLOWCPP_INCLUDE_DIR}) ${TEXTFLOWCPP_INCLUDE_DIR})
@ -554,7 +554,7 @@ target_link_libraries(scwx-qt PUBLIC Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Positioning Qt${QT_VERSION_MAJOR}::Positioning
Boost::json Boost::json
Boost::timer Boost::timer
qmaplibregl QMapLibre::Core
$<$<CXX_COMPILER_ID:MSVC>:opengl32> $<$<CXX_COMPILER_ID:MSVC>:opengl32>
Fontconfig::Fontconfig Fontconfig::Fontconfig
GeographicLib::GeographicLib GeographicLib::GeographicLib
@ -570,11 +570,11 @@ target_link_libraries(supercell-wx PRIVATE scwx-qt
wxdata) wxdata)
# Set DT_RUNPATH for Linux targets # Set DT_RUNPATH for Linux targets
set_target_properties(qmaplibregl PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") set_target_properties(Core PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") # QMapLibre::Core
set_target_properties(supercell-wx PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") set_target_properties(supercell-wx PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
install(TARGETS supercell-wx install(TARGETS supercell-wx
qmaplibregl Core # QMapLibre::Core
RUNTIME_DEPENDENCIES RUNTIME_DEPENDENCIES
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" "qt6" PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" "qt6"
POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"
@ -587,8 +587,8 @@ install(TARGETS supercell-wx
# NO_TRANSLATIONS is needed for Qt 6.5.0 (will be fixed in 6.5.1) # NO_TRANSLATIONS is needed for Qt 6.5.0 (will be fixed in 6.5.1)
# https://bugreports.qt.io/browse/QTBUG-112204 # https://bugreports.qt.io/browse/QTBUG-112204
qt_generate_deploy_app_script(TARGET qmaplibregl qt_generate_deploy_app_script(TARGET Core # QMapLibre::Core
OUTPUT_SCRIPT deploy_script_qmaplibregl OUTPUT_SCRIPT deploy_script_qmaplibre_core
NO_TRANSLATIONS NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR) NO_UNSUPPORTED_PLATFORM_ERROR)
@ -597,7 +597,7 @@ qt_generate_deploy_app_script(TARGET supercell-wx
NO_TRANSLATIONS NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR) NO_UNSUPPORTED_PLATFORM_ERROR)
install(SCRIPT ${deploy_script_qmaplibregl} install(SCRIPT ${deploy_script_qmaplibre_core}
COMPONENT supercell-wx) COMPONENT supercell-wx)
install(SCRIPT ${deploy_script_scwx} install(SCRIPT ${deploy_script_scwx}