Add Bazel build file implementation (#419)
This commit is contained in:
1
.bazelversion
Normal file
1
.bazelversion
Normal file
@@ -0,0 +1 @@
|
||||
6.0.0-pre.20220630.1
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -38,3 +38,5 @@
|
||||
node_modules
|
||||
# Node binaries.
|
||||
/lib
|
||||
|
||||
/bazel-*
|
||||
|
||||
46
BUILD.bazel
Normal file
46
BUILD.bazel
Normal file
@@ -0,0 +1,46 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
|
||||
# This is defined by both
|
||||
# platform/default/filesource-files.json
|
||||
# and
|
||||
# src/core-files.json
|
||||
# because they have dependencies on each other
|
||||
cc_library(
|
||||
name = "mbgl-core",
|
||||
srcs = glob(
|
||||
[
|
||||
"src/**/*.cpp",
|
||||
"src/**/*.hpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
hdrs = glob(
|
||||
[
|
||||
"include/**/*.hpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
includes = [
|
||||
"include",
|
||||
"src",
|
||||
],
|
||||
local_defines = [
|
||||
r"MBGL_VERSION_REV=\"standalone\"",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor:boost",
|
||||
"//vendor:csscolorparser",
|
||||
"//vendor:earcut.hpp",
|
||||
"//vendor:eternal",
|
||||
"//vendor:icu",
|
||||
"//vendor:mapbox-base",
|
||||
"//vendor:parsedate",
|
||||
"//vendor:polylabel",
|
||||
"//vendor:protozero",
|
||||
"//vendor:unique_resource",
|
||||
"//vendor:vector-tile",
|
||||
"//vendor:wagyu",
|
||||
],
|
||||
)
|
||||
63
README.md
63
README.md
@@ -114,6 +114,69 @@ git checkout tags/$TAG -b $TAG
|
||||
# clean, if you need to troubleshoot build dependencies by using `make clean`
|
||||
```
|
||||
|
||||
## Build using Bazel
|
||||
|
||||
[Bazel](https://bazel.build) is also supported as a build option for getting a packaged release of the xcframework compiled for either static or dynamic linking.
|
||||
|
||||
Firstly you will have to ensure that Bazel is installed
|
||||
|
||||
`brew install baselisk`
|
||||
|
||||
From there you can use the script in platform/ios/platform/ios/scripts/package-bazel.sh
|
||||
|
||||
# There are 4 options:
|
||||
|
||||
`cd platform/ios/platform/ios/scripts`
|
||||
|
||||
Static xcframework compiled for release (this is default if no parameters are provided):
|
||||
`./bazel-package.sh --static --release`
|
||||
|
||||
Static xcframework compiled for debug:
|
||||
`./bazel-package.sh --static --debug`
|
||||
|
||||
Dynamic xcframework compiled for release:
|
||||
`./bazel-package.sh --dynamic --release`
|
||||
|
||||
Dynamic xcframework compiled for debug:
|
||||
`./bazel-package.sh --dynamic --debug`
|
||||
|
||||
All compiled frameworks will end up in the `bazel-bin/platform/ios/` path from the root of the repo.
|
||||
|
||||
Also you can use the link option to ensure that the framework is able to link.
|
||||
|
||||
`./bazel-package.sh --link`
|
||||
|
||||
# Bazel build files are placed in a few places throughout the project:
|
||||
|
||||
`BUILD.bazel`
|
||||
- Covering the base cpp in the root `src` directory.
|
||||
|
||||
`vendor/BUILD.bazel`
|
||||
- Covering the submodule dependencies of Maplibre.
|
||||
|
||||
`platform/default/BUILD.bazel`
|
||||
- Covering the cpp dependencies in default.
|
||||
|
||||
`platform/darwin/BUILD.bazel`
|
||||
- Covering the cpp source in platform/default.
|
||||
|
||||
`platform/ios/platform/ios/vendor/`
|
||||
- Covering the iOS specific dependencies.
|
||||
|
||||
`platform/ios/BUILD.bazel`
|
||||
- Covering the source in `platform/ios/platform/ios/src` and `platform/ios/platform/darwin/src` as well as defining all the other BUILD.bazel files and defining the xcframework targets.
|
||||
|
||||
# There are also some other areas that make bazel work:
|
||||
|
||||
`WORKSPACE`
|
||||
- Defines the "repo" and the different modules that are loaded in order to compile for Apple.
|
||||
|
||||
`.bazelversion`
|
||||
- Defines the version of bazel used, important for specific support for Apple targets.
|
||||
|
||||
`bazel/flags.bzl`
|
||||
- Defines some compilation flags that are used between the different build files.
|
||||
|
||||
### Android
|
||||
|
||||
---
|
||||
|
||||
38
WORKSPACE
Normal file
38
WORKSPACE
Normal file
@@ -0,0 +1,38 @@
|
||||
workspace(name = "Maplibre")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_rules_apple",
|
||||
sha256 = "a95d9007570cb5c6180b7e380bad2a854734209cc02390eed208efb922843c8a",
|
||||
strip_prefix = "rules_apple-76752fe84ff0dc5d793033015647c78efbf41309",
|
||||
url = "https://github.com/bazelbuild/rules_apple/archive/76752fe84ff0dc5d793033015647c78efbf41309.tar.gz",
|
||||
)
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_apple//apple:repositories.bzl",
|
||||
"apple_rules_dependencies",
|
||||
)
|
||||
|
||||
apple_rules_dependencies()
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_swift//swift:repositories.bzl",
|
||||
"swift_rules_dependencies",
|
||||
)
|
||||
|
||||
swift_rules_dependencies()
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_swift//swift:extras.bzl",
|
||||
"swift_rules_extra_dependencies",
|
||||
)
|
||||
|
||||
swift_rules_extra_dependencies()
|
||||
|
||||
load(
|
||||
"@build_bazel_apple_support//lib:repositories.bzl",
|
||||
"apple_support_dependencies",
|
||||
)
|
||||
|
||||
apple_support_dependencies()
|
||||
0
bazel/BUILD.bazel
Normal file
0
bazel/BUILD.bazel
Normal file
45
bazel/flags.bzl
Normal file
45
bazel/flags.bzl
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Compilation flags related to all targets.
|
||||
Applies to objective-c files that can't take the added CPP_FLAGS.
|
||||
Included in the CPP flags below.
|
||||
"""
|
||||
|
||||
WARNING_FLAGS = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wextra",
|
||||
"-Wno-c++11-narrowing",
|
||||
"-Wno-gnu-anonymous-struct",
|
||||
"-Wno-pointer-to-int-cast",
|
||||
"-Wno-tautological-constant-compare",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wno-unused-variable",
|
||||
"-Wno-variadic-macros",
|
||||
"-Wno-nested-anon-types",
|
||||
"-Wno-newline-eof",
|
||||
]
|
||||
|
||||
"""
|
||||
Compilation flags used for all .cpp and .mm targets.
|
||||
"""
|
||||
|
||||
CPP_FLAGS = WARNING_FLAGS + [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-ftemplate-depth=1024",
|
||||
"-std=c++14",
|
||||
]
|
||||
|
||||
"""
|
||||
Compilation flags related to the Maplibre codebase. Relevant for all .cpp .mm and .m code
|
||||
- src/*
|
||||
- include/*
|
||||
- platform/*
|
||||
Not important for any vendors that are imported.
|
||||
"""
|
||||
|
||||
MAPLIBRE_FLAGS = [
|
||||
"-DMBGL_USE_GLES2=1",
|
||||
"-DMBGL_RENDER_BACKEND_OPENGL=1",
|
||||
"-DGLES_SILENCE_DEPRECATION",
|
||||
]
|
||||
85
platform/darwin/BUILD.bazel
Normal file
85
platform/darwin/BUILD.bazel
Normal file
@@ -0,0 +1,85 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
||||
|
||||
# Objc files for the iOS source
|
||||
objc_library(
|
||||
name = "darwin-objc",
|
||||
srcs = [
|
||||
"src/native_apple_interface.m",
|
||||
],
|
||||
hdrs = [
|
||||
"include/mbgl/interface/native_apple_interface.h",
|
||||
"include/mbgl/storage/reachability.h",
|
||||
"include/mbgl/util/image+MGLAdditions.hpp",
|
||||
],
|
||||
copts = WARNING_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fmodules",
|
||||
],
|
||||
includes = [
|
||||
"include",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//:mbgl-core",
|
||||
"//platform/default:mbgl-default",
|
||||
],
|
||||
)
|
||||
|
||||
# Objcpp files for the iOS source
|
||||
objc_library(
|
||||
name = "darwin-objcpp",
|
||||
srcs = [
|
||||
"src/CFHandle.hpp",
|
||||
"src/collator.mm",
|
||||
"src/headless_backend_eagl.mm",
|
||||
"src/http_file_source.mm",
|
||||
"src/image.mm",
|
||||
"src/local_glyph_rasterizer.mm",
|
||||
"src/logging_nslog.mm",
|
||||
"src/nsthread.mm",
|
||||
"src/number_format.mm",
|
||||
"src/string_nsstring.mm",
|
||||
],
|
||||
hdrs = [
|
||||
"include/mbgl/interface/native_apple_interface.h",
|
||||
"include/mbgl/storage/reachability.h",
|
||||
"include/mbgl/util/image+MGLAdditions.hpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fcxx-modules",
|
||||
"-fmodules",
|
||||
"-Wno-vla-extension",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
],
|
||||
includes = [
|
||||
"include",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreText",
|
||||
"ImageIO",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//:mbgl-core",
|
||||
"//platform/default:mbgl-default",
|
||||
],
|
||||
)
|
||||
|
||||
# Loop files for iOS.
|
||||
objc_library(
|
||||
name = "darwin-loop",
|
||||
srcs = [
|
||||
"src/async_task.cpp",
|
||||
"src/gl_functions.cpp",
|
||||
"src/run_loop.cpp",
|
||||
"src/timer.cpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
sdk_frameworks = [
|
||||
"OpenGLES",
|
||||
"SystemConfiguration",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//:mbgl-core",
|
||||
],
|
||||
)
|
||||
56
platform/default/BUILD.bazel
Normal file
56
platform/default/BUILD.bazel
Normal file
@@ -0,0 +1,56 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
|
||||
# From: platform/ios/core-files.json
|
||||
# Mostly platform/default
|
||||
cc_library(
|
||||
name = "mbgl-default",
|
||||
srcs = [
|
||||
"src/mbgl/gfx/headless_backend.cpp",
|
||||
"src/mbgl/gfx/headless_frontend.cpp",
|
||||
"src/mbgl/gl/headless_backend.cpp",
|
||||
"src/mbgl/map/map_snapshotter.cpp",
|
||||
"src/mbgl/platform/time.cpp",
|
||||
"src/mbgl/storage/asset_file_source.cpp",
|
||||
"src/mbgl/storage/database_file_source.cpp",
|
||||
"src/mbgl/storage/file_source_manager.cpp",
|
||||
"src/mbgl/storage/file_source_request.cpp",
|
||||
"src/mbgl/storage/local_file_request.cpp",
|
||||
"src/mbgl/storage/local_file_source.cpp",
|
||||
"src/mbgl/storage/main_resource_loader.cpp",
|
||||
"src/mbgl/storage/mbtiles_file_source.cpp",
|
||||
"src/mbgl/storage/offline.cpp",
|
||||
"src/mbgl/storage/offline_database.cpp",
|
||||
"src/mbgl/storage/offline_download.cpp",
|
||||
"src/mbgl/storage/online_file_source.cpp",
|
||||
"src/mbgl/storage/sqlite3.cpp",
|
||||
"src/mbgl/text/bidi.cpp",
|
||||
"src/mbgl/util/compression.cpp",
|
||||
"src/mbgl/util/monotonic_timer.cpp",
|
||||
"src/mbgl/util/png_writer.cpp",
|
||||
"src/mbgl/util/thread_local.cpp",
|
||||
"src/mbgl/util/utf.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"include/mbgl/gfx/headless_backend.hpp",
|
||||
"include/mbgl/gfx/headless_frontend.hpp",
|
||||
"include/mbgl/gl/headless_backend.hpp",
|
||||
"include/mbgl/map/map_snapshotter.hpp",
|
||||
"include/mbgl/storage/file_source_request.hpp",
|
||||
"include/mbgl/storage/local_file_request.hpp",
|
||||
"include/mbgl/storage/merge_sideloaded.hpp",
|
||||
"include/mbgl/storage/offline_database.hpp",
|
||||
"include/mbgl/storage/offline_download.hpp",
|
||||
"include/mbgl/storage/offline_schema.hpp",
|
||||
"include/mbgl/storage/sqlite3.hpp",
|
||||
"include/mbgl/text/unaccent.hpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
includes = [
|
||||
"include",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-loop",
|
||||
],
|
||||
)
|
||||
334
platform/ios/BUILD.bazel
Normal file
334
platform/ios/BUILD.bazel
Normal file
@@ -0,0 +1,334 @@
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework")
|
||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework")
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
||||
|
||||
# This list of public headers is from what Mapbox vendors with their dynamic framework
|
||||
# If we forget one the build will fail, and if we add too many there will be a warning
|
||||
# (which also causes a build failure) so we don't need to worry too much about getting
|
||||
# this wrong
|
||||
# A combination of Mapbox.h and all its headers' imports as recursively
|
||||
_PUBLIC_HEADERS = [
|
||||
"platform/darwin/src/MGLAnnotation.h",
|
||||
"platform/darwin/src/MGLAttributedExpression.h",
|
||||
"platform/darwin/src/MGLAttributionInfo.h",
|
||||
"platform/darwin/src/MGLBackgroundStyleLayer.h",
|
||||
"platform/darwin/src/MGLCircleStyleLayer.h",
|
||||
"platform/darwin/src/MGLClockDirectionFormatter.h",
|
||||
"platform/darwin/src/MGLCluster.h",
|
||||
"platform/darwin/src/MGLCompassDirectionFormatter.h",
|
||||
"platform/darwin/src/MGLComputedShapeSource.h",
|
||||
"platform/darwin/src/MGLCoordinateFormatter.h",
|
||||
"platform/darwin/src/MGLDefaultStyle.h",
|
||||
"platform/darwin/src/MGLDistanceFormatter.h",
|
||||
"platform/darwin/src/MGLFeature.h",
|
||||
"platform/darwin/src/MGLFillExtrusionStyleLayer.h",
|
||||
"platform/darwin/src/MGLFillStyleLayer.h",
|
||||
"platform/darwin/src/MGLForegroundStyleLayer.h",
|
||||
"platform/darwin/src/MGLFoundation.h",
|
||||
"platform/darwin/src/MGLGeometry.h",
|
||||
"platform/darwin/src/MGLHeatmapStyleLayer.h",
|
||||
"platform/darwin/src/MGLHillshadeStyleLayer.h",
|
||||
"platform/darwin/src/MGLImageSource.h",
|
||||
"platform/darwin/src/MGLLight.h",
|
||||
"platform/darwin/src/MGLLineStyleLayer.h",
|
||||
"platform/darwin/src/MGLLocationManager.h",
|
||||
"platform/darwin/src/MGLLoggingConfiguration.h",
|
||||
"platform/darwin/src/MGLMapCamera.h",
|
||||
"platform/darwin/src/MGLMapSnapshotter.h",
|
||||
"platform/darwin/src/MGLMultiPoint.h",
|
||||
"platform/darwin/src/MGLNetworkConfiguration.h",
|
||||
"platform/darwin/src/MGLOfflinePack.h",
|
||||
"platform/darwin/src/MGLOfflineRegion.h",
|
||||
"platform/darwin/src/MGLOfflineStorage.h",
|
||||
"platform/darwin/src/MGLOpenGLStyleLayer.h",
|
||||
"platform/darwin/src/MGLOverlay.h",
|
||||
"platform/darwin/src/MGLPointAnnotation.h",
|
||||
"platform/darwin/src/MGLPointCollection.h",
|
||||
"platform/darwin/src/MGLPolygon.h",
|
||||
"platform/darwin/src/MGLPolyline.h",
|
||||
"platform/darwin/src/MGLRasterDEMSource.h",
|
||||
"platform/darwin/src/MGLRasterStyleLayer.h",
|
||||
"platform/darwin/src/MGLRasterTileSource.h",
|
||||
"platform/darwin/src/MGLSettings.h",
|
||||
"platform/darwin/src/MGLShape.h",
|
||||
"platform/darwin/src/MGLShapeCollection.h",
|
||||
"platform/darwin/src/MGLShapeOfflineRegion.h",
|
||||
"platform/darwin/src/MGLShapeSource.h",
|
||||
"platform/darwin/src/MGLSource.h",
|
||||
"platform/darwin/src/MGLStyle.h",
|
||||
"platform/darwin/src/MGLStyleLayer.h",
|
||||
"platform/darwin/src/MGLStyleValue.h",
|
||||
"platform/darwin/src/MGLSymbolStyleLayer.h",
|
||||
"platform/darwin/src/MGLTilePyramidOfflineRegion.h",
|
||||
"platform/darwin/src/MGLTileServerOptions.h",
|
||||
"platform/darwin/src/MGLTileSource.h",
|
||||
"platform/darwin/src/MGLTypes.h",
|
||||
"platform/darwin/src/MGLVectorStyleLayer.h",
|
||||
"platform/darwin/src/MGLVectorTileSource.h",
|
||||
"platform/darwin/src/NSExpression+MGLAdditions.h",
|
||||
"platform/darwin/src/NSPredicate+MGLAdditions.h",
|
||||
"platform/darwin/src/NSValue+MGLAdditions.h",
|
||||
"platform/ios/src/MGLAnnotationImage.h",
|
||||
"platform/ios/src/MGLAnnotationView.h",
|
||||
"platform/ios/src/MGLCalloutView.h",
|
||||
"platform/ios/src/MGLCameraChangeReason.h",
|
||||
"platform/ios/src/MGLCompassButton.h",
|
||||
"platform/ios/src/MGLMapProjection.h",
|
||||
"platform/ios/src/MGLMapView+IBAdditions.h",
|
||||
"platform/ios/src/MGLMapView.h",
|
||||
"platform/ios/src/MGLMapViewDelegate.h",
|
||||
"platform/ios/src/MGLUserLocation.h",
|
||||
"platform/ios/src/MGLUserLocationAnnotationView.h",
|
||||
"platform/ios/src/MGLUserLocationAnnotationViewStyle.h",
|
||||
]
|
||||
|
||||
apple_static_xcframework(
|
||||
name = "Mapbox.static",
|
||||
bundle_name = "Mapbox",
|
||||
ios = {
|
||||
"simulator": [
|
||||
"x86_64",
|
||||
"arm64",
|
||||
],
|
||||
"device": ["arm64"],
|
||||
},
|
||||
minimum_os_versions = {"ios": "9.0"},
|
||||
public_hdrs = _PUBLIC_HEADERS,
|
||||
umbrella_header = "platform/ios/src/Mapbox.h",
|
||||
deps = ["sdk"],
|
||||
)
|
||||
|
||||
apple_xcframework(
|
||||
name = "Mapbox.dynamic",
|
||||
bundle_name = "Mapbox",
|
||||
infoplists = ["build/Info.plist"],
|
||||
ios = {
|
||||
"simulator": [
|
||||
"x86_64",
|
||||
"arm64",
|
||||
],
|
||||
"device": ["arm64"],
|
||||
},
|
||||
minimum_os_versions = {"ios": "9.0"},
|
||||
public_hdrs = _PUBLIC_HEADERS,
|
||||
umbrella_header = "platform/ios/src/Mapbox.h",
|
||||
deps = ["sdk"],
|
||||
)
|
||||
|
||||
# This target allows you to link the SDK to emulate linking it in the app
|
||||
# This should help us find issues with missing symbols sooner.
|
||||
ios_framework(
|
||||
name = "Mapbox.link",
|
||||
bundle_id = "com.maplibre.link",
|
||||
families = ["iphone"],
|
||||
infoplists = ["build/Info.plist"],
|
||||
linkopts = ["-all_load"],
|
||||
minimum_os_version = "9.0",
|
||||
deps = ["sdk"],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "sdk",
|
||||
data = ["resources"],
|
||||
sdk_dylibs = [
|
||||
"libz",
|
||||
"libsqlite3",
|
||||
"libc++",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"MobileCoreServices",
|
||||
"Security",
|
||||
"WebKit",
|
||||
],
|
||||
deps = [
|
||||
"objc-sdk",
|
||||
"objcpp-sdk",
|
||||
],
|
||||
)
|
||||
|
||||
apple_resource_bundle(
|
||||
name = "resources",
|
||||
bundle_id = "com.maplibre.mapbox",
|
||||
bundle_name = "Mapbox",
|
||||
infoplists = ["build/Info-static.plist"],
|
||||
resources = glob([
|
||||
"platform/ios/resources/*.lproj/**",
|
||||
"platform/ios/resources/*.xcassets/**",
|
||||
]),
|
||||
)
|
||||
|
||||
# Objcpp files for the iOS source
|
||||
objc_library(
|
||||
name = "objcpp-sdk",
|
||||
srcs = [
|
||||
"platform/darwin/src/MGLAttributionInfo.mm",
|
||||
"platform/darwin/src/MGLBackgroundStyleLayer.mm",
|
||||
"platform/darwin/src/MGLCircleStyleLayer.mm",
|
||||
"platform/darwin/src/MGLComputedShapeSource.mm",
|
||||
"platform/darwin/src/MGLDefaultStyle.mm",
|
||||
"platform/darwin/src/MGLFeature.mm",
|
||||
"platform/darwin/src/MGLFillExtrusionStyleLayer.mm",
|
||||
"platform/darwin/src/MGLFillStyleLayer.mm",
|
||||
"platform/darwin/src/MGLForegroundStyleLayer.mm",
|
||||
"platform/darwin/src/MGLFoundation.mm",
|
||||
"platform/darwin/src/MGLGeometry.mm",
|
||||
"platform/darwin/src/MGLHeatmapStyleLayer.mm",
|
||||
"platform/darwin/src/MGLHillshadeStyleLayer.mm",
|
||||
"platform/darwin/src/MGLImageSource.mm",
|
||||
"platform/darwin/src/MGLLight.mm",
|
||||
"platform/darwin/src/MGLLineStyleLayer.mm",
|
||||
"platform/darwin/src/MGLLoggingConfiguration.mm",
|
||||
"platform/darwin/src/MGLMapCamera.mm",
|
||||
"platform/darwin/src/MGLMapSnapshotter.mm",
|
||||
"platform/darwin/src/MGLMultiPoint.mm",
|
||||
"platform/darwin/src/MGLNetworkConfiguration.mm",
|
||||
"platform/darwin/src/MGLOfflinePack.mm",
|
||||
"platform/darwin/src/MGLOfflineStorage.mm",
|
||||
"platform/darwin/src/MGLOpenGLStyleLayer.mm",
|
||||
"platform/darwin/src/MGLPointAnnotation.mm",
|
||||
"platform/darwin/src/MGLPointCollection.mm",
|
||||
"platform/darwin/src/MGLPolygon.mm",
|
||||
"platform/darwin/src/MGLPolyline.mm",
|
||||
"platform/darwin/src/MGLRasterDEMSource.mm",
|
||||
"platform/darwin/src/MGLRasterStyleLayer.mm",
|
||||
"platform/darwin/src/MGLRasterTileSource.mm",
|
||||
"platform/darwin/src/MGLSettings.mm",
|
||||
"platform/darwin/src/MGLShape.mm",
|
||||
"platform/darwin/src/MGLShapeCollection.mm",
|
||||
"platform/darwin/src/MGLShapeOfflineRegion.mm",
|
||||
"platform/darwin/src/MGLShapeSource.mm",
|
||||
"platform/darwin/src/MGLSource.mm",
|
||||
"platform/darwin/src/MGLStyle.mm",
|
||||
"platform/darwin/src/MGLStyleLayer.mm",
|
||||
"platform/darwin/src/MGLStyleLayerManager.mm",
|
||||
"platform/darwin/src/MGLStyleValue.mm",
|
||||
"platform/darwin/src/MGLSymbolStyleLayer.mm",
|
||||
"platform/darwin/src/MGLTilePyramidOfflineRegion.mm",
|
||||
"platform/darwin/src/MGLTileServerOptions.mm",
|
||||
"platform/darwin/src/MGLTileSource.mm",
|
||||
"platform/darwin/src/MGLVectorStyleLayer.mm",
|
||||
"platform/darwin/src/MGLVectorTileSource.mm",
|
||||
"platform/darwin/src/NSArray+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSBundle+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSCoder+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSDate+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSDictionary+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSExpression+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSPredicate+MGLAdditions.mm",
|
||||
"platform/darwin/src/NSValue+MGLStyleAttributeAdditions.mm",
|
||||
"platform/ios/src/MGLAnnotationView.mm",
|
||||
"platform/ios/src/MGLCompassButton.mm",
|
||||
"platform/ios/src/MGLFaux3DUserLocationAnnotationView.mm",
|
||||
"platform/ios/src/MGLMapAccessibilityElement.mm",
|
||||
"platform/ios/src/MGLMapProjection.mm",
|
||||
"platform/ios/src/MGLMapView.mm",
|
||||
"platform/ios/src/MGLMapView+Impl.mm",
|
||||
"platform/ios/src/MGLMapView+OpenGL.mm",
|
||||
"platform/ios/src/MGLScaleBar.mm",
|
||||
"platform/ios/src/UIColor+MGLAdditions.mm",
|
||||
"platform/ios/src/UIImage+MGLAdditions.mm",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fcxx-modules",
|
||||
"-fmodules",
|
||||
"-Wno-c99-extensions",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
"-Wno-gnu-statement-expression",
|
||||
],
|
||||
includes = [
|
||||
"platform/darwin/include",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreImage",
|
||||
"CoreLocation",
|
||||
"GLKit",
|
||||
"OpenGLES",
|
||||
"QuartzCore",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"objc-headers",
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-objcpp",
|
||||
"//platform/default:mbgl-default",
|
||||
"//platform/ios/platform/ios/vendor:SMCalloutView",
|
||||
],
|
||||
)
|
||||
|
||||
# platform/ios/sdk-files.json
|
||||
# Objc files for the iOS source
|
||||
objc_library(
|
||||
name = "objc-sdk",
|
||||
srcs = [
|
||||
"platform/darwin/src/MGLAttributedExpression.m",
|
||||
"platform/darwin/src/MGLClockDirectionFormatter.m",
|
||||
"platform/darwin/src/MGLCompassDirectionFormatter.m",
|
||||
"platform/darwin/src/MGLCoordinateFormatter.m",
|
||||
"platform/darwin/src/MGLDistanceFormatter.m",
|
||||
"platform/darwin/src/MGLLocationManager.m",
|
||||
"platform/darwin/src/MGLReachability.m",
|
||||
"platform/darwin/src/MGLRendererConfiguration.m",
|
||||
"platform/darwin/src/MGLTypes.m",
|
||||
"platform/darwin/src/NSString+MGLAdditions.m",
|
||||
"platform/darwin/src/NSURL+MGLAdditions.m",
|
||||
"platform/darwin/src/NSValue+MGLAdditions.m",
|
||||
"platform/ios/src/MGLAnnotationContainerView.m",
|
||||
"platform/ios/src/MGLAnnotationImage.m",
|
||||
"platform/ios/src/MGLCompactCalloutView.m",
|
||||
"platform/ios/src/MGLUserLocation.m",
|
||||
"platform/ios/src/MGLUserLocationAnnotationView.m",
|
||||
"platform/ios/src/MGLUserLocationAnnotationViewStyle.m",
|
||||
"platform/ios/src/MGLUserLocationHeadingArrowLayer.m",
|
||||
"platform/ios/src/MGLUserLocationHeadingBeamLayer.m",
|
||||
"platform/ios/src/NSOrthography+MGLAdditions.m",
|
||||
"platform/ios/src/UIDevice+MGLAdditions.m",
|
||||
"platform/ios/src/UIView+MGLAdditions.m",
|
||||
"platform/ios/src/UIViewController+MGLAdditions.m",
|
||||
],
|
||||
hdrs = [
|
||||
"platform/darwin/include/mbgl/util/image+MGLAdditions.hpp",
|
||||
],
|
||||
copts = WARNING_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fmodules",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-variadic-macros",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
],
|
||||
includes = [
|
||||
"platform/darwin/include",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"objc-headers",
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-objc",
|
||||
"//platform/default:mbgl-default",
|
||||
"//platform/ios/platform/ios/vendor:SMCalloutView",
|
||||
],
|
||||
)
|
||||
|
||||
# Common headers between objc and objcpp libraries.
|
||||
objc_library(
|
||||
name = "objc-headers",
|
||||
srcs = glob([
|
||||
"platform/darwin/src/*.h",
|
||||
"platform/ios/src/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"platform/darwin/src",
|
||||
"platform/ios/src",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreGraphics",
|
||||
"CoreLocation",
|
||||
"QuartzCore",
|
||||
],
|
||||
deps = [
|
||||
"//platform/darwin:darwin-objc",
|
||||
"//platform/darwin:darwin-objcpp",
|
||||
],
|
||||
)
|
||||
91
platform/ios/platform/ios/scripts/bazel-package.sh
Executable file
91
platform/ios/platform/ios/scripts/bazel-package.sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# "static" or "dynamic"
|
||||
build_type="static"
|
||||
|
||||
# "release" or "debug"
|
||||
release_type="release"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--static)
|
||||
build_type="static"
|
||||
shift
|
||||
;;
|
||||
--dynamic)
|
||||
build_type="dynamic"
|
||||
shift
|
||||
;;
|
||||
--release)
|
||||
release_type="release"
|
||||
shift
|
||||
;;
|
||||
--debug)
|
||||
release_type="debug"
|
||||
shift
|
||||
;;
|
||||
--link)
|
||||
build_type="link"
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
echo "Build the maplibre xcframework using the bazel build files. You must install Baselisk to build using this method."
|
||||
echo "Usage: .bazel-package.sh --static|--dynamic --release|--debug"
|
||||
echo "Defaults to \"--static --release\""
|
||||
exit 1
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "------ Build type: $build_type Release type: $release_type ------"
|
||||
|
||||
target="Mapbox.$build_type"
|
||||
|
||||
compilation_mode="opt"
|
||||
if [ "$release_type" = "debug" ]; then
|
||||
compilation_mode="dbg"
|
||||
fi;
|
||||
|
||||
pushd ../../../../../
|
||||
|
||||
echo "------ Determining Maplibre version and hash ------"
|
||||
|
||||
sem_version=$(git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//')
|
||||
hash=$(git log | head -1 | awk '{ print $2 }' | cut -c 1-10) && true
|
||||
|
||||
# Move and configure the info plists with the semantic version and hash.
|
||||
temp_info_static_plist="platform/ios/build/Info-static.plist"
|
||||
temp_info_plist="platform/ios/build/Info.plist"
|
||||
|
||||
if [ ! -d platform/ios/build ]; then
|
||||
mkdir platform/ios/build
|
||||
fi
|
||||
|
||||
cp platform/ios/platform/ios/framework/Info-static.plist "$temp_info_static_plist"
|
||||
cp platform/ios/platform/ios/framework/Info.plist "$temp_info_plist"
|
||||
|
||||
plutil -replace MGLSemanticVersionString -string "$sem_version" "$temp_info_static_plist"
|
||||
plutil -replace MGLCommitHash -string "$hash" "$temp_info_static_plist"
|
||||
plutil -replace MGLSemanticVersionString -string "$sem_version" "$temp_info_plist"
|
||||
plutil -replace MGLCommitHash -string "$hash" "$temp_info_plist"
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
bazel build //platform/ios:"$target" --apple_platform_type=ios \
|
||||
--apple_generate_dsym \
|
||||
--compilation_mode="$compilation_mode" \
|
||||
--features=dead_strip \
|
||||
--objc_enable_binary_stripping \
|
||||
--copt=-Wall --copt=-Wextra --copt=-Wpedantic \
|
||||
--copt=-Werror
|
||||
|
||||
popd
|
||||
|
||||
echo "Done."
|
||||
echo "Package will be available in \"/bazel-bin/platform/ios/platform/ios/$target.xcframework.zip\""
|
||||
22
platform/ios/platform/ios/vendor/BUILD.bazel
vendored
Normal file
22
platform/ios/platform/ios/vendor/BUILD.bazel
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
load("//bazel:flags.bzl", "WARNING_FLAGS")
|
||||
|
||||
# SMCalloutView
|
||||
objc_library(
|
||||
name = "SMCalloutView",
|
||||
srcs = glob(
|
||||
[
|
||||
"SMCalloutView/*.h",
|
||||
"SMCalloutView/*.m",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
hdrs = glob(
|
||||
[
|
||||
"SMCalloutView/*.h",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = WARNING_FLAGS,
|
||||
includes = ["SMCalloutView"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
196
vendor/BUILD.bazel
vendored
Normal file
196
vendor/BUILD.bazel
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS")
|
||||
|
||||
# vendor/mapbox-base-files.json
|
||||
cc_library(
|
||||
name = "mapbox-base",
|
||||
hdrs = glob(
|
||||
[
|
||||
"mapbox-base/deps/cheap-ruler-cpp/include/mapbox/*.hpp",
|
||||
"mapbox-base/deps/geojson-vt-cpp/include/**/*.hpp",
|
||||
"mapbox-base/deps/geojson.hpp/include/**/*.hpp",
|
||||
"mapbox-base/deps/geometry.hpp/include/**/*.hpp",
|
||||
"mapbox-base/deps/jni.hpp/include/jni/*.hpp",
|
||||
"mapbox-base/deps/pixelmatch-cpp/include/mapbox/*.hpp",
|
||||
"mapbox-base/deps/shelf-pack-cpp/include/**/*.hpp",
|
||||
"mapbox-base/deps/supercluster.hpp/include/*.hpp",
|
||||
"mapbox-base/deps/variant/include/mapbox/*.hpp",
|
||||
"mapbox-base/extras/expected-lite/include/**/*.hpp",
|
||||
"mapbox-base/extras/filesystem/include/ghc/*.hpp",
|
||||
"mapbox-base/extras/kdbush.hpp/include/*.hpp",
|
||||
"mapbox-base/extras/rapidjson/include/**/*.h",
|
||||
"mapbox-base/include/mapbox/**/*.hpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
exclude = ["mapbox-base/deps/jni.hpp/include/jni/string_conversion.hpp"],
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
defines = ["RAPIDJSON_HAS_STDSTRING=1"],
|
||||
includes = [
|
||||
"mapbox-base/deps/cheap-ruler-cpp/include",
|
||||
"mapbox-base/deps/geojson.hpp/include",
|
||||
"mapbox-base/deps/geojson-vt-cpp/include",
|
||||
"mapbox-base/deps/geometry.hpp/include",
|
||||
"mapbox-base/deps/jni.hpp/include",
|
||||
"mapbox-base/deps/pixelmatch-cpp/include",
|
||||
"mapbox-base/deps/shelf-pack-cpp/include",
|
||||
"mapbox-base/deps/supercluster.hpp/include",
|
||||
"mapbox-base/deps/variant/include",
|
||||
"mapbox-base/extras/expected-lite/include",
|
||||
"mapbox-base/extras/filesystem/include",
|
||||
"mapbox-base/extras/kdbush.hpp/include",
|
||||
"mapbox-base/extras/rapidjson/include",
|
||||
"mapbox-base/include",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["optional"],
|
||||
)
|
||||
|
||||
# vendor/parsedate
|
||||
cc_library(
|
||||
name = "parsedate",
|
||||
srcs = ["parsedate/parsedate.cpp"],
|
||||
hdrs = glob(
|
||||
[
|
||||
"parsedate/**/*.hpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["parsedate"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/optional
|
||||
cc_library(
|
||||
name = "optional",
|
||||
hdrs = glob(
|
||||
[
|
||||
"mapbox-base/deps/optional/*.hpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["mapbox-base/deps/optional"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/csscolorparser
|
||||
cc_library(
|
||||
name = "csscolorparser",
|
||||
srcs = glob(
|
||||
[
|
||||
"csscolorparser/**/*.hpp",
|
||||
"csscolorparser/**/*.cpp",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["csscolorparser"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["optional"],
|
||||
)
|
||||
|
||||
# vendor/wagyu-files.json
|
||||
cc_library(
|
||||
name = "wagyu",
|
||||
hdrs = glob(
|
||||
["wagyu/include/mapbox/geometry/wagyu/*.hpp"],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["wagyu/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/boost-files.json
|
||||
cc_library(
|
||||
name = "boost",
|
||||
hdrs = glob(
|
||||
[
|
||||
"boost/include/boost/**/*.hpp",
|
||||
"boost/include/boost/**/*.h",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["boost/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/protozero-files.json
|
||||
cc_library(
|
||||
name = "protozero",
|
||||
hdrs = glob(
|
||||
["protozero/include/protozero/*.hpp"],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["protozero/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/earcut.hpp-files.json
|
||||
cc_library(
|
||||
name = "earcut.hpp",
|
||||
hdrs = ["earcut.hpp/include/mapbox/earcut.hpp"],
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["earcut.hpp/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/eternal-files.json
|
||||
cc_library(
|
||||
name = "eternal",
|
||||
hdrs = ["eternal/include/mapbox/eternal.hpp"],
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["eternal/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/polylabel-files.json
|
||||
cc_library(
|
||||
name = "polylabel",
|
||||
hdrs = ["polylabel/include/mapbox/polylabel.hpp"],
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["polylabel/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/unique_resource-files.json
|
||||
cc_library(
|
||||
name = "unique_resource",
|
||||
hdrs = ["unique_resource/unique_resource.hpp"],
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["unique_resource"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/vector-tile-files.json
|
||||
cc_library(
|
||||
name = "vector-tile",
|
||||
hdrs = glob(
|
||||
["vector-tile/include/mapbox/**/*.hpp"],
|
||||
allow_empty = False,
|
||||
),
|
||||
copts = CPP_FLAGS,
|
||||
includes = ["vector-tile/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# vendor/icu-files.json
|
||||
cc_library(
|
||||
name = "icu",
|
||||
srcs = glob(
|
||||
[
|
||||
"icu/src/*.cpp",
|
||||
"icu/src/*.h",
|
||||
],
|
||||
allow_empty = False,
|
||||
),
|
||||
hdrs = glob(["icu/include/unicode/*.h"]),
|
||||
copts = CPP_FLAGS + [
|
||||
"-Wno-c11-extensions",
|
||||
],
|
||||
includes = ["icu/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
Reference in New Issue
Block a user