Add combined static linux targets (#3624)

This commit is contained in:
mwilsnd
2025-07-21 10:41:54 -04:00
committed by GitHub
parent 67c156f114
commit 5230853062
9 changed files with 63 additions and 12 deletions

View File

@@ -10,3 +10,4 @@ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
libwebp-dev \
libopengl0 \
mesa-vulkan-drivers
cargo install armerge@2.2.0

View File

@@ -82,10 +82,14 @@ jobs:
cmake --build --preset linux-${{ matrix.renderer }}-core
- name: Rename artifact
run: cp build-linux-${{ matrix.renderer }}/libmbgl-core.a libmaplibre-native-core-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
run: |
cp build-linux-${{ matrix.renderer }}/libmbgl-core.a libmaplibre-native-core-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
cp build-linux-${{ matrix.renderer }}/libmbgl-core-amalgam.a libmaplibre-native-core-amalgam-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
- name: Upload Linux artifact
run: gh release upload core-${{ github.sha }} libmaplibre-native-core-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
run: |
gh release upload core-${{ github.sha }} libmaplibre-native-core-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
gh release upload core-${{ github.sha }} libmaplibre-native-core-amalgam-linux-${{ matrix.runner.arch }}-${{ matrix.renderer }}.a
env:
GH_TOKEN: ${{ github.token }}

View File

@@ -138,6 +138,9 @@ cc_library(
"@platforms//os:osx": [
"//vendor:icu",
],
"@platforms//os:linux": [
"//vendor:sqlite",
],
"//conditions:default": [],
}) + select({
":metal_renderer": [

View File

@@ -109,7 +109,7 @@
"inherits": "linux-opengl",
"cacheVariables": {
"MLN_CORE_INCLUDE_DEPS": "ON",
"MLN_USE_BUILTIN_ICU": "ON"
"MLN_USE_BUILTIN_ICU": "OFF"
}
},
{
@@ -127,7 +127,7 @@
"inherits": "linux-vulkan",
"cacheVariables": {
"MLN_CORE_INCLUDE_DEPS": "ON",
"MLN_USE_BUILTIN_ICU": "ON"
"MLN_USE_BUILTIN_ICU": "OFF"
}
},
{

View File

@@ -145,6 +145,7 @@ cc_library(
],
"@platforms//os:linux": [
"default-collator",
"//vendor:sqlite",
],
"@platforms//os:osx": [
":default-collator",

View File

@@ -16,9 +16,7 @@ cc_library(
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
linkopts = [
"-lGL",
"-lglfw",
"-lX11",
"-lsqlite3",
"-luv",
"-lz",
"-lcurl",
@@ -33,6 +31,26 @@ cc_library(
],
)
cc_static_library(
name = "maplibre-linux-static",
visibility = ["//visibility:public"],
deps = [
":impl",
],
)
genrule(
name = "maplibre-linux-amalgam",
srcs = [":maplibre-linux-static"],
outs = ["libmaplibre-linux-amalgam.a"],
cmd_bash = """(
armerge --keep-symbols "^.+" --output $(OUTS) $(BINDIR)/platform/linux/libmaplibre-linux-static.a \
$$(pkg-config --variable=libdir icu-uc)/libicuuc.a \
$$(pkg-config --variable=libdir icu-uc)/libicudata.a \
$$(pkg-config --variable=libdir icu-i18n)/libicui18n.a
)"""
)
sh_binary(
name = "startxwrapper",
srcs = ["xorg/startxwrapper"],

View File

@@ -2,8 +2,6 @@ option(MLN_WITH_X11 "Build with X11 Support" ON)
option(MLN_WITH_WAYLAND "Build with Wayland Support" OFF)
find_package(CURL REQUIRED)
find_package(ICU OPTIONAL_COMPONENTS i18n)
find_package(ICU OPTIONAL_COMPONENTS uc)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(PkgConfig REQUIRED)
@@ -14,6 +12,9 @@ find_package(Threads REQUIRED)
pkg_search_module(WEBP libwebp REQUIRED)
pkg_search_module(LIBUV libuv REQUIRED)
pkg_search_module(ICUUC icu-uc)
pkg_search_module(ICUI18N icu-i18n)
find_program(ARMERGE NAMES armerge)
if(MLN_WITH_WAYLAND)
# See https://github.com/maplibre/maplibre-native/pull/2022
@@ -142,7 +143,7 @@ target_include_directories(
include(${PROJECT_SOURCE_DIR}/vendor/nunicode.cmake)
include(${PROJECT_SOURCE_DIR}/vendor/sqlite.cmake)
if(NOT ${ICU_FOUND} OR "${ICU_VERSION}" VERSION_LESS 62.0 OR MLN_USE_BUILTIN_ICU)
if(NOT ${ICUUC_FOUND} OR "${ICUUC_VERSION}" VERSION_LESS 62.0 OR MLN_USE_BUILTIN_ICU)
message(STATUS "ICU not found, too old or MLN_USE_BUILTIN_ICU requestd, using builtin.")
set(MLN_USE_BUILTIN_ICU TRUE)
@@ -165,14 +166,28 @@ target_link_libraries(
${X11_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${WEBP_LIBRARIES}
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::i18n>
$<$<NOT:$<BOOL:${MLN_USE_BUILTIN_ICU}>>:ICU::uc>
$<$<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>>
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")
message(STATUS "Found armerge: ${ARMERGE}")
add_custom_command(
TARGET mbgl-core
POST_BUILD
COMMAND armerge --keep-symbols '.*' --output libmbgl-core-amalgam.a
$<TARGET_FILE:mbgl-core>
${ICUUC_LIBRARY_DIRS}/libicuuc.a
${ICUUC_LIBRARY_DIRS}/libicudata.a
${ICUI18N_LIBRARY_DIRS}/libicui18n.a
)
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/bin)
add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test)
if(MLN_WITH_GLFW)

9
vendor/BUILD.bazel vendored
View File

@@ -235,3 +235,12 @@ cc_library(
strip_include_prefix = "unordered_dense/include/ankerl",
visibility = ["//visibility:public"],
)
cc_library(
name = "sqlite",
srcs = ["sqlite/src/sqlite3.c"],
hdrs = ["sqlite/include/sqlite3.h"],
include_prefix = "",
strip_include_prefix = "sqlite/include",
visibility = ["//visibility:public"],
)

2
vendor/sqlite.cmake vendored
View File

@@ -2,7 +2,7 @@ if(TARGET mbgl-vendor-sqlite)
return()
endif()
if(MLN_WITH_QT)
if(MLN_WITH_QT OR MLN_CORE_INCLUDE_DEPS)
add_library(mbgl-vendor-sqlite OBJECT)
else()
add_library(mbgl-vendor-sqlite STATIC)