Improve Core Builds for Linux (#3706)
This commit is contained in:
4
.github/workflows/core-release.yml
vendored
4
.github/workflows/core-release.yml
vendored
@@ -78,8 +78,8 @@ jobs:
|
||||
|
||||
- name: Build mbgl-core for Linux
|
||||
run: |
|
||||
cmake --preset linux-${{ matrix.renderer }}-core -DCMAKE_CXX_COMPILER_LAUNCHER=""
|
||||
cmake --build --preset linux-${{ matrix.renderer }}-core
|
||||
cmake --preset linux-${{ matrix.renderer }} -DCMAKE_CXX_COMPILER_LAUNCHER=""
|
||||
cmake --build build-linux-${{ matrix.renderer }} --target mbgl-core
|
||||
|
||||
- name: Rename artifact
|
||||
run: |
|
||||
|
||||
68
.github/workflows/linux-ci.yml
vendored
68
.github/workflows/linux-ci.yml
vendored
@@ -24,6 +24,9 @@ permissions:
|
||||
contents: read # needed for CodeQL
|
||||
security-events: write # needed for CodeQL
|
||||
|
||||
env:
|
||||
EGL_PLATFORM: surfaceless
|
||||
|
||||
jobs:
|
||||
pre_job:
|
||||
runs-on: ubuntu-22.04
|
||||
@@ -53,7 +56,13 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
renderer: [vulkan, drawable, drawable-rust]
|
||||
variant:
|
||||
- renderer: vulkan
|
||||
rust: false
|
||||
- renderer: opengl
|
||||
rust: false
|
||||
- renderer: opengl
|
||||
rust: true
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -75,17 +84,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: .github/scripts/install-linux-deps
|
||||
|
||||
- if: matrix.renderer == 'drawable-rust'
|
||||
run: |
|
||||
echo "renderer_flag_cmake=DMLN_WITH_OPENGL=ON -DMLN_USE_RUST=ON" >> "$GITHUB_ENV"
|
||||
cargo install cxxbridge-cmd --version 1.0.157 --locked
|
||||
|
||||
- if: matrix.renderer == 'drawable'
|
||||
run: |
|
||||
echo "-DMLN_WITH_OPENGL=ON" >> "$GITHUB_ENV"
|
||||
|
||||
- if: matrix.renderer == 'vulkan'
|
||||
run: echo renderer_flag_cmake="-DMLN_WITH_VULKAN=ON -DMLN_WITH_OPENGL=OFF" >> "$GITHUB_ENV"
|
||||
- if: matrix.variant.rust
|
||||
run: cargo install cxxbridge-cmd --version 1.0.157 --locked
|
||||
|
||||
- name: Install sccache
|
||||
run: |
|
||||
@@ -103,7 +103,7 @@ jobs:
|
||||
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
|
||||
role-session-name: ${{ github.run_id }}
|
||||
|
||||
- name: Build MapLibre Native Core
|
||||
- name: Build MapLibre Native
|
||||
env:
|
||||
CI: 1
|
||||
run: |
|
||||
@@ -118,12 +118,12 @@ jobs:
|
||||
export SCCACHE_S3_NO_CREDENTIALS=1
|
||||
fi
|
||||
|
||||
cmake -B build -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMLN_WITH_CLANG_TIDY=ON \
|
||||
cmake --preset linux-${{ matrix.variant.renderer }} \
|
||||
-DMLN_WITH_CLANG_TIDY=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
|
||||
-DMLN_WITH_COVERAGE=ON \
|
||||
${{ env.renderer_flag_cmake }}
|
||||
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
|
||||
-DMLN_WITH_COVERAGE=ON
|
||||
cmake --build build-linux-${{ matrix.variant.renderer }} --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
|
||||
|
||||
# mbgl-render (used for size test) & mbgl-benchmark-runner
|
||||
|
||||
@@ -131,26 +131,26 @@ jobs:
|
||||
run: sccache --show-stats
|
||||
|
||||
- name: Upload mbgl-render as artifact
|
||||
if: matrix.renderer == 'drawable' && github.event_name == 'pull_request'
|
||||
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mbgl-render
|
||||
path: |
|
||||
build/bin/mbgl-render
|
||||
build-linux-${{ matrix.variant.renderer }}/bin/mbgl-render
|
||||
|
||||
- name: Upload mbgl-benchmark-runner as artifact
|
||||
if: matrix.renderer == 'drawable' && github.event_name == 'pull_request'
|
||||
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mbgl-benchmark-runner
|
||||
path: |
|
||||
build/mbgl-benchmark-runner
|
||||
build-linux-${{ matrix.variant.renderer }}/mbgl-benchmark-runner
|
||||
|
||||
- name: Upload mbgl-render & mbgl-benchmark-runner to S3
|
||||
if: matrix.renderer == 'drawable' && github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
|
||||
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
|
||||
run: |
|
||||
aws s3 cp build/bin/mbgl-render s3://maplibre-native/mbgl-render-main
|
||||
aws s3 cp build/mbgl-benchmark-runner s3://maplibre-native/mbgl-benchmark-runner-main
|
||||
aws s3 cp build-linux-${{ matrix.variant.renderer }}/bin/mbgl-render s3://maplibre-native/mbgl-render-main
|
||||
aws s3 cp build-linux-${{ matrix.variant.renderer }}/mbgl-benchmark-runner s3://maplibre-native/mbgl-benchmark-runner-main
|
||||
|
||||
# CodeQL
|
||||
|
||||
@@ -161,39 +161,39 @@ jobs:
|
||||
|
||||
# unit tests
|
||||
|
||||
- run: chmod +x build/mbgl-test-runner
|
||||
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/mbgl-test-runner
|
||||
|
||||
- name: Run C++ tests
|
||||
continue-on-error: ${{ matrix.renderer == 'vulkan' }}
|
||||
run: xvfb-run -a build/mbgl-test-runner
|
||||
continue-on-error: ${{ matrix.variant.renderer == 'vulkan' }}
|
||||
run: xvfb-run -a build-linux-${{ matrix.variant.renderer }}/mbgl-test-runner
|
||||
|
||||
# render tests
|
||||
|
||||
- run: chmod +x build/mbgl-render-test-runner
|
||||
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/mbgl-render-test-runner
|
||||
|
||||
- name: Run render test
|
||||
id: render_test
|
||||
run: |
|
||||
renderer="${{ matrix.renderer }}"
|
||||
renderer="${{ matrix.variant.renderer }}"
|
||||
if [[ "$renderer" == *-rust ]]; then
|
||||
renderer=${renderer%-rust}
|
||||
fi
|
||||
xvfb-run -a build/mbgl-render-test-runner --manifestPath=metrics/linux-"$renderer".json
|
||||
xvfb-run -a build-linux-${{ matrix.variant.renderer }}/mbgl-render-test-runner --manifestPath=metrics/linux-"$renderer".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 }}
|
||||
name: render-test-result-${{ matrix.variant.renderer }}
|
||||
path: |
|
||||
metrics/linux-${{ matrix.renderer }}.html
|
||||
metrics/linux-${{ matrix.variant.renderer }}.html
|
||||
|
||||
# expression tests
|
||||
|
||||
- run: chmod +x build/expression-test/mbgl-expression-test
|
||||
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/expression-test/mbgl-expression-test
|
||||
|
||||
- name: Run expression test
|
||||
run: build/expression-test/mbgl-expression-test
|
||||
run: build-linux-${{ matrix.variant.renderer }}/expression-test/mbgl-expression-test
|
||||
|
||||
- if: github.event_name == 'pull_request'
|
||||
uses: ./.github/actions/save-pr-number
|
||||
|
||||
@@ -106,14 +106,6 @@
|
||||
"MLN_WITH_OPENGL": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-opengl-core",
|
||||
"inherits": "linux-opengl",
|
||||
"cacheVariables": {
|
||||
"MLN_CORE_INCLUDE_DEPS": "ON",
|
||||
"MLN_USE_BUILTIN_ICU": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-vulkan",
|
||||
"binaryDir": "${sourceDir}/build-linux-vulkan",
|
||||
@@ -124,14 +116,6 @@
|
||||
"MLN_WITH_X11": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-vulkan-core",
|
||||
"inherits": "linux-vulkan",
|
||||
"cacheVariables": {
|
||||
"MLN_CORE_INCLUDE_DEPS": "ON",
|
||||
"MLN_USE_BUILTIN_ICU": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows",
|
||||
"hidden": true,
|
||||
|
||||
@@ -22,7 +22,7 @@ filegroup(
|
||||
"ios-render-test-runner-style.json", # iOS only
|
||||
"linux-gcc8-release-metrics.json",
|
||||
"linux-gcc8-release-style.json",
|
||||
"linux-drawable.json",
|
||||
"linux-opengl.json",
|
||||
],
|
||||
visibility = [
|
||||
"//platform/ios/test/common:__pkg__",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function(find_static_library result_var)
|
||||
# Usage: find_static_library(VAR_NAME NAMES name1 [name2 ...])
|
||||
function(find_static_library result_list_var)
|
||||
# Usage: find_static_library(LIST_VAR NAMES name1 [name2 ...])
|
||||
set(options)
|
||||
set(one_value_args)
|
||||
set(multi_value_args NAMES)
|
||||
@@ -9,25 +9,24 @@ function(find_static_library result_var)
|
||||
message(FATAL_ERROR "find_static_library: NAMES argument required")
|
||||
endif()
|
||||
|
||||
# Clear any previous cached result for this variable
|
||||
unset(${result_var} CACHE)
|
||||
|
||||
# Temporarily force CMake to look only for .a
|
||||
# Temporarily restrict to static libs
|
||||
set(_old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
|
||||
# Invoke find_library using the caller's var name
|
||||
find_library(${result_var} NAMES ${FSL_NAMES})
|
||||
foreach(lib_name IN LISTS FSL_NAMES)
|
||||
unset(_found_lib CACHE)
|
||||
find_library(_found_lib NAMES ${lib_name})
|
||||
if(_found_lib)
|
||||
message(STATUS "find_static_library: Found static [${lib_name}] -> ${_found_lib}")
|
||||
# Append to result list and return early
|
||||
set(${result_list_var} "${${result_list_var}};${_found_lib}" PARENT_SCOPE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_old_suffixes})
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Restore original suffix list
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_old_suffixes})
|
||||
|
||||
# Check result
|
||||
if(NOT ${result_var})
|
||||
message(FATAL_ERROR
|
||||
"find_static_library: could not find any of [${FSL_NAMES}] as a .a")
|
||||
endif()
|
||||
|
||||
message(STATUS
|
||||
"find_static_library: Found static [${FSL_NAMES}] -> ${${result_var}}")
|
||||
message(FATAL_ERROR "find_static_library: could not find any of the specified static libraries: ${FSL_NAMES}")
|
||||
endfunction()
|
||||
|
||||
@@ -175,41 +175,40 @@ target_link_libraries(
|
||||
${WEBP_LIBRARIES}
|
||||
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:${ICUUC_LIBRARIES}>
|
||||
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:${ICUI18N_LIBRARIES}>
|
||||
$<$<BOOL:${MLN_USE_BUILTIN_ICU}>:$<IF:$<BOOL:${MLN_CORE_INCLUDE_DEPS}>,$<TARGET_OBJECTS:mbgl-vendor-icu>,mbgl-vendor-icu>>
|
||||
$<$<BOOL:${MLN_USE_BUILTIN_ICU}>:mbgl-vendor-icu>
|
||||
PNG::PNG
|
||||
mbgl-vendor-nunicode
|
||||
mbgl-vendor-sqlite
|
||||
)
|
||||
|
||||
# Bundle system provided libraries
|
||||
if(MLN_CORE_INCLUDE_DEPS AND NOT MLN_USE_BUILTIN_ICU AND NOT "${ARMERGE}" STREQUAL "ARMERGE-NOTFOUND")
|
||||
if(NOT MLN_USE_BUILTIN_ICU AND NOT "${ARMERGE}" STREQUAL "ARMERGE-NOTFOUND")
|
||||
message(STATUS "Found armerge: ${ARMERGE}")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/find_static_library.cmake)
|
||||
find_static_library(PNG_STATIC_LIB NAMES png)
|
||||
find_static_library(ZLIB_STATIC_LIB NAMES z)
|
||||
find_static_library(JPEG_STATIC_LIB NAMES jpeg)
|
||||
find_static_library(WEBP_STATIC_LIB NAMES webp)
|
||||
find_static_library(CURL_STATIC_LIB NAMES curl)
|
||||
find_static_library(UV_STATIC_LIB NAMES uv)
|
||||
find_static_library(OPENSSL_STATIC_LIB NAMES ssl)
|
||||
find_static_library(SQLITE_STATIC_LIB NAMES sqlite3)
|
||||
set(STATIC_LIBS "")
|
||||
|
||||
find_static_library(STATIC_LIBS NAMES png)
|
||||
find_static_library(STATIC_LIBS NAMES z)
|
||||
find_static_library(STATIC_LIBS NAMES jpeg)
|
||||
find_static_library(STATIC_LIBS NAMES webp)
|
||||
find_static_library(STATIC_LIBS NAMES curl)
|
||||
find_static_library(STATIC_LIBS NAMES uv uv_a)
|
||||
find_static_library(STATIC_LIBS NAMES ssl)
|
||||
find_static_library(STATIC_LIBS NAMES crypto)
|
||||
|
||||
add_custom_command(
|
||||
TARGET mbgl-core
|
||||
POST_BUILD
|
||||
COMMAND armerge --keep-symbols '.*' --output libmbgl-core-amalgam.a
|
||||
$<TARGET_FILE:mbgl-core>
|
||||
$<TARGET_FILE:freetype>
|
||||
$<TARGET_FILE:mbgl-vendor-csscolorparser>
|
||||
$<TARGET_FILE:harfbuzz>
|
||||
$<TARGET_FILE:mbgl-vendor-sqlite>
|
||||
${ICUUC_LIBRARY_DIRS}/libicuuc.a
|
||||
${ICUUC_LIBRARY_DIRS}/libicudata.a
|
||||
${ICUI18N_LIBRARY_DIRS}/libicui18n.a
|
||||
${PNG_STATIC_LIB}
|
||||
${ZLIB_STATIC_LIB}
|
||||
${JPEG_STATIC_LIB}
|
||||
${WEBP_STATIC_LIB}
|
||||
${CURL_STATIC_LIB}
|
||||
${UV_STATIC_LIB}
|
||||
${OPENSSL_STATIC_LIB}
|
||||
${SQLITE_STATIC_LIB}
|
||||
${STATIC_LIBS}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ cc_test(
|
||||
timeout = "long",
|
||||
args = [
|
||||
"--manifestPath",
|
||||
"metrics/linux-drawable.json",
|
||||
"metrics/linux-opengl.json",
|
||||
],
|
||||
data = [
|
||||
"//metrics:render-test-files",
|
||||
|
||||
Reference in New Issue
Block a user