Support for MSYS2 builds (#3621)

This commit is contained in:
tdcosta100
2025-07-20 08:07:50 -03:00
committed by GitHub
parent d3ea080e06
commit b12008aa7b
20 changed files with 636 additions and 69 deletions

View File

@@ -105,7 +105,7 @@ jobs:
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
windows-build-and-test:
windows-build-and-test-msvc:
needs: windows-get-or-build-dependencies
strategy:
matrix:
@@ -238,14 +238,155 @@ jobs:
- name: Run expression test
run: build-windows-${{ matrix.renderer }}/expression-test/mbgl-expression-test.exe
windows-build-and-test-msys2:
if: needs.pre-job.outputs.should_skip != 'true'
needs: pre-job
strategy:
matrix:
msystem: [clang64, mingw64, ucrt64]
renderer: [opengl, egl, vulkan]
runs-on: windows-2022
steps:
- run: |
git config --system core.longpaths true
git config --system core.autocrlf input
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
pacboy: >-
toolchain:p
clang:p
cmake:p
angleproject:p
curl-winssl:p
dlfcn:p
glfw:p
icu:p
libjpeg-turbo:p
libpng:p
libwebp:p
libuv:p
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Initialize sccache
run: |
& $env:SCCACHE_PATH --start-server
& $env:SCCACHE_PATH --zero-stats
- name: Configure MapLibre Native Core
env:
CI: 1
CMAKE_C_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
shell: msys2 {0}
run: |
cmake --version
cmake --preset windows-${{ matrix.renderer }} -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: Build MapLibre Native Core
shell: msys2 {0}
run: |
cmake --build build-windows-${{ matrix.renderer }} --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:cpp"
- name: Download Mesa3D
run: |
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-release-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
- name: Extract Mesa3D files for OpenGL
if: matrix.renderer != 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\libgallium_wgl.dll x64\libGLESv2.dll
- name: Extract Mesa3D files for Vulkan
if: matrix.renderer == 'vulkan'
run: |
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} .\mesa3d.7z x64\lvp_icd.x86_64.json x64\vulkan_lvp.dll
# unit tests
- name: Configure Mesa3D drivers (OpenGL)
if: matrix.renderer != 'vulkan'
run: |
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DLL /t REG_SZ /d ('{0}\build-windows-${{ matrix.renderer }}\libgallium_wgl.dll' -f $PWD.Path) /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v DriverVersion /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Flags /t REG_DWORD /d 1 /f
reg add 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL' /v Version /t REG_DWORD /d 2 /f
Add-Content -Path $env:GITHUB_ENV -Value 'GALLIUM_DRIVER=llvmpipe'
- name: Configure Mesa3D drivers (Vulkan)
if: matrix.renderer == 'vulkan'
run: |
reg add 'HKLM\Software\Khronos\Vulkan\Drivers' /f /v '${{ github.workspace }}\build-windows-${{ matrix.renderer }}\lvp_icd.x86_64.json' /t REG_DWORD /d 0
- name: Download and configure Vulkan
if: matrix.renderer == 'vulkan'
run: |
# 1.4.313.1 doesn't have runtime components?
# $version = (Invoke-WebRequest -Uri "https://vulkan.lunarg.com/sdk/latest.json" | ConvertFrom-Json).windows
$version = '1.4.313.0'
Invoke-WebRequest https://sdk.lunarg.com/sdk/download/$version/windows/VulkanRT-X64-$version-Components.zip -OutFile VulkanRT.zip
& 'C:\Program Files\7-Zip\7z.exe' e -obuild-windows-${{ matrix.renderer }} -r .\VulkanRT.zip *x64\vulkan-1.*
- name: Run C++ tests
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
env:
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-test-runner.exe
# render tests
- name: Run render test
id: render_test
env:
manifest_file: ${{ matrix.renderer }}
ANGLE_DEFAULT_PLATFORM: 'gl'
GALLIUM_DRIVER: llvmpipe
LIBGL_ALWAYS_SOFTWARE: true
run: build-windows-${{ matrix.renderer }}/mbgl-render-test-runner.exe "--manifestPath=metrics/windows-${env:manifest_file}.json"
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: render-test-result-${{ matrix.renderer }}
path: |
metrics/windows-${{ matrix.renderer }}.html
# expression tests
- name: Run expression test
run: build-windows-${{ matrix.renderer }}/expression-test/mbgl-expression-test.exe
windows-ci-result:
name: Windows CI Result
if: needs.pre-job.outputs.should_skip != 'true' && always()
runs-on: windows-2022
needs:
- pre-job
- windows-build-and-test
- windows-build-and-test-msvc
- windows-build-and-test-msys2
steps:
- name: Mark result as failed
if: needs.windows-build-and-test.result != 'success'
if: needs.windows-build-and-test-msvc.result != 'success' || needs.windows-build-and-test-msys2.result != 'success'
run: exit 1

View File

@@ -44,7 +44,7 @@ if (MLN_WITH_QT AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0)
endif()
if(WIN32 AND NOT MLN_WITH_QT AND NOT CMAKE_SYSTEM_NAME STREQUAL Android)
if(WIN32 AND NOT DEFINED ENV{MSYSTEM} AND NOT MLN_WITH_QT AND NOT CMAKE_SYSTEM_NAME STREQUAL Android)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/platform/windows/custom-toolchain.cmake)
endif()

View File

@@ -16,6 +16,9 @@
- [macOS](./platforms/macos/README.md)
- [Linux](./platforms/linux/README.md)
- [Using Docker](./platforms/linux/using-docker.md)
- [Windows](./platforms/windows/README.md)
- [Building with Microsoft Visual Studio](./platforms/windows/build-msvc.md)
- [Building with MSYS2](./platforms/windows/build-msys2.md)
- [Release Policy](./release-policy.md)

View File

@@ -0,0 +1,7 @@
# Windows
This is a port to add Windows support on other targets (Node, GLFW, etc).
The files produced by building mbgl-core target can be reused as libraries in other projects.
Building with [Microsoft Visual Studio](./build-msvc.md) and [MSYS2](./build-msys2.md) are supported.

View File

@@ -0,0 +1,156 @@
# Building with Microsoft Visual Studio
## Prerequisites
The build was tested with `Microsoft Visual Studio 2022`. Earlier versions are not guaranteed to work, but `Microsoft Visual Studio 2019` might work as well.
To install the required Visual Studio components, open Visual Studio Installer and check `Desktop Development with C++` option. Make sure `C++ CMake tools for Windows` is selected in the right pane. If `git` is not already installed, select `Git for Windows` option in `Individual Components`. When Visual Studio finishes the install process, everything is ready to start.
## Downloading sources
Open `x64 Native Tools Command Prompt for VS 2022` and then clone the repository:
```cmd
git clone --config core.longpaths=true --depth 1 --recurse-submodules -j8 https://github.com/maplibre/maplibre-native.git
cd maplibre-native
```
> [!NOTE]
> The `core.longpaths=true` config is necessary, because without it a lot of `Filename too long` messages will come. If you have this configuration set globally (`git config --system core.longpaths=true`), you can omit the `--config core.longpaths=true` portion of the clone command.
## Configuring
Configure the build with the following command, replacing `<preset>` with `opengl`, `egl` or `vulkan`, which are the rendering engines you can use. If you don't know which one to choose, just use `opengl`:
```cmd
cmake --preset windows-<preset>
```
It will take some time to build and install all components on which Maplibre depends.
## Building
Finally, build the project with the following command, again replacing `<preset>` with the value you choose in the configure step:
```cmd
cmake --build build-windows-<preset>
```
## Building with Microsoft Visual Studio
Just add the `-G "Microsoft Visual Studio 17 2022"` (or the corresponding Visual Studio version you have) option from the configure command:
```cmd
cmake --preset windows-<preset> -G "Microsoft Windows 2022"
```
Once configure is done, open the file `build-windows-<preset>\Mapbox GL Native.sln`. Build the target `ALL_BUILD` to build all targets, or pick a specific target. Don't forget to pick a build configuration (`Release`, `RelWithDebInfo`, `MinSizeRel` or `Debug`), otherwise the project will be built with default configuration (`Debug`).
## Testing
If all went well and target `mbgl-render` or `ALL_BUILD` was chosen, there should now be a `build-windows-<preset>\bin\mbgl-render.exe` binary that you can run to generate map tile images. To test that it is working properly, run the following command.
```cmd
.\build-windows-<preset>\bin\mbgl-render.exe --style https://raw.githubusercontent.com/maplibre/demotiles/gh-pages/style.json --output out.png
```
This should produce an `out.png` map tile image with the default MapLibre styling from [the MapLibre demo](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-map/).
![Sample image of world from mbgl-render command](images/sample-maplibre-style-mbgl-render-out.png)
### Using your own style/tiles
You can also use the `mbgl-render` command to render images from your own style or tile set. To do so, you will need a data source and a style JSON file.
For the purposes of this exercise, you can use the `zurich_switzerland.mbtiles` from [here](https://github.com/acalcutt/tileserver-gl/releases/download/test_data/zurich_switzerland.mbtiles), and the following `style.json` file.
```json
{
"version": 8,
"name": "Test style",
"center": [
8.54806714892635,
47.37180823552663
],
"sources": {
"test": {
"type": "vector",
"url": "mbtiles:///path/to/zurich_switzerland.mbtiles"
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "hsl(47, 26%, 88%)"
}
},
{
"id": "water",
"type": "fill",
"source": "test",
"source-layer": "water",
"filter": [
"==",
"$type",
"Polygon"
],
"paint": {
"fill-color": "hsl(205, 56%, 73%)"
}
},
{
"id": "admin_country",
"type": "line",
"source": "test",
"source-layer": "boundary",
"filter": [
"all",
[
"<=",
"admin_level",
2
],
[
"==",
"$type",
"LineString"
]
],
"layout": {
"line-cap": "round",
"line-join": "round"
},
"paint": {
"line-color": "hsla(0, 8%, 22%, 0.51)",
"line-width": {
"base": 1.3,
"stops": [
[
3,
0.5
],
[
22,
15
]
]
}
}
}
]
}
```
Note that this style is totally inadequate for any real use beyond testing your custom setup. Don't forget to replace the source URL `"mbtiles:///path/to/zurich_switzerland.mbtiles"` with the actual path to your mbtiles file.
From your `maplibre-native` dir, run the following command.
```cmd
.\build-windows-<preset>\bin\mbgl-render.exe --style path\to\style.json --output out.png
```
This should produce an `out.png` image in your current directory with a barebones image of the world.
![Sample image of world from mbgl-render command](images/sample-barebones-mbgl-render-out.png)

View File

@@ -0,0 +1,160 @@
# Building with MSYS2
## Prerequisites
You must have [`MSYS2`](https://www.msys2.org/) installed. Then launch an window, which can be `UCRT64`, `CLANG64`, `CLANGARM64` or `MINGW64`.
You need to install the required packages:
```sh
pacman -S --needed \
git \
${MINGW_PACKAGE_PREFIX}-toolchain \
${MINGW_PACKAGE_PREFIX}-clang \
${MINGW_PACKAGE_PREFIX}-cmake \
${MINGW_PACKAGE_PREFIX}-angleproject \
${MINGW_PACKAGE_PREFIX}-curl-winssl \
${MINGW_PACKAGE_PREFIX}-dlfcn \
${MINGW_PACKAGE_PREFIX}-glfw \
${MINGW_PACKAGE_PREFIX}-icu \
${MINGW_PACKAGE_PREFIX}-libjpeg-turbo \
${MINGW_PACKAGE_PREFIX}-libpng \
${MINGW_PACKAGE_PREFIX}-libwebp \
${MINGW_PACKAGE_PREFIX}-libuv
```
Then everything is ready to start.
## Downloading sources
Just clone the repository:
```sh
git clone --depth 1 --recurse-submodules -j8 https://github.com/maplibre/maplibre-native.git
cd maplibre-native
```
## Configuring
Configure the build with the following command, replacing `<preset>` with `opengl`, `egl` or `vulkan`, which are the rendering engines you can use. If you don't know which one to choose, just use `opengl`:
```sh
cmake --preset windows-<preset> -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
```
## Building
Finally, build the project with the following command, again replacing `<preset>` with the value you choose in the configure step:
```sh
cmake --build build-windows-<preset>
```
## Testing
If all went well and target `mbgl-render` or `ALL_BUILD` was chosen, there should now be a `build-windows-<preset>/bin/mbgl-render.exe` binary that you can run to generate map tile images. To test that it is working properly, run the following command.
```sh
./build-windows-<preset>/bin/mbgl-render.exe --style https://raw.githubusercontent.com/maplibre/demotiles/gh-pages/style.json --output out.png
```
This should produce an `out.png` map tile image with the default MapLibre styling from [the MapLibre demo](https://maplibre.org/maplibre-gl-js/docs/examples/display-a-map/).
![Sample image of world from mbgl-render command](images/sample-maplibre-style-mbgl-render-out.png)
### Using your own style/tiles
You can also use the `mbgl-render` command to render images from your own style or tile set. To do so, you will need a data source and a style JSON file.
For the purposes of this exercise, you can use the `zurich_switzerland.mbtiles` from [here](https://github.com/acalcutt/tileserver-gl/releases/download/test_data/zurich_switzerland.mbtiles), and the following `style.json` file.
```json
{
"version": 8,
"name": "Test style",
"center": [
8.54806714892635,
47.37180823552663
],
"sources": {
"test": {
"type": "vector",
"url": "mbtiles:///path/to/zurich_switzerland.mbtiles"
}
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "hsl(47, 26%, 88%)"
}
},
{
"id": "water",
"type": "fill",
"source": "test",
"source-layer": "water",
"filter": [
"==",
"$type",
"Polygon"
],
"paint": {
"fill-color": "hsl(205, 56%, 73%)"
}
},
{
"id": "admin_country",
"type": "line",
"source": "test",
"source-layer": "boundary",
"filter": [
"all",
[
"<=",
"admin_level",
2
],
[
"==",
"$type",
"LineString"
]
],
"layout": {
"line-cap": "round",
"line-join": "round"
},
"paint": {
"line-color": "hsla(0, 8%, 22%, 0.51)",
"line-width": {
"base": 1.3,
"stops": [
[
3,
0.5
],
[
22,
15
]
]
}
}
}
]
}
```
Note that this style is totally inadequate for any real use beyond testing your custom setup. Don't forget to replace the source URL `"mbtiles:///path/to/zurich_switzerland.mbtiles"` with the actual path to your mbtiles file.
From your `maplibre-native/` dir, run the following command.
```sh
./build-windows-<preset>/bin/mbgl-render.exe --style path/to/style.json --output out.png
```
This should produce an `out.png` image in your current directory with a barebones image of the world.
![Sample image of world from mbgl-render command](images/sample-barebones-mbgl-render-out.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -1,6 +1,10 @@
set(NODE_MODULE_MINIMUM_ABI 83) # Minimum supported Node.js version: 14
set(NODE_MODULE_CACHE_DIR ${CMAKE_BINARY_DIR}/headers)
if(DEFINED ENV{MSYSTEM})
message(FATAL "MSYS2 is not supported, Node.js in Windows only has binary compatibility with Microsoft Visual C++.")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/module.cmake)
add_node_module(

View File

@@ -1,5 +1,3 @@
#pragma once
#include <mbgl/platform/gl_functions.hpp>
#ifndef GL_GLEXT_PROTOTYPES

View File

@@ -1,5 +1,3 @@
#pragma once
#include <mbgl/util/logging.hpp>
#include <cassert>

View File

@@ -1,5 +1,3 @@
#pragma once
#include <mbgl/util/platform.hpp>
#include <mbgl/platform/thread.hpp>
#include <mbgl/util/logging.hpp>
@@ -11,6 +9,7 @@
DWORD selfThreadKey;
DummyClassThread dummyClassThread;
#ifdef _MSC_VER
// https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2022
void SetThreadName(DWORD dwThreadID, const char* threadName) {
THREADNAME_INFO info;
@@ -27,6 +26,7 @@ void SetThreadName(DWORD dwThreadID, const char* threadName) {
}
#pragma warning(pop)
}
#endif
THREAD_INFO* GetCurrentThreadInfo() {
THREAD_INFO* info = (THREAD_INFO*)TlsGetValue(selfThreadKey);
@@ -57,6 +57,7 @@ std::string getCurrentThreadName() {
}
void setCurrentThreadName(const std::string& name) {
#ifdef _MSC_VER
THREAD_INFO* info = GetCurrentThreadInfo();
if (info && info->name) {
@@ -66,6 +67,7 @@ void setCurrentThreadName(const std::string& name) {
}
SetThreadName(-1, name.c_str());
#endif
}
void makeThreadLowPriority() {

View File

@@ -1,5 +1,3 @@
#pragma once
#include <mbgl/util/thread_local.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/platform/thread.hpp>

View File

@@ -1,36 +1,56 @@
if(MLN_WITH_EGL)
set(_RENDERER EGL)
elseif(MLN_WITH_VULKAN)
set(_RENDERER Vulkan)
if(MSVC)
if(MLN_WITH_EGL)
set(_RENDERER EGL)
elseif(MLN_WITH_VULKAN)
set(_RENDERER Vulkan)
else()
set(_RENDERER OpenGL)
endif()
if(NOT MLN_USE_BUILTIN_ICU)
set(WITH_ICU -With-ICU)
endif()
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File ${CMAKE_CURRENT_LIST_DIR}/Get-VendorPackages.ps1 -Triplet ${VCPKG_TARGET_TRIPLET} -Renderer ${_RENDERER} ${WITH_ICU})
unset(_RENDERER)
add_compile_definitions(NOMINMAX GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
target_compile_options(
mbgl-compiler-options
INTERFACE
/MP
)
find_package(CURL REQUIRED)
find_package(dlfcn-win32 REQUIRED)
find_package(ICU OPTIONAL_COMPONENTS i18n uc)
find_package(JPEG REQUIRED)
find_package(libuv REQUIRED)
find_package(PNG REQUIRED)
find_package(WebP REQUIRED)
find_path(DLFCN_INCLUDE_DIRS dlfcn.h)
find_path(LIBUV_INCLUDE_DIRS uv.h)
elseif(DEFINED ENV{MSYSTEM})
set(MSYS 1)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
add_compile_definitions(WIN32 GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
find_package(ICU OPTIONAL_COMPONENTS i18n uc data)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_search_module(WEBP libwebp REQUIRED)
pkg_search_module(LIBUV libuv REQUIRED)
pkg_search_module(CURL libcurl REQUIRED)
else()
set(_RENDERER OpenGL)
message(FATAL_ERROR "Unsupported build system: " ${CMAKE_SYSTEM_NAME})
endif()
if(NOT MLN_USE_BUILTIN_ICU)
set(WITH_ICU -With-ICU)
endif()
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File ${CMAKE_CURRENT_LIST_DIR}/Get-VendorPackages.ps1 -Triplet ${VCPKG_TARGET_TRIPLET} -Renderer ${_RENDERER} ${WITH_ICU})
unset(_RENDERER)
add_compile_definitions(NOMINMAX GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
target_compile_options(
mbgl-compiler-options
INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/MP>
)
find_package(CURL REQUIRED)
find_package(dlfcn-win32 REQUIRED)
find_package(ICU OPTIONAL_COMPONENTS i18n uc)
find_package(JPEG REQUIRED)
find_package(libuv REQUIRED)
find_package(PNG REQUIRED)
find_package(WebP REQUIRED)
find_path(DLFCN_INCLUDE_DIRS dlfcn.h)
find_path(LIBUV_INCLUDE_DIRS uv.h)
target_sources(
mbgl-core
PRIVATE
@@ -91,7 +111,25 @@ if(MLN_WITH_OPENGL)
endif()
if(MLN_WITH_EGL)
find_package(unofficial-angle CONFIG REQUIRED)
if(MSVC)
find_package(unofficial-angle CONFIG REQUIRED)
target_link_libraries(
mbgl-core
PRIVATE
unofficial::angle::libEGL
unofficial::angle::libGLESv2
)
elseif(MSYS)
pkg_search_module(EGL angleproject REQUIRED)
target_link_libraries(
mbgl-core
PRIVATE
${EGL_LIBRARIES}
)
endif()
target_sources(
mbgl-core
PRIVATE
@@ -103,13 +141,12 @@ if(MLN_WITH_EGL)
PRIVATE
KHRONOS_STATIC
)
target_link_libraries(
mbgl-core
PRIVATE
unofficial::angle::libEGL
unofficial::angle::libGLESv2
)
elseif(MLN_WITH_VULKAN)
target_include_directories(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/vendor/Vulkan-Headers/include
)
target_sources(
mbgl-core
PRIVATE
@@ -184,16 +221,34 @@ if(NOT ${ICU_FOUND} OR "${ICU_VERSION}" VERSION_LESS 62.0 OR MLN_USE_BUILTIN_ICU
PRIVATE
${PROJECT_SOURCE_DIR}/vendor/icu/include
)
elseif(MSYS)
target_compile_definitions(
mbgl-core
PRIVATE
U_STATIC_IMPLEMENTATION
)
endif()
if(MSVC)
target_link_libraries(
mbgl-core
PRIVATE
${CURL_LIBRARIES}
dlfcn-win32::dl
)
elseif(MSYS)
target_link_libraries(
mbgl-core
PRIVATE
${CURL_STATIC_LIBRARIES}
)
endif()
target_link_libraries(
mbgl-core
PRIVATE
${CURL_LIBRARIES}
${JPEG_LIBRARIES}
${LIBUV_LIBRARIES}
${WEBP_LIBRARIES}
dlfcn-win32::dl
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::i18n>
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::uc>
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::data>
@@ -210,6 +265,18 @@ if(MLN_WITH_GLFW)
endif()
if(MLN_WITH_NODE)
add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node)
elseif(MSVC)
target_link_libraries(
mbgl-core
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
elseif(MSYS)
target_link_libraries(
mbgl-core
PRIVATE
${LIBUV_LIBRARIES}
)
endif()
add_executable(
@@ -243,9 +310,16 @@ target_link_libraries(
PRIVATE
mbgl-compiler-options
$<LINK_LIBRARY:WHOLE_ARCHIVE,mbgl-test>
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
if(MSVC)
target_link_libraries(
mbgl-test-runner
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
endif()
add_executable(
mbgl-benchmark-runner
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/benchmark/main.cpp
@@ -256,9 +330,16 @@ target_link_libraries(
PRIVATE
mbgl-compiler-options
$<LINK_LIBRARY:WHOLE_ARCHIVE,mbgl-benchmark>
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
if(MSVC)
target_link_libraries(
mbgl-benchmark-runner
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
endif()
add_executable(
mbgl-render-test-runner
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/render-test/main.cpp
@@ -269,14 +350,23 @@ target_link_libraries(
PRIVATE
mbgl-compiler-options
mbgl-render-test
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
target_link_libraries(
mbgl-expression-test
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
if(MSVC)
target_link_libraries(
mbgl-render-test-runner
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
endif()
if(MSVC)
target_link_libraries(
mbgl-expression-test
PRIVATE
$<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv>
)
endif()
# Disable benchmarks in CI as they run in VM environment
if(NOT DEFINED ENV{CI})

View File

@@ -828,8 +828,15 @@ void TestRunner::run(TestMetadata& metadata) {
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> cv;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@@ -45,7 +45,8 @@ std::string iso8601(Timestamp timestamp) {
std::tm info;
_gmtime(&time, &info);
char buffer[30];
std::strftime(buffer, sizeof(buffer), "%F %T", &info);
// %F and %T are not supported in MinGW (https://sourceforge.net/p/mingw-w64/bugs/793/)
std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &info);
return buffer;
}
@@ -59,7 +60,8 @@ std::string iso8601(std::chrono::time_point<std::chrono::system_clock, Milliseco
1000;
char buffer[sizeof("yyyy-mm-ddThh:mm:ss.000Z")];
const std::size_t offset = std::strftime(buffer, sizeof(buffer), "%FT%T", &info);
// %F and %T are not supported in MinGW (https://sourceforge.net/p/mingw-w64/bugs/793/)
const std::size_t offset = std::strftime(buffer, sizeof(buffer), "%Y-%m-%dT%H:%M:%S", &info);
snprintf(buffer + offset, sizeof(buffer) - offset, ".%03lldZ", ms);
return buffer;

View File

@@ -8,7 +8,7 @@
#include <sstream>
#include <fstream>
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(WIN32)
#define MBGL_FOPEN_MODE_WBE "wbe"
#else
#define MBGL_FOPEN_MODE_WBE "wb"

View File

@@ -179,8 +179,8 @@ TEST(LocalFileSource, URLLimit) {
std::unique_ptr<AsyncRequest> req = fs.request({Resource::Unknown, toAbsoluteURL(url)}, [&](Response res) {
req.reset();
ASSERT_NE(nullptr, res.error);
#if defined(_MSC_VER) && !defined(__clang__)
// Microsoft Visual Studio defines PATH_MAX as 260, less than the
#if defined(WIN32)
// MSYS2 and Microsoft Visual Studio defines PATH_MAX as 260, less than the
// limit to trigger an error with reason "Other"
EXPECT_EQ(Response::Error::Reason::NotFound, res.error->reason);
#else

View File

@@ -14,8 +14,8 @@
#include <fstream>
#include <set>
#if defined(WIN32) && !defined(__clang__)
#include <Windows.h>
#if defined(WIN32)
#include <windows.h>
#ifdef GetObject
#undef GetObject
#endif
@@ -100,7 +100,7 @@ static void populateNames(std::vector<std::string>& names) {
}
};
#if defined(WIN32) && !defined(__clang__)
#if defined(WIN32)
style_directory += "/*";
WIN32_FIND_DATAA ffd;
HANDLE hFind = FindFirstFileA(style_directory.c_str(), &ffd);

View File

@@ -38,7 +38,8 @@ if(WIN32)
target_link_libraries(
mbgl-vendor-benchmark
PRIVATE shlwapi
PRIVATE
$<IF:$<BOOL:${MSVC}>,shlwapi,-lShlwapi>
)
endif()