Skip to content

Commit

Permalink
Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
ntadej committed Jan 2, 2024
1 parent 85673cb commit 6ba2e22
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 78 deletions.
199 changes: 125 additions & 74 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,72 @@ name: Windows CI

on:
workflow_dispatch:
# push:
# branches:
# - main
# tags:
# - '**'
# paths-ignore:
# - ".gitignore"
# - "README.md"
# # ignore CI for other platforms
# - ".github/FUNDING.yml"
# - ".github/actions/**"
# - ".github/workflows/Android.yml"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/macOS.yml"

# pull_request:
# branches:
# - main
# paths-ignore:
# - ".gitignore"
# - "README.md"
# # ignore CI for other platforms
# - ".github/FUNDING.yml"
# - ".github/actions/**"
# - ".github/workflows/Android.yml"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/macOS.yml"
push:
branches:
- main
tags:
- "**"
paths-ignore:
- ".gitignore"
- "README.md"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux.yml"
- ".github/workflows/macOS.yml"

pull_request:
branches:
- main
paths-ignore:
- ".gitignore"
- "README.md"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux.yml"
- ".github/workflows/macOS.yml"

concurrency:
# cancel jobs on PRs only
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
QT_VERSION: 6.5.0
CCACHE_CONFIGPATH: C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf

jobs:
build-plugin:
name: Build QMapLibre for ${{ matrix.config.qtarch }}
build-and-test:
name: Build QMapLibre for Windows (Qt${{ matrix.qt_version}}, ${{ matrix.arch }})
runs-on: windows-2022
strategy:
matrix:
config:
- arch: win64_msvc2019_64
qtarch: msvc2019_64
include:
- qt_series: 5
qt_version: 5.15.2
qt_arch: win64_msvc2019_64
qt_modules: ""
arch: msvc2019_64
compiler: x64
compiler_version: 14.29
- qt_series: 6
qt_version: 6.5.3
qt_arch: win64_msvc2019_64
qt_modules: qtlocation qtpositioning
arch: msvc2019_64
compiler: x64
compiler_version: 14.29
- qt_series: 6
qt_version: 6.6.0
qt_arch: win64_msvc2019_64
qt_modules: qtlocation qtpositioning
arch: msvc2019_64
compiler: x64
compiler_version: 14.29
tools: ""
- arch: win64_mingw
qtarch: mingw_64
compiler: mingw1120_64
compiler_version: 11.2.0
tools: tools_mingw90

steps:
- name: Checkout
Expand All @@ -78,21 +88,20 @@ jobs:
uses: jurplel/install-qt-action@v3
with:
aqtversion: ==3.1.*
version: ${{ env.QT_VERSION }}
version: ${{ matrix.qt_version }}
target: desktop
arch: ${{ matrix.config.arch }}
modules: qtlocation qtpositioning
tools: ${{ matrix.config.tools }}
arch: ${{ matrix.arch }}
modules: ${{ matrix.qt_modules }}

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v4

- name: Setup MSVC
if: matrix.config.arch == 'win64_msvc2019_64'
if: matrix.qt_arch == 'win64_msvc2019_64'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.config.compiler }}
toolset: ${{ matrix.config.compiler_version }}
arch: ${{ matrix.compiler }}
toolset: ${{ matrix.compiler_version }}

- name: Update ccache
run: |
Expand All @@ -102,74 +111,116 @@ jobs:
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: Windows_QMapLibre_${{ matrix.config.qtarch }}
key: Windows_QMapLibre_${{ matrix.qt_version }}_${{ matrix.arch }}
max-size: 200M

- name: Build QMapLibre
shell: bash
env:
COMPILER_TYPE: ${{ matrix.config.compiler }}
COMPILER_TYPE: ${{ matrix.compiler }}
run: |
export PATH=$IQTA_TOOLS/$COMPILER_TYPE/bin:$PATH
echo "$PATH"
mkdir build && cd build
qt-cmake.bat ../source/ \
-G"Ninja Multi-Config" \
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \
-DQT_USE_CCACHE=ON
-DCMAKE_INSTALL_PREFIX="../install" \
ninja.exe
DESTDIR=../install ninja.exe install
ninja.exe test
ninja.exe install
- name: Build QtQuick Example (Qt 6)
if: matrix.qt_series == 6
run: |
export PREFIX_PATH="$(pwd)/install"
mkdir build-example-quick && cd build-example-quick
qt-cmake ../source/examples/quick/ \
-G Ninja \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_PREFIX_PATH="$PREFIX_PATH"
ninja
ninja deploy
- name: Build QtWidgets Example (Qt 6)
if: matrix.qt_series == 6
run: |
export PREFIX_PATH="$(pwd)/install"
mkdir build-example-widgets && cd build-example-widgets
qt-cmake ../source/examples/widgets/ \
-G Ninja \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_PREFIX_PATH="$PREFIX_PATH"
ninja
ninja deploy
- name: Create artifacts
- name: Compress installation
shell: bash
env:
TAG_ARCH: ${{ matrix.config.qtarch }}
TAG_ARCH: ${{ matrix.arch }}
run: |
pushd install/a/maplibre-native-qt
tar cjvf ../../../QMapLibre_Windows_${TAG_ARCH}.tar.bz2 Qt
pushd install
tar cjvf ../QMapLibre_Windows_${TAG_ARCH}.tar.bz2 *
popd
- name: Upload artifacts
- name: Compress examples
if: matrix.qt_series == 6
shell: bash
env:
TAG_ARCH: ${{ matrix.arch }}
run: |
mkdir examples && pushd examples
cp -a ../build-example-quick/QMapLibreExampleQuick.exe .
cp -a ../build-example-widgets/QMapLibreExampleWidgets.exe .
tar cjvf ../QMapLibre_Windows_${TAG_ARCH}_examples.tar.bz2 *
popd
- name: Upload installation
uses: actions/upload-artifact@v4
with:
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }}
path: QMapLibre_Windows_${{ matrix.arch }}.tar.bz2

