Skip to content

Commit

Permalink
Ignore Qt installation when finding ICU (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntadej authored Oct 30, 2023
1 parent 9a1d28a commit dd53f63
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/actions/qt5-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cmake ../source/ \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMLN_WITH_QT=ON \
-DMLN_QT_IGNORE_ICU=OFF \
-DMLN_QT_DEPLOYMENT=ON
ninja
ninja install
1 change: 1 addition & 0 deletions .github/actions/qt6-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ qt-cmake ../source/ \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMLN_WITH_QT=ON \
-DMLN_QT_IGNORE_ICU=OFF \
-DMLN_QT_DEPLOYMENT=ON
ninja
ninja install
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,24 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX="../install" \
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON
ninja
ninja install
- name: Build maplibre-native (Linux, Qt6, custom compiler)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
run: |
mkdir build-internal && cd build-internal
qt-cmake ../source/ \
-G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON \
-DMLN_QT_WITH_INTERNAL_ICU=ON \
-DMLN_QT_WITH_INTERNAL_SQLITE=ON
ninja
ninja install
- name: Build maplibre-native (Windows)
if: runner.os == 'Windows'
Expand Down
40 changes: 28 additions & 12 deletions platform/qt/qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ option(MLN_QT_WITH_HEADLESS "Build MapLibre Native Qt with headless support" ON)
option(MLN_QT_WITH_INTERNAL_SQLITE "Build MapLibre Native Qt bindings with internal sqlite" OFF)
option(MLN_QT_DEPLOYMENT "Autogenerate files necessary for deployment" OFF)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(Threads REQUIRED)

option(MLN_QT_WITH_INTERNAL_ICU "Build MapLibre GL Qt bindings with internal ICU" OFF)
if(NOT MLN_QT_WITH_INTERNAL_ICU)
# find ICU ignoring Qt paths
option(MLN_QT_IGNORE_ICU "Ignore Qt-provided ICU library" ON)
if(MLN_QT_IGNORE_ICU)
set(_CMAKE_PREFIX_PATH_ORIG ${CMAKE_PREFIX_PATH})
set(_CMAKE_FIND_ROOT_PATH_ORIG ${CMAKE_FIND_ROOT_PATH})
unset(CMAKE_PREFIX_PATH)
unset(CMAKE_FIND_ROOT_PATH)
endif()

find_package(ICU COMPONENTS uc REQUIRED)

if(MLN_QT_IGNORE_ICU)
set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH_ORIG})
set(CMAKE_FIND_ROOT_PATH ${_CMAKE_FIND_ROOT_PATH_ORIG})
unset(_CMAKE_PREFIX_PATH_ORIG)
unset(_CMAKE_FIND_ROOT_PATH_ORIG)
endif()
else()
message(STATUS "Using internal ICU")
include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
endif()
endif()

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}
COMPONENTS Gui
Expand All @@ -32,18 +60,6 @@ else()
include(${PROJECT_SOURCE_DIR}/vendor/sqlite.cmake)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(Threads REQUIRED)

option(MLN_QT_WITH_INTERNAL_ICU "Build MapLibre Native Qt bindings with internal ICU" OFF)
if(NOT MLN_QT_WITH_INTERNAL_ICU)
find_package(ICU COMPONENTS uc REQUIRED)
else()
message(STATUS "Using internal ICU")
include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
endif()
endif()

# Debugging & ccache on Windows
if (MSVC)
foreach(config DEBUG RELWITHDEBINFO)
Expand Down

0 comments on commit dd53f63

Please sign in to comment.