361 lines
13 KiB
Python
361 lines
13 KiB
Python
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",
|
|
visibility = ["//visibility:public"],
|
|
deps = ["sdk"],
|
|
)
|
|
|
|
apple_xcframework(
|
|
name = "Mapbox.dynamic",
|
|
bundle_id = "com.maplibre.mapbox",
|
|
bundle_name = "Mapbox",
|
|
data = glob([
|
|
"platform/ios/resources/*.lproj/**",
|
|
"platform/ios/resources/*.xcassets/**",
|
|
]),
|
|
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",
|
|
visibility = ["//visibility:public"],
|
|
deps = ["sdk-dynamic"],
|
|
)
|
|
|
|
# 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"],
|
|
)
|
|
|
|
# sdk for the static target which includes the resources.
|
|
objc_library(
|
|
name = "sdk",
|
|
data = ["resources"],
|
|
sdk_dylibs = [
|
|
"libz",
|
|
"libsqlite3",
|
|
"libc++",
|
|
],
|
|
sdk_frameworks = [
|
|
"MobileCoreServices",
|
|
"Security",
|
|
"WebKit",
|
|
],
|
|
deps = [
|
|
"objc-sdk",
|
|
"objcpp-sdk",
|
|
],
|
|
)
|
|
|
|
# sdk for the dynamic target. Lacking the resources bundle since for dynamic
|
|
# they are in the main package.
|
|
objc_library(
|
|
name = "sdk-dynamic",
|
|
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",
|
|
],
|
|
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",
|
|
],
|
|
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",
|
|
],
|
|
)
|