Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows support #707

Merged
merged 23 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
69d33b4
Add Windows support
tdcosta100 Feb 10, 2023
dd4e672
Change minimum supported Node.js version
tdcosta100 Feb 11, 2023
270f33d
Add Windows to node-ci and node-relase workflows
tdcosta100 Feb 14, 2023
207b59a
check disk space
acalcutt Feb 15, 2023
896ba98
Update platform/default/src/mbgl/storage/http_file_source.cpp
louwers Feb 15, 2023
00770a0
Revert "check disk space"
acalcutt Feb 15, 2023
db9de42
add wndows-2022 to node-release
acalcutt Feb 16, 2023
5e782a6
put back ccache key/restore-keys
acalcutt Feb 16, 2023
d98bacc
remove 'path'. change shell back to bash
acalcutt Feb 16, 2023
8d8dc9d
Merge branch 'main' into windows-support
ovivoda Feb 16, 2023
b36513c
Merge branch 'main' into pr/707
acalcutt Feb 17, 2023
a9d66d2
Move GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE to windows.cmake
tdcosta100 Feb 18, 2023
a838e4f
Add Windows to root README.md
tdcosta100 Feb 18, 2023
79709bc
Alphabetic ordering (after core platforms)
louwers Feb 18, 2023
5ea200e
Merge branch 'main' into windows-support
tdcosta100 Feb 18, 2023
6f31675
Merge remote-tracking branch 'origin/main' into windows-support
tdcosta100 Feb 18, 2023
3d99b62
Use module.cmake instead module.windows.cmake
tdcosta100 Feb 19, 2023
1043bb1
Remove unused parameter in lamba function
tdcosta100 Feb 19, 2023
19ff597
Change indentation from tabs to spaces
tdcosta100 Feb 19, 2023
ff3dd1d
Correct include dir for WIN32-only
tdcosta100 Feb 19, 2023
a87eb6d
Merge branch 'main' into windows-support
tdcosta100 Feb 20, 2023
16fee34
Prevent custom Windows toolchain with QT
tdcosta100 Feb 25, 2023
98974e0
Merge branch 'main' into windows-support
tdcosta100 Feb 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 82 additions & 39 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
arch: x86_64
- runs-on: macos-12-arm
arch: arm64
- runs-on: windows-2022
arch: x86_64
continue-on-error: true
env:
BUILDTYPE: ${{github.ref == 'refs/heads/main' && 'Release' || 'Debug'}}
Expand All @@ -72,21 +74,24 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Setup submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c core.longpaths=true -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive || true

- name: Get OS Architecture
if: runner.os == 'MacOS' || runner.os == 'Linux'
run: uname -m

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies macOS
if: runner.os == 'macOS'
- name: Install dependencies (MacOS)
if: runner.os == 'MacOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand All @@ -98,7 +103,7 @@ jobs:
brew list glfw || brew install glfw
brew list libuv || brew install libuv

- name: Install dependencies Linux
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -118,63 +123,101 @@ jobs:
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: npm ci
run: npm ci --ignore-scripts

- name: Prepare ccache
run: ccache --clear --set-config cache_dir=~/.ccache
- name: Set up msvc dev cmd (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Cache ccache
uses: actions/cache@v3
env:
cache-name: ccache-v1
- name: Update ccache (Windows)
if: runner.os == 'Windows'
run: |
choco.exe upgrade ccache
ccache.exe --version
echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> $GITHUB_ENV

- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
key: ${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}

- name: Clear ccache statistics
run: |
ccache --zero-stats --set-config cache_dir=~/.ccache
ccache --max-size=2G --set-config cache_dir=~/.ccache
ccache --show-stats --set-config cache_dir=~/.ccache

- name: CMake
- name: Configure maplibre-gl-native (MacOS)
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \

- name: CMake
- name: Configure maplibre-gl-native (Linux)
if: runner.os == 'Linux'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10

- name: Configure maplibre-gl-native (Windows)
if: runner.os == 'Windows'
run: |
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache.exe

- name: Build
- name: Build maplibre-gl-native (MacOS/Linux)
if: runner.os == 'MacOS' || runner.os == 'Linux'
run: |
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)

