Skip to content

Commit

Permalink
Merge branch 'main' into custom_metal_layer_in_swift
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-boks authored Jan 19, 2025
2 parents a008b7d + 0dea8ba commit 445bf38
Show file tree
Hide file tree
Showing 39 changed files with 776 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
8.0.0
5 changes: 0 additions & 5 deletions .github/actions/qt5-build/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .github/actions/qt5-build/action.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/actions/qt5-build/entrypoint.sh

This file was deleted.

15 changes: 13 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- name: Get all Linux files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files

uses: tj-actions/changed-files@v45
with:
files_yaml_from_source_file: .github/changed-files.yml
Expand All @@ -52,7 +53,7 @@ jobs:
strategy:
fail-fast: true
matrix:
renderer: [legacy, drawable, vulkan]
renderer: [legacy, drawable, vulkan, drawable-rust]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -91,6 +92,11 @@ jobs:
- if: matrix.renderer == 'drawable'
run: echo renderer_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON >> "$GITHUB_ENV"

- if: matrix.renderer == 'drawable-rust'
run: |
echo "renderer_flag_cmake=-DMLN_DRAWABLE_RENDERER=ON -DMLN_USE_RUST=ON" >> "$GITHUB_ENV"
cargo install cxxbridge-cmd
- if: matrix.renderer == 'legacy'
run: echo renderer_flag_cmake=-DMLN_LEGACY_RENDERER=ON >> "$GITHUB_ENV"

Expand Down Expand Up @@ -158,7 +164,12 @@ jobs:

- name: Run render test
id: render_test
run: xvfb-run -a build/mbgl-render-test-runner --manifestPath=metrics/linux-${{ matrix.renderer }}.json
run: |
renderer="${{ matrix.renderer }}"
if [[ "$renderer" == *-rust ]]; then
renderer=${renderer%-rust}
fi
xvfb-run -a build/mbgl-render-test-runner --manifestPath=metrics/linux-"$renderer".json
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
Expand Down
70 changes: 16 additions & 54 deletions .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,64 +60,40 @@ jobs:
matrix:
include:
- name: Linux
os: ubuntu-22.04
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
compiler: ""
- name: Linux
os: ubuntu-22.04
os: ubuntu-24.04
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
compiler: ""
- name: Linux_GCC13
os: ubuntu-24.04
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
compiler: "gcc-13"
- name: macOS
os: macos-13
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
deployment_target: 10.15
deployment_arch: "x86_64"
compiler: ""
- name: macOS
os: macos-14
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
deployment_target: 11.0
deployment_target: 12.0
deployment_arch: "x86_64;arm64"
compiler: ""
- name: macOS_LLVM18
- name: macOS_LLVM
os: macos-14
build_type: RelWithDebInfo
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
deployment_target: 11.0
deployment_target: 12.0
deployment_arch: "arm64"
compiler: "llvm"
- name: win64_msvc2019
os: windows-2022
build_type: "RelWithDebInfo"
compiler_type: x64
compiler_version: 14.29
qt_version: 5.15.2
qt_target: desktop
qt_arch: win64_msvc2019_64
qt_tools: ""
- name: win64_msvc2019
- name: win64_msvc2022
os: windows-2022
build_type: "RelWithDebInfo"
compiler_type: x64
compiler_version: 14.29
qt_version: 6.7.0
qt_version: 6.8.1
qt_target: desktop
qt_arch: win64_msvc2019_64
qt_arch: win64_msvc2022_64
qt_tools: ""
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -200,11 +176,10 @@ jobs:
xcode-version: latest-stable

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

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v5
Expand All @@ -220,15 +195,6 @@ jobs:
tools: ${{ matrix.qt_tools }}
extra: --base https://mirrors.ocf.berkeley.edu/qt/

- name: Update ccache
if: runner.os == 'Windows'
shell: bash
run: |
# version is pinned due to issues with caching MSVC in 4.8
choco.exe install ccache --version=4.7.5 --no-progress
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:
Expand All @@ -249,16 +215,12 @@ jobs:
-DMLN_WITH_QT=ON
ninja
- name: Build maplibre-native (Linux, Qt5)
if: runner.os == 'Linux' && matrix.qt_version == '5.15.2'
uses: ./source/.github/actions/qt5-build

- name: Build maplibre-native (Linux, Qt6)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler == ''
if: runner.os == 'Linux' && matrix.compiler == ''
uses: ./source/.github/actions/qt6-build