- name: Upload examples
if: matrix.qt_series == 6
uses: actions/upload-artifact@v4
with:
name: QMapLibre_Windows_${{ matrix.config.qtarch }}
path: QMapLibre_Windows_${{ matrix.config.qtarch }}.tar.bz2
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }}_examples
path: QMapLibre_Windows_${{ matrix.arch }}_examples.tar.bz2

release:
name: Release QMapLibre
if: github.ref_type == 'tag'
runs-on: windows-2022
needs: build-plugin
strategy:
matrix:
config:
- qtarch: msvc2019_64
outarch: msvc2019
- qtarch: mingw_64
outarch: mingw
needs: build-and-test
permissions:
contents: write
strategy:
matrix:
qt_version: [5.15.2, 6.5.3, 6.6.0]
arch: [msvc2019_64]

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: QMapLibre_Windows_${{ matrix.config.qtarch }}
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }}}

- name: Make tarball
shell: bash
env:
TAG_NAME: ${{ github.ref_name }}
QT_ARCH: ${{ matrix.config.qtarch }}
TAG_ARCH: ${{ matrix.config.outarch }}
TAG_ARCH: ${{ matrix.arch }}
run: |
mv QMapLibre_Windows_${QT_ARCH}.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_win64_${TAG_ARCH}.tar.bz2
mv QMapLibre_Windows_${TAG_ARCH}.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_${TAG_ARCH}.tar.bz2
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ env.QT_VERSION }}_win64_${{ matrix.config.outarch }}.tar.bz2
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_win64_${{ matrix.arch }}.tar.bz2
allowUpdates: true
draft: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if(MSVC)
foreach(lang C CXX)
set(flags_var "CMAKE_${lang}_FLAGS_${config}")
string(REPLACE "/Zi" "/Z7" ${flags_var} "${${flags_var}}")
set(${flags_var} "${${flags_var}}" PARENT_SCOPE)
set(${flags_var} "${${flags_var}}")
endforeach()
endforeach()
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/core/style/style_change_p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class Map;

class Q_MAPLIBRE_CORE_EXPORT StyleChange {
public:
StyleChange() = default;
StyleChange(const StyleChange &s) = delete;
StyleChange(StyleChange &&s) noexcept = default;
StyleChange &operator=(const StyleChange &s) = delete;
StyleChange &operator=(StyleChange &&s) noexcept = default;
virtual ~StyleChange() = default;

[[nodiscard]] bool isValid() const { return m_valid; }
Expand Down
9 changes: 7 additions & 2 deletions src/location/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set_target_properties(
PROPERTIES
AUTOMOC ON
EXPORT_NAME PluginGeoServices
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/geoservices"
LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}/geoservices>
)

# QtLocation plugin include directories
Expand Down Expand Up @@ -87,6 +87,11 @@ if(COMMAND qt_add_qml_module)
OUTPUT_TARGETS QmlPluginOutputTargets
SOURCES ${Plugin_Sources}
)
set_target_properties(
${MLN_QT_QML_PLUGIN}
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}/QtLocation/MapLibre>
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/qmldir.in"
"${CMAKE_CURRENT_BINARY_DIR}/QtLocation/MapLibre/qmldir"
Expand Down Expand Up @@ -114,7 +119,7 @@ else()
${MLN_QT_QML_PLUGIN}
PROPERTIES
AUTOMOC ON
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/QtLocation/MapLibre"
LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}/QtLocation/MapLibre>
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/legacy/qmldir.in"
Expand Down
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ if(
return()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_VERSION VERSION_LESS "3.22.0")
message(STATUS "Tests on Windows require CMake 3.22 or later and will be disabled")
return()
endif()

add_subdirectory(core)
if(MLN_QT_WITH_LOCATION)
add_subdirectory(qml)
Expand Down
6 changes: 6 additions & 0 deletions test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ set_tests_properties(
PROPERTIES
ENVIRONMENT "MLN_FIXTURES_PATH=${CMAKE_SOURCE_DIR}/vendor/maplibre-native/test/fixtures"
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_tests_properties(
test_mln_core
PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Core>")
endif()
8 changes: 7 additions & 1 deletion test/qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ add_test(
set_tests_properties(
test_mln_qml
PROPERTIES
ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/core:${CMAKE_BINARY_DIR}/src/location;QSG_RHI_BACKEND=opengl;QML_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/location/plugins;QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/location/plugins;QT_PLUGIN_PATH=${CMAKE_BINARY_DIR}/src/location/plugins"
ENVIRONMENT "$<$<PLATFORM_ID:macOS>:DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/core:${CMAKE_BINARY_DIR}/src/location;>QSG_RHI_BACKEND=opengl;QML_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/location/plugins;QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/location/plugins;QT_PLUGIN_PATH=${CMAKE_BINARY_DIR}/src/location/plugins"
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_tests_properties(
test_mln_qml
PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Core>;PATH=path_list_prepend:$<TARGET_FILE_DIR:Location>")
endif()
6 changes: 6 additions & 0 deletions test/widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ add_test(
NAME test_mln_widgets
COMMAND $<TARGET_FILE:test_mln_widgets>
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_tests_properties(
test_mln_widgets
PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Core>;PATH=path_list_prepend:$<TARGET_FILE_DIR:Widgets>")
endif()

0 comments on commit 6ba2e22

Please sign in to comment.