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

[cmake] Use MLN prefix instead of MBGL #1054

Merged
merged 9 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
6 changes: 3 additions & 3 deletions .github/actions/qt5-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ cmake ../source/ \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_DEPLOYMENT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON \
-DMLN_QT_LIBRARY_ONLY=ON
ninja
ninja install
6 changes: 3 additions & 3 deletions .github/actions/qt6-build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ qt-cmake ../source/ \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_DEPLOYMENT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON \
-DMLN_QT_LIBRARY_ONLY=ON
ninja
ninja install
cd ../install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-ci-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
JOBS: 8
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
MBGL_ANDROID_STL: c++_static
MLN_ANDROID_STL: c++_static
steps:

- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
JOBS: 8
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
MBGL_ANDROID_STL: c++_static
MLN_ANDROID_STL: c++_static
steps:

- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Build Maplibre GL Core
run: |
cmake --version
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMBGL_WITH_COVERAGE=ON
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CLANG_TIDY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON
cmake --build build --target mbgl-core mbgl-test-runner mbgl-render-test-runner

- name: Archive mbgl-test-runner
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ jobs:
-DCMAKE_INSTALL_PREFIX="../install" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \
-DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_DEPLOYMENT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON \
-DMLN_QT_LIBRARY_ONLY=ON
ninja
ninja install