- name: Build maplibre-native (Linux, Qt6, custom compiler)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
run: |
mkdir build && cd build
qt-cmake ../source/ \
Expand All @@ -270,7 +232,7 @@ jobs:
ninja
- name: Build maplibre-native (Linux, Qt6, custom compiler, internal libraries)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
run: |
mkdir build-internal && cd build-internal
qt-cmake ../source/ \
Expand All @@ -284,7 +246,7 @@ jobs:
ninja
- name: Run tests (Linux)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != ''
if: runner.os == 'Linux' && matrix.compiler != ''
uses: coactions/setup-xvfb@v1
with:
run: ctest --output-on-failure
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
CMAKE_CXX_COMPILER_LAUNCHER: "${{ env.SCCACHE_PATH }}"
RENDERER: "${{ matrix.renderer }}"
RENDERING_MODE: "${{ matrix.rendering_mode }}"
timeout-minutes: 5
run: |
cmake --version
& ${{ github.workspace }}\.github\scripts\windows-ci_configure_wrapper.ps1
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ repos:
hooks:
- id: swiftformat
args: [--swiftversion, "5.8"]
- repo: local
hooks:
- id: rustfmt
name: rustfmt
entry: bash -c 'cd rustutils && cargo fmt' --
language: rust
types: [rust]
ci:
# sometimes fails https://github.com/keith/pre-commit-buildifier/issues/13
skip: [buildifier]
Expand Down
23 changes: 21 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library", "js_run_binary")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
load("@npm//:defs.bzl", "npm_link_all_packages")
load(
"//bazel:core.bzl",
Expand Down Expand Up @@ -124,7 +124,6 @@ cc_library(
":mbgl-core-generated-private-artifacts",
":mbgl-core-generated-public-artifacts",
"//vendor:boost",
"//vendor:csscolorparser",
"//vendor:earcut.hpp",
"//vendor:eternal",
"//vendor:mapbox-base",
Expand All @@ -149,6 +148,13 @@ cc_library(
"//vendor:metal-cpp",
],
"//conditions:default": [],
}) + select({
":rust": [
"//rustutils:rustutilslib",
],
"//conditions:default": [
"//vendor:csscolorparser",
],
}),
)

Expand Down Expand Up @@ -195,6 +201,19 @@ config_setting(
},
)

bool_flag(
name = "use_rust",
build_setting_default = False,
visibility = ["//visibility:public"],
)

config_setting(
name = "rust",
flag_values = {
"//:use_rust": "true",
},
)

exports_files(
[
"LICENSE.md",
Expand Down
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ option(MLN_LEGACY_RENDERER "Include the legacy rendering pathway" ON)
option(MLN_DRAWABLE_RENDERER "Include the drawable rendering pathway" OFF)
option(MLN_USE_UNORDERED_DENSE "Use ankerl dense containers for performance" ON)
option(MLN_USE_TRACY "Enable Tracy instrumentation" OFF)
option(MLN_USE_RUST "Use components in Rust" OFF)

if (MLN_WITH_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
Expand Down Expand Up @@ -940,7 +941,7 @@ list(APPEND SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/util/bounding_volumes.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/chrono.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/client_options.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/color.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/color$<IF:$<BOOL:${MLN_USE_RUST}>,.rs.cpp,.cpp>
${PROJECT_SOURCE_DIR}/src/mbgl/util/constants.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/convert.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/event.cpp
Expand Down Expand Up @@ -1458,6 +1459,10 @@ include(${PROJECT_SOURCE_DIR}/vendor/vector-tile.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/wagyu.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/metal-cpp.cmake)

if(MLN_USE_RUST)
include(${PROJECT_SOURCE_DIR}/rustutils/rustutils.cmake)
endif()

target_link_libraries(
mbgl-core
PRIVATE
Expand All @@ -1468,7 +1473,6 @@ target_link_libraries(
Mapbox::Base::cheap-ruler-cpp
mbgl-compiler-options
mbgl-vendor-boost
mbgl-vendor-csscolorparser
mbgl-vendor-earcut.hpp
mbgl-vendor-eternal
mbgl-vendor-parsedate
Expand All @@ -1479,6 +1483,7 @@ target_link_libraries(
mbgl-vendor-vector-tile
mbgl-vendor-wagyu
$<$<BOOL:${MLN_WITH_METAL}>:mbgl-vendor-metal-cpp>
$<IF:$<BOOL:${MLN_USE_RUST}>,mbgl-rustutils,mbgl-vendor-csscolorparser>
PUBLIC
Mapbox::Base
Mapbox::Base::Extras::expected-lite
Expand All @@ -1490,9 +1495,8 @@ target_link_libraries(
unordered_dense
)

export(TARGETS
set(EXPORT_TARGETS
mbgl-core

mapbox-base
mapbox-base-cheap-ruler-cpp
mapbox-base-extras-expected-lite
Expand All @@ -1508,7 +1512,6 @@ export(TARGETS
mapbox-base-variant
mbgl-compiler-options
mbgl-vendor-boost
mbgl-vendor-csscolorparser
mbgl-vendor-earcut.hpp
mbgl-vendor-eternal
mbgl-vendor-parsedate
Expand All @@ -1520,10 +1523,16 @@ export(TARGETS
mbgl-vendor-wagyu
mbgl-vendor-metal-cpp
unordered_dense

FILE MapboxCoreTargets.cmake
)

if(MLN_USE_RUST)
list(APPEND EXPORT_TARGETS mbgl-rustutils rustutils)
else()
list(APPEND EXPORT_TARGETS mbgl-vendor-csscolorparser)
endif()

export(TARGETS ${EXPORT_TARGETS} FILE MapboxCoreTargets.cmake)

if(MLN_WITH_VULKAN)
include(${PROJECT_SOURCE_DIR}/vendor/vulkan.cmake)

Expand Down
Loading

0 comments on commit 445bf38

Please sign in to comment.