- name: Run render tests on macOS
if: runner.os == 'macOS'
- name: Build maplibre-gl-native (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
cmake --build build

- name: Run render tests on (MacOS)
if: runner.os == 'MacOS'
run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json

- name: Upload render test artifacts
- name: Upload render test artifacts (MacOS)
if: runner.os == 'MacOS'
uses: actions/upload-artifact@v3
if: always()
with:
name: render-query-test-results
path: metrics/macos-xcode11-release-style.html

- name: Test
- name: Test (Linux)
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum npm test

- name: Test
if: runner.os == 'macOS'
- name: Test (MacOS)
if: runner.os == 'MacOS'
run: npm test

- name: Test (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
LIBGL_ALWAYS_SOFTWARE: true
GALLIUM_DRIVER: softpipe
run: |
Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/22.3.5/mesa3d-22.3.5-release-msvc.7z -OutFile mesa3d.7z
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v108 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
npm test

# On PRs make sure that the npm package can be packaged.
- name: Pack
if: github.ref != 'refs/heads/main'
Expand Down
119 changes: 63 additions & 56 deletions .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
arch: x86_64
- runs-on: macos-12-arm
arch: arm64
- runs-on: windows-2022
arch: x86_64
needs: bump_version
continue-on-error: true
env:
Expand All @@ -70,24 +72,27 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Get Latest Version
run: git pull

- name: Setup submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c core.longpaths=true -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 || true

- name: Get OS Architecture
if: runner.os == 'MacOS' || runner.os == 'Linux'
run: uname -m

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies macOS
if: runner.os == 'macOS'
- name: Install dependencies (MacOS)
if: runner.os == 'MacOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand All @@ -99,7 +104,7 @@ jobs:
brew list glfw || brew install glfw
brew list libuv || brew install libuv

- name: Install dependencies Linux
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -119,68 +124,70 @@ jobs:
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: npm ci
run: npm ci --ignore-scripts

- name: Prepare ccache
run: ccache --clear --set-config cache_dir=~/.ccache
- name: Set up msvc dev cmd (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Cache ccache
uses: actions/cache@v3
env:
cache-name: ccache-v1
- name: Update ccache (Windows)
if: runner.os == 'Windows'
run: |
choco.exe upgrade ccache
ccache.exe --version
echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> $GITHUB_ENV

- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
key: ${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.runs-on }}-${{ github.job }}

- name: Clear ccache statistics
run: |
ccache --zero-stats --set-config cache_dir=~/.ccache
ccache --max-size=2G --set-config cache_dir=~/.ccache
ccache --show-stats --set-config cache_dir=~/.ccache

- name: CMake
- name: Configure maplibre-gl-native (MacOS)
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \

- name: CMake
- name: Configure maplibre-gl-native (Linux)
if: runner.os == 'Linux'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10

- name: Configure maplibre-gl-native (Windows)
if: runner.os == 'Windows'
run: |
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache.exe

- name: Build
- name: Build maplibre-gl-native (MacOS/Linux)
if: runner.os == 'MacOS' || runner.os == 'Linux'
run: |
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)

#- name: Run render tests on macOS
# if: runner.os == 'macOS'
# run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json

#- name: Upload render test artifacts
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: render-query-test-results
# path: metrics/macos-xcode11-release-style.html

#- name: Test
# if: runner.os == 'Linux'
# run: xvfb-run --auto-servernum npm test

#- name: Test
# if: runner.os == 'macOS' && matrix.arch != 'arm64'
# run: npm test

# On PRs make sure that the npm package can be packaged.
#- name: Pack
# if: github.ref != 'refs/heads/main'
# run: |
# npm pack --dry-run
- name: Build maplibre-gl-native (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
cmake --build build

- name: Publish X64 Release to Github
if: github.ref == 'refs/heads/main' && matrix.arch == 'x86_64'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/platform/android/build
/platform/android/MapboxGLAndroidSDK/src/main/assets/sdk_versions/com.mapbox.mapboxsdk
/platform/ios/platform/ios/Mapbox.playground/build/
/platform/windows/vendor/mesa3d/
*.code-workspace

.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@
[submodule "docs/doxygen/doxygen-awesome-css"]
path = docs/doxygen/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "platform/windows/vendor/vcpkg"]
path = platform/windows/vendor/vcpkg
url = https://github.com/microsoft/vcpkg.git
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ option(MBGL_WITH_SANITIZER "Use [address|thread|undefined] here" OFF)
option(MBGL_WITH_RTTI "Compile with runtime type information" OFF)
option(MBGL_WITH_OPENGL "Build with OpenGL renderer" ON)
option(MBGL_WITH_EGL "Build with EGL renderer" OFF)
option(MBGL_WITH_OSMESA "Build with OSMesa (Software) renderer" OFF)
option(MBGL_WITH_WERROR "Make all compilation warnings errors" ON)

if (MBGL_WITH_QT AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0)
endif()

if(WIN32)
ntadej marked this conversation as resolved.
Show resolved Hide resolved
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/platform/windows/custom-toolchain.cmake)
endif()

project("Mapbox GL Native" LANGUAGES CXX C)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down Expand Up @@ -1097,6 +1102,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
include(${PROJECT_SOURCE_DIR}/platform/linux/linux.cmake)
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
include(${PROJECT_SOURCE_DIR}/platform/macos/macos.cmake)
elseif(WIN32)
include(${PROJECT_SOURCE_DIR}/platform/windows/windows.cmake)
else()
message(FATAL_ERROR "Unsupported target platform: " ${CMAKE_SYSTEM_NAME})
endif()
Expand Down
Loading