Skip to content

Commit

Permalink
[build] Move the next buildsystem to the root
Browse files Browse the repository at this point in the history
This will make the `next` buildsystem no longer the `next`, but the
`actual`. The idea is to simplify the build, removing scripts, to
make the platform buildsystem generated by CMake more compatible
with IDEs and make development more streamlined. It will also make
cross compilation easier.
  • Loading branch information
tmpsantos committed Feb 7, 2020
1 parent 489adb8 commit f7fef70
Show file tree
Hide file tree
Showing 33 changed files with 2,653 additions and 2,895 deletions.
1,166 changes: 978 additions & 188 deletions CMakeLists.txt

Large diffs are not rendered by default.

48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
# Mapbox GL Native

A library for embedding interactive, customizable vector maps into native applications on multiple platforms. It takes stylesheets that conform to the [Mapbox Style Specification](https://github.com/mapbox/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://github.com/mapbox/vector-tile-spec), and renders them using OpenGL. [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) is the WebGL-based counterpart, designed for use on the Web.
A library for embedding interactive, customizable vector maps into native applications on multiple platforms. It
takes stylesheets that conform to the [Mapbox Style Specification](https://github.com/mapbox/mapbox-gl-style-spec/),
applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://github.com/mapbox/vector-tile-spec),
and renders them using OpenGL. [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) is the WebGL-based counterpart,
designed for use on the Web.

| SDK | Languages | Build status |
| --------------------------------------------------- | ---------------------------------- | ---------------------------------------- |
| Mapbox GL Native Core | C++14 | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) [![Coverage Status](https://codecov.io/gh/mapbox/mapbox-gl-native/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/mapbox-gl-native) |
| [Mapbox Maps SDK for Android](../platform/android/) | Java | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [Mapbox Maps SDK for iOS](../platform/ios/) | Objective-C or Swift | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [Mapbox Maps SDK for macOS](../platform/macos/) | Objective-C, Swift, or AppleScript | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [node-mapbox-gl-native](../platform/node/) | Node.js | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [Mapbox Maps SDK for Qt](../platform/qt) | C++03 | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) [![AppVeyor CI build status](https://ci.appveyor.com/api/projects/status/3q12kbcooc6df8uc?svg=true)](https://ci.appveyor.com/project/Mapbox/mapbox-gl-native) |

## The Mapbox GL ecosystem
[Additional Mapbox GL Native–based libraries](https://wiki.openstreetmap.org/wiki/Mapbox_GL#Libraries) for **hybrid applications** are developed outside of this repository. If your platform or hybrid application framework isn’t listed there, consider embedding [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) using the standard Web capabilities on your platform.

This repository hosts the cross-platform Mapbox GL Native library, plus convenient SDKs for several platforms. The cross-platform library comes with a [GLFW](https://github.com/glfw/glfw)-based demo application for Ubuntu Linux and macOS. The SDKs target the usual languages on their respective platforms:
## License

| SDK | Languages | Build status |
| --------------------------------------- | ---------------------------------- | ---------------------------------------- |
| [Mapbox GL Native](INSTALL.md) | C++14 | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) [![Coverage Status](https://codecov.io/gh/mapbox/mapbox-gl-native/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/mapbox-gl-native) |
| [Mapbox Maps SDK for Android](https://github.com/mapbox/mapbox-gl-native-android) | Java | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native-android.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native-android/tree/master) |
| [Mapbox Maps SDK for iOS](platform/ios/) | Objective-C or Swift | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [Mapbox Maps SDK for macOS](platform/macos/) | Objective-C, Swift, or AppleScript | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [node-mapbox-gl-native](platform/node/) | Node.js | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) |
| [Mapbox Maps SDK for Qt](platform/qt) | C++03 | [![Circle CI build status](https://circleci.com/gh/mapbox/mapbox-gl-native.svg?style=shield)](https://circleci.com/gh/mapbox/workflows/mapbox-gl-native/tree/master) [![AppVeyor CI build status](https://ci.appveyor.com/api/projects/status/3q12kbcooc6df8uc?svg=true)](https://ci.appveyor.com/project/Mapbox/mapbox-gl-native) |
Mapbox GL Native is licensed under the [3-Clause BSD license](../LICENSE.md).

[Additional Mapbox GL Native–based libraries](https://wiki.openstreetmap.org/wiki/Mapbox_GL#Libraries) for **hybrid applications** are developed outside of this repository. If your platform or hybrid application framework isn’t listed there, consider embedding [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) using the standard Web capabilities on your platform.
## Developing

## License
The `next` directory contains the next generation buildsystem for Mapbox GL Native, based solely on CMake with the
goal of minimizing the use of scripts, increase portability and support building Mapbox GL Native as a subdirectory
of another CMake project. This new buildsystem is also designed to build offline, making use of pre-installed and
vendorized dependencies. When using the build bot docker image, the build should produce the exact same results as
the bots, making it a hermetically sealed build for Linux, Qt and Android.

### Building and running tests

Mapbox GL Native is licensed under the [2-Clause BSD license](LICENSE.md). The licenses of its dependencies are tracked via [FOSSA](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fmapbox-gl-native):
The following command, executed from the root of this repository tree, will build Mapbox GL Native targeting your
host architecture given that you have all the dependencies installed.

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fmapbox-gl-native.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fmapbox-gl-native)
```
$ mkdir build && cd build
$ cmake ..
$ make -j8
$ make test ARGS=-V
```
4 changes: 1 addition & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@ before_build:

build_script:
- call "%VCVARSALL%" amd64
- cmake -E remove ../next/vendor
- cmake -E copy_directory ../vendor ../next/vendor
- cmake -G "Ninja"
-DCMAKE_BUILD_TYPE=%CONFIGURATION%
-DCMAKE_MAKE_PROGRAM="%APPVEYOR_BUILD_FOLDER%\platform\qt\ninja.exe"
-DCMAKE_PREFIX_PATH=%QT_PREFIX%
-DMBGL_WITH_QT=ON
../next
..
- cmake --build . --target qmapboxgl -- -j %NUMBER_OF_PROCESSORS%
- clcache -s
38 changes: 38 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
add_library(
mbgl-benchmark STATIC EXCLUDE_FROM_ALL
${PROJECT_SOURCE_DIR}/benchmark/api/query.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/api/render.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/function/camera_function.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/function/composite_function.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/function/source_function.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/parse/filter.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/parse/tile_mask.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/parse/vector_tile.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/src/mbgl/benchmark/benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/storage/offline_database.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/util/dtoa.benchmark.cpp
${PROJECT_SOURCE_DIR}/benchmark/util/tilecover.benchmark.cpp
)

target_include_directories(
mbgl-benchmark
PRIVATE ${PROJECT_SOURCE_DIR}/benchmark/src ${PROJECT_SOURCE_DIR}/platform/default/include ${PROJECT_SOURCE_DIR}/src
)

target_include_directories(
mbgl-benchmark
PUBLIC ${PROJECT_SOURCE_DIR}/benchmark/include ${PROJECT_SOURCE_DIR}/include
)

include(${PROJECT_SOURCE_DIR}/vendor/benchmark.cmake)

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

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

set_property(TARGET mbgl-benchmark PROPERTY FOLDER Core)
2 changes: 1 addition & 1 deletion benchmark/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
externalNativeBuild {
cmake {
version '3.10.2'
path '../../../next/CMakeLists.txt'
path '../../../CMakeLists.txt'
}
}
buildTypes {
Expand Down
10 changes: 5 additions & 5 deletions next/bin/CMakeLists.txt → bin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_executable(
mbgl-cache
${MBGL_ROOT}/bin/cache.cpp
${PROJECT_SOURCE_DIR}/bin/cache.cpp
)

target_link_libraries(
Expand All @@ -14,7 +14,7 @@ target_link_libraries(

add_executable(
mbgl-offline
${MBGL_ROOT}/bin/offline.cpp
${PROJECT_SOURCE_DIR}/bin/offline.cpp
)

target_link_libraries(
Expand All @@ -24,7 +24,7 @@ target_link_libraries(

add_executable(
mbgl-render
${MBGL_ROOT}/bin/render.cpp
${PROJECT_SOURCE_DIR}/bin/render.cpp
)

target_link_libraries(
Expand All @@ -37,6 +37,6 @@ install(TARGETS mbgl-offline mbgl-render RUNTIME DESTINATION bin)
# FIXME: CI must have a valid token
#
# add_test(NAME mbgl-offline-tool-test COMMAND mbgl-offline -s mapbox://styles/mapbox/satellite-v9 --maxZoom=0 WORKING_DIRECTORY
# ${MBGL_ROOT} )
# ${PROJECT_SOURCE_DIR} )
#
# add_test(NAME mbgl-render-tool-test COMMAND mbgl-render WORKING_DIRECTORY ${MBGL_ROOT} )
# add_test(NAME mbgl-render-tool-test COMMAND mbgl-render WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )
13 changes: 7 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ commands:
- run:
name: Configure
command: |
cmake next -B build << parameters.config_params >>
cmake . -B build << parameters.config_params >>
build:
parameters:
build_params:
Expand Down Expand Up @@ -320,7 +320,7 @@ jobs:
- run:
name: Build
command: |
cmake next -B Build -G Xcode -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_SYSROOT=iphonesimulator
cmake . -B Build -G Xcode -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_SYSROOT=iphonesimulator
cd Build && xcodebuild -sdk iphonesimulator -project Mapbox\ GL\ Native.xcodeproj -configuration Release
- save
ios-render-test-runner:
Expand All @@ -341,7 +341,7 @@ jobs:
name: Build IOS RenderTestApp
command: |
cd render-test/ios
cmake ../../next -B Build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DMBGL_IOS_RENDER_TEST=ON
cmake ../.. -B Build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DMBGL_IOS_RENDER_TEST=ON
cd Build
xcodebuild -sdk iphoneos -project Mapbox\ GL\ Native.xcodeproj -scheme RenderTestApp build-for-testing -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Release
xcodebuild -sdk iphoneos -project Mapbox\ GL\ Native.xcodeproj build -target RenderTestAppTests -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Release
Expand Down Expand Up @@ -391,8 +391,8 @@ jobs:
cd ../.. && mkdir -p /tmp/tests/ios-render-test
if ls render-test-app/TestLogs/*.html 1> /dev/null 2>&1; then cp render-test-app/TestLogs/*.html /tmp/tests/ios-render-test; fi
if [[ -n $(ls render-test-app/TestLogs/*.zip 2>/dev/null) ]]; then
cp render-test-app/TestLogs/*.zip metrics/next-ios-render-test-runner/
cd metrics/next-ios-render-test-runner/
cp render-test-app/TestLogs/*.zip metrics/ios-render-test-runner/
cd metrics/ios-render-test-runner/
unzip *.zip
rm -rf *.zip
fi
Expand Down Expand Up @@ -528,7 +528,8 @@ jobs:
- run:
name: CMake Format
command: |
cmake-format -i $(find next -type f -name CMakeLists.txt -o -name '*.cmake')
cmake-format -i $(find -name '*.cmake' -and -not -path './vendor/*/*' -and -not -path './build/*')
cmake-format -i $(find -name CMakeLists.txt -and -not -path './vendor/*/*' -and -not -path './build/*')
git diff --exit-code | tee nitpick.patch
- run:
name: Clang Format
Expand Down
38 changes: 38 additions & 0 deletions expression-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
add_executable(
mbgl-expression-test
${PROJECT_SOURCE_DIR}/expression-test/expression_test_logger.cpp
${PROJECT_SOURCE_DIR}/expression-test/expression_test_logger.hpp
${PROJECT_SOURCE_DIR}/expression-test/expression_test_parser.cpp
${PROJECT_SOURCE_DIR}/expression-test/expression_test_parser.hpp
${PROJECT_SOURCE_DIR}/expression-test/expression_test_runner.cpp
${PROJECT_SOURCE_DIR}/expression-test/expression_test_runner.hpp
${PROJECT_SOURCE_DIR}/expression-test/test_runner_common.cpp
${PROJECT_SOURCE_DIR}/expression-test/test_runner_common.hpp
${PROJECT_SOURCE_DIR}/expression-test/main.cpp
)

target_compile_definitions(
mbgl-expression-test
PRIVATE TEST_RUNNER_ROOT_PATH="${PROJECT_SOURCE_DIR}"
)

# FIXME: Should not use core private interface
target_include_directories(
mbgl-expression-test
PRIVATE ${PROJECT_SOURCE_DIR}/src
)

target_link_libraries(
mbgl-expression-test
PRIVATE
Mapbox::Base::Extras::args
Mapbox::Base::Extras::filesystem
Mapbox::Base::io
mbgl-core
)

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

string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_EXPRESSION_TEST_SEED)

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

0 comments on commit f7fef70

Please sign in to comment.