Expand All @@ -221,9 +221,9 @@ jobs:
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \
-DCMAKE_INSTALL_PREFIX="../install" \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_DEPLOYMENT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON
-DMLN_WITH_QT=ON \
-DMLN_QT_DEPLOYMENT=ON \
-DMLN_QT_LIBRARY_ONLY=ON
ninja.exe
ninja.exe install

Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cc_library(
"src",
],
local_defines = [
r"MBGL_VERSION_REV=\"standalone\"",
r"MLN_VERSION_REV=\"standalone\"",
],
visibility = ["//visibility:public"],
deps = [
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### ✨ New features

- *...Add new stuff here...*
- [core] All CMake properties are now prefixed `MLN_*` [1054](https://github.com/maplibre/maplibre-gl-native/pull/1054).
- [windows] Added windows build support for core applications and node [#707](https://github.com/maplibre/maplibre-gl-native/pull/707)
- [core] Add `ClientOptions` to configure client information [#365](https://github.com/maplibre/maplibre-gl-native/pull/365).
- [node] Add workflow to create node binary releases for Ubuntu 20.04 x64 and MacOS 12 x64/arm64 [#378](https://github.com/maplibre/maplibre-gl-native/pull/378), [#459](https://github.com/maplibre/maplibre-gl-native/pull/459).
Expand Down
82 changes: 41 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

option(MBGL_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF)
option(MBGL_WITH_CLANG_TIDY "Build with clang-tidy checks enabled" OFF)
option(MBGL_WITH_COVERAGE "Enable code coverage collection" OFF)
option(MBGL_WITH_QT "Build MapLibre Native Qt bindings" OFF)
option(MLN_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF)
option(MLN_WITH_CLANG_TIDY "Build with clang-tidy checks enabled" OFF)
option(MLN_WITH_COVERAGE "Enable code coverage collection" OFF)
option(MLN_WITH_QT "Build MapLibre Native Qt bindings" OFF)
option(MLN_WITH_NODE "Build MapLibre Native Node.js bindings" OFF)
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)
option(MLN_WITH_SANITIZER "Use [address|thread|undefined] here" OFF)
option(MLN_WITH_RTTI "Compile with runtime type information" OFF)
option(MLN_WITH_OPENGL "Build with OpenGL renderer" ON)
option(MLN_WITH_EGL "Build with EGL renderer" OFF)
option(MLN_WITH_OSMESA "Build with OSMesa (Software) renderer" OFF)
option(MLN_WITH_WERROR "Make all compilation warnings errors" ON)

if (MBGL_WITH_CLANG_TIDY)
if (MLN_WITH_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
Expand All @@ -25,11 +25,11 @@ if (MBGL_WITH_CLANG_TIDY)
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_COMMAND};--extra-arg=-Wno-error=unknown-warning-option")
endif()

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

if(WIN32 AND NOT MBGL_WITH_QT)
if(WIN32 AND NOT MLN_WITH_QT)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/platform/windows/custom-toolchain.cmake)
endif()

Expand Down Expand Up @@ -58,35 +58,35 @@ set(UBSAN_BLACKLIST ${PROJECT_SOURCE_DIR}/scripts/ubsan.blacklist)
target_compile_options(
mbgl-compiler-options
INTERFACE
$<$<BOOL:${MBGL_WITH_COVERAGE}>:--coverage>
$<$<BOOL:${MBGL_WITH_SANITIZER}>:-DSANITIZE>
$<$<BOOL:${MBGL_WITH_SANITIZER}>:-fno-omit-frame-pointer>
$<$<BOOL:${MBGL_WITH_SANITIZER}>:-fno-optimize-sibling-calls>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},address>:-fsanitize=address>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},thread>:-fsanitize=thread>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=implicit-conversion,
$<$<BOOL:${MLN_WITH_COVERAGE}>:--coverage>
$<$<BOOL:${MLN_WITH_SANITIZER}>:-DSANITIZE>
$<$<BOOL:${MLN_WITH_SANITIZER}>:-fno-omit-frame-pointer>
$<$<BOOL:${MLN_WITH_SANITIZER}>:-fno-optimize-sibling-calls>
$<$<STREQUAL:${MLN_WITH_SANITIZER},address>:-fsanitize=address>
$<$<STREQUAL:${MLN_WITH_SANITIZER},thread>:-fsanitize=thread>
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=implicit-conversion,
-fsanitize-blacklist=${UBSAN_BLACKLIST}>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=undefined,
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=undefined,
-fsanitize-blacklist=${UBSAN_BLACKLIST}>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=unsigned-integer-overflow,
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=unsigned-integer-overflow,
-fsanitize-blacklist=${UBSAN_BLACKLIST}>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=nullability,
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=nullability,
-fsanitize-blacklist=${UBSAN_BLACKLIST}>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=float-divide-by-zero,
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=float-divide-by-zero,
-fsanitize-blacklist=${UBSAN_BLACKLIST}>
$<$<PLATFORM_ID:iOS>:-fembed-bitcode>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<OR:$<BOOL:${MBGL_WITH_RTTI}>,$<CXX_COMPILER_ID:MSVC>>>>:-fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<OR:$<BOOL:${MLN_WITH_RTTI}>,$<CXX_COMPILER_ID:MSVC>>>>:-fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Wall>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Wshadow>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Wextra>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>,$<BOOL:${MBGL_WITH_WERROR}>>:-Werror>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>,$<BOOL:${MLN_WITH_WERROR}>>:-Werror>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<PLATFORM_ID:Android>>:-Wno-error=tautological-constant-compare>
$<$<CXX_COMPILER_ID:GNU>:-Wno-error=maybe-uninitialized>
$<$<CXX_COMPILER_ID:GNU>:-Wno-error=return-type>
$<$<CXX_COMPILER_ID:GNU>:-Wno-error=unknown-pragmas>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MBGL_WITH_QT}>>>:-Wno-error=deprecated-declarations>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MBGL_WITH_QT}>>>:-Wno-error=unused-parameter>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MBGL_WITH_QT}>>>:-Wno-error=unused-property-ivar>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MLN_WITH_QT}>>>:-Wno-error=deprecated-declarations>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MLN_WITH_QT}>>>:-Wno-error=unused-parameter>
$<$<AND:$<CXX_COMPILER_ID:AppleClang>,$<NOT:$<BOOL:${MLN_WITH_QT}>>>:-Wno-error=unused-property-ivar>
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
$<$<CXX_COMPILER_ID:MSVC>:/WX> # all warnings as errors
$<$<CXX_COMPILER_ID:MSVC>:/EHsc> # exceptions
Expand All @@ -100,10 +100,10 @@ target_compile_options(
target_link_libraries(
mbgl-compiler-options
INTERFACE
$<$<BOOL:${MBGL_WITH_COVERAGE}>:--coverage>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},address>:-fsanitize=address>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},thread>:-fsanitize=thread>
$<$<STREQUAL:${MBGL_WITH_SANITIZER},undefined>:-fsanitize=undefined>
$<$<BOOL:${MLN_WITH_COVERAGE}>:--coverage>
$<$<STREQUAL:${MLN_WITH_SANITIZER},address>:-fsanitize=address>
$<$<STREQUAL:${MLN_WITH_SANITIZER},thread>:-fsanitize=thread>
$<$<STREQUAL:${MLN_WITH_SANITIZER},undefined>:-fsanitize=undefined>
)

cmake_policy(SET CMP0063 NEW)
Expand All @@ -124,7 +124,7 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

if(MBGL_WITH_QT AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
if(MLN_WITH_QT AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
add_library(mbgl-core OBJECT)
else()
add_library(mbgl-core STATIC)
Expand Down Expand Up @@ -871,7 +871,7 @@ list(APPEND SRC_FILES
${PROJECT_SOURCE_DIR}/src/mbgl/util/work_request.cpp
)

if(MBGL_WITH_OPENGL)
if(MLN_WITH_OPENGL)
message(STATUS "Configuring GL-Native with OpenGL renderer backend")
target_compile_definitions(
mbgl-core
Expand Down Expand Up @@ -984,7 +984,7 @@ target_sources(
${SRC_FILES}
)

if (MBGL_WITH_CLANG_TIDY)
if (MLN_WITH_CLANG_TIDY)
set_target_properties(mbgl-core PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
endif()

Expand All @@ -999,18 +999,18 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/.git/HEAD)
--short=8
HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE MBGL_VERSION_REV
OUTPUT_VARIABLE MLN_VERSION_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(MBGL_VERSION_REV 00000000)
set(MLN_VERSION_REV 00000000)
endif()

set_source_files_properties(
${PROJECT_SOURCE_DIR}/src/mbgl/util/version.cpp
PROPERTIES
COMPILE_DEFINITIONS
MBGL_VERSION_REV="${MBGL_VERSION_REV}"
MBGL_VERSION_REV="${MLN_VERSION_REV}"
)

target_include_directories(
Expand Down Expand Up @@ -1110,13 +1110,13 @@ add_library(
Mapbox::Map ALIAS mbgl-core
)

if(MBGL_WITH_CORE_ONLY)
if(MLN_WITH_CORE_ONLY)
return()
endif()

include(${PROJECT_SOURCE_DIR}/scripts/license.cmake)

if(MBGL_WITH_QT)
if(MLN_WITH_QT)
include(${PROJECT_SOURCE_DIR}/platform/qt/qt.cmake)
elseif(CMAKE_SYSTEM_NAME STREQUAL Android)
include(${PROJECT_SOURCE_DIR}/platform/android/android.cmake)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ MapLibre GL Native shares a single C++ core library with all platforms. To build

To build, run the following from the root directory
```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DMBGL_WITH_CORE_ONLY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMBGL_WITH_COVERAGE=ON
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CORE_ONLY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON
```

`CMAKE_BUILD_TYPE=Debug` will build debug artifacts. You can opt to omit it if that is not necessary.
`MBGL_WITH_CORE_ONLY=ON` will build only the core libraries.
`MLN_WITH_CORE_ONLY=ON` will build only the core libraries.
Built artifacts should be available on `build` folder.


Expand Down
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ or any of the platform make files:
* iOS developers can use [Xcode](https://developer.apple.com/support/debugging/). See also [Advanced Debugging with Xcode and LLDB](https://developer.apple.com/videos/play/wwdc2018/412/).

## Static Analysis
We use [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) for static analysis and run it on CI for each pull request. If you want to run it locally use `-DMBGL_WITH_CLANG_TIDY=ON` CMake option and just run regular build. For the list of enabled checks please see:
We use [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) for static analysis and run it on CI for each pull request. If you want to run it locally use `-DMLN_WITH_CLANG_TIDY=ON` CMake option and just run regular build. For the list of enabled checks please see:
[`.clang-tidy`](.clang-tidy) and [`test/.clang-tidy`](test/.clang-tidy)(for tests we are less strict and use different set of checks).

## Logging in C++
Expand Down
4 changes: 2 additions & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
endif()

# Needed for testing private classes
get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)
get_target_property(MLN_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)

target_link_libraries(
mbgl-benchmark
PRIVATE ${MBGL_CORE_PRIVATE_LIBRARIES} mbgl-vendor-benchmark mbgl-compiler-options
PRIVATE ${MLN_CORE_PRIVATE_LIBRARIES} mbgl-vendor-benchmark mbgl-compiler-options
PUBLIC mbgl-core
)

Expand Down
4 changes: 2 additions & 2 deletions expression-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ target_link_libraries(

set_property(TARGET mbgl-expression-test PROPERTY FOLDER Executables)

string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_EXPRESSION_TEST_SEED)
string(RANDOM LENGTH 5 ALPHABET 0123456789 MLN_EXPRESSION_TEST_SEED)

add_test(
NAME mbgl-expression-test
COMMAND mbgl-expression-test -s --seed=${MBGL_EXPRESSION_TEST_SEED}
COMMAND mbgl-expression-test -s --seed=${MLN_EXPRESSION_TEST_SEED}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
Loading