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

Allow configuring iOS build with CMake #3234

Merged
merged 23 commits into from
Feb 28, 2025
Merged
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
9 changes: 7 additions & 2 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
bazel-bin
.git
node_modules
bazel-out
bazel-bin
bazel-testlogs
node_modules
.cache
.idea
.vscode
.cxx
10 changes: 4 additions & 6 deletions .github/changed-files.yml
Original file line number Diff line number Diff line change
@@ -9,10 +9,11 @@ linux:
- 'vendor/**'
- 'CMakeLists.txt'
- 'metrics/linux-gcc8-release-style.json'
- 'WORKSPACE'
- 'MODULE.bazel'
- 'BUILD.bazel'
- '.bazelrc'
- '.bazelversion'
- '.bazelignore'
- '!**/*.md'
windows:
- '.github/workflows/windows-ci.yml'
@@ -26,10 +27,6 @@ windows:
- 'metrics/**'
- 'vendor/**'
- '.gitmodules'
- 'WORKSPACE'
- 'BUILD.bazel'
- '.bazelrc'
- '.bazelversion'
- '!**/*.md'
ios:
- 'platform/ios/**'
@@ -46,10 +43,11 @@ ios:
- 'test/**'
- 'vendor/**'
- '.gitmodules'
- 'WORKSPACE'
- 'MODULE.bazel'
- 'BUILD.bazel'
- '.bazelrc'
- '.bazelversion'
- '.bazelignore'
- 'pnpm-lock.yaml'
- '!**/*.md'
android:
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-android-api.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
run: ./gradlew dokkaGenerate

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: platform/android/MapLibreAndroid/build/dokka/html
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-android-examples.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
run: make mkdocs-build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: platform/android/site
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-cpp-api.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
run: doxygen

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: docs/doxygen/html
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-docc.yml
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ jobs:
rm docs.zip

- name: Deploy DocC documentation (main) 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: build/docs
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-mdbook.yml
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ jobs:
name: book
path: artifacts/book
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: artifacts/book
2 changes: 1 addition & 1 deletion .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ jobs:
arch: ${{ matrix.compiler_type }}

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v5
uses: seanmiddleditch/gha-setup-ninja@v6

- name: Download Qt
uses: jurplel/install-qt-action@v4
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
/mapbox-gl-native-android/MapLibreAndroid/mapbox-gl-native
/mapbox-gl-native-android/MapLibreAndroidTestApp/mapbox-gl-native
/platform/android/MapLibreAndroidTestApp/src/main/res/values/developer-config.xml

/platform/android/gradle/configuration.gradle
/platform/android/arm64-v8a
/platform/android/armeabi-v7a
/platform/android/MapLibreAndroid/.cxx
/platform/android/MapLibreAndroid/build
/platform/android/MapLibrePlugin/build
/platform/android/MapLibreAndroidTestApp/.cxx
/platform/android/MapLibreAndroidTestApp/build
/platform/android/buildSrc/build
/platform/android/x86
/platform/android/x86_64
/cmake-build-debug
/platform/android/build
/platform/android/MapLibreAndroid/src/main/assets/sdk_versions/com.mapbox.mapboxsdk
/platform/ios/platform/ios/Mapbox.playground/build/
/platform/windows/vendor/mesa3d/
*.code-workspace

@@ -35,14 +30,11 @@ compile_commands.json
/platform/android/signing-key.text
/platform/android/.java-version
*.hprof
/platform/ios/platform/ios/benchmark/assets/tiles/tiles
/platform/ios/platform/ios/benchmark/assets/glyphs/Roboto Regular,Noto Sans Regular
/platform/ios/platform/ios/benchmark/assets/glyphs/Roboto Medium,Noto Sans Regular
/platform/ios/platform/ios/benchmark/assets/glyphs/Roboto Condensed Italic,Noto Sans Italic
/platform/ios/platform/ios/benchmark/assets/glyphs/Noto Sans Regular
/platform/android/key.json
/platform/android/site
node_modules
.cxx

# Node binaries.
/lib

@@ -59,5 +51,4 @@ __generated__
cache.sqlite
cache.sqlite-journal
out.png
/test/android/app/.cxx
/test/android/app/build
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ bazel_dep(name = "rules_rust", version = "0.57.1")
bazel_dep(name = "cxx.rs", version = "1.0.136")
git_override(
module_name = "cxx.rs",
commit = "fb8fdc0b20ddca8df80f6638bc773dc4824a8092",
commit = "94e8e46066b560fb9dc8964f047f68d066786916",
remote = "https://github.com/dtolnay/cxx.git",
)

Binary file modified benchmark/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion benchmark/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion benchmark/android/gradlew
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
11 changes: 11 additions & 0 deletions platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,17 @@

### 🐞 Bug fixes

## 11.8.2

### ✨ Features and improvements

- Eliminate copies in deferred cleanup ([#3035](https://github.com/maplibre/maplibre-native/pull/3035)).
- (Custom Layer Support) Reset depth stencil state for render pass ([#3230](https://github.com/maplibre/maplibre-native/pull/3230)).

### 🐞 Bug fixes

- Fix texture view cleanup ([#3254](https://github.com/maplibre/maplibre-native/pull/3254)). Possible fix for [issue](https://github.com/maplibre/maplibre-native/issues/3241) reported by Lyft.

## 11.8.1

> [!NOTE]
2 changes: 1 addition & 1 deletion platform/android/MapLibreAndroid/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=11.8.1
VERSION_NAME=11.8.2

# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20
Original file line number Diff line number Diff line change
@@ -15,6 +15,16 @@ public VulkanTextureViewRenderThread(@NonNull TextureView textureView, @NonNull
super(textureView, mapRenderer);
}

void cleanup() {
if (surface == null) {
return;
}

mapRenderer.onSurfaceDestroyed();
surface.release();
surface = null;
}

// Thread implementation

@Override
@@ -121,6 +131,7 @@ public void run() {

// Signal we're done
synchronized (lock) {
cleanup();
this.exited = true;
lock.notifyAll();
}
Binary file modified platform/android/MapLibrePlugin/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion platform/android/MapLibrePlugin/gradlew
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
2 changes: 1 addition & 1 deletion platform/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions platform/darwin/bazel/files.bzl
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@ MLN_DARWIN_OBJC_HEADERS = [
"src/MLNStyle.h",
"src/MLNStyleLayer.h",
"src/MLNStyleValue.h",
"src/MLNTileOperation.h",
"src/MLNTilePyramidOfflineRegion.h",
"src/MLNTileServerOptions.h",
"src/MLNTileSource.h",
13 changes: 13 additions & 0 deletions platform/darwin/src/MLNTileOperation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, MLNTileOperation) {
MLNTileOperationRequestedFromCache, ///< A read request from the cache
MLNTileOperationRequestedFromNetwork, ///< A read request from the online source
MLNTileOperationLoadFromNetwork, ///< Tile data from the network has been retrieved
MLNTileOperationLoadFromCache, ///< Tile data from the cache has been retrieved
MLNTileOperationStartParse, ///< Background processing of tile data has been initiated
MLNTileOperationEndParse, ///< Background processing of tile data has been completed
MLNTileOperationError, ///< An error occurred while loading the tile
MLNTileOperationCancelled, ///< Loading of a tile was cancelled
MLNTileOperationNullOp, ///< No operation has taken place
};
1 change: 1 addition & 0 deletions platform/ios/MapLibre.docc/MapLibre.md
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ Powerful, free and open-source mapping toolkit with full control over data sourc

### Advanced

- <doc:ObserverExample>
- <doc:CustomStyleLayerExample>

### Other Articles
113 changes: 113 additions & 0 deletions platform/ios/MapLibre.docc/ObserverExample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Observe Low-Level Events

Learn about the ``MLNMapViewDelegate`` methods for observing map events.

> Warning: These methods are not thread-safe.

You can observe certain low-level events as they happen. Use these methods to collect metrics or investigate issues during map rendering. This feature is intended primarily for power users. We are always interested in improving observability, so if you have a special use case, feel free to [open an issue or pull request](https://github.com/maplibre/maplibre-native) to extend the types of observability methods.

## Shader Events

Observe shader compilation with ``MLNMapViewDelegate/mapView:shaderWillCompile:backend:defines:`` and ``MLNMapViewDelegate/mapView:shaderDidCompile:backend:defines:``.

<!-- include-example(ObserverExampleShaders) -->

```swift
func mapView(_: MLNMapView, shaderWillCompile id: Int, backend: Int, defines: String) {
print("A new shader is being compiled - shaderID:\(id), backend type:\(backend), program configuration:\(defines)")
}

func mapView(_: MLNMapView, shaderDidCompile id: Int, backend: Int, defines: String) {
print("A shader has been compiled - shaderID:\(id), backend type:\(backend), program configuration:\(defines)")
}
```

See also: ``MLNMapViewDelegate/mapView:shaderDidFailCompile:backend:defines:``.

## Glyph Loading

Observe glyph loading events with ``MLNMapViewDelegate/mapView:glyphsWillLoad:range:`` and ``MLNMapViewDelegate/mapView:glyphsDidLoad:range:``.

<!-- include-example(ObserverExampleGlyphs) -->

```swift
func mapView(_: MLNMapView, glyphsWillLoad fontStack: [String], range: NSRange) {
print("Glyphs are being requested for the font stack \(fontStack), ranging from \(range.location) to \(range.location + range.length)")
}

func mapView(_: MLNMapView, glyphsDidLoad fontStack: [String], range: NSRange) {
print("Glyphs have been loaded for the font stack \(fontStack), ranging from \(range.location) to \(range.location + range.length)")
}
```

See also: ``MLNMapViewDelegate/mapView:glyphsDidError:range:``.

## Tile Events

Monitor tile-related actions using the delegate method ``MLNMapViewDelegate/mapView:tileDidTriggerAction:x:y:z:wrap:overscaledZ:sourceID:`` with the ``MLNTileOperation`` type.

<!-- include-example(ObserverExampleTiles) -->

```swift
func mapView(_: MLNMapView, tileDidTriggerAction operation: MLNTileOperation,
x: Int,
y: Int,
z: Int,
wrap: Int,
overscaledZ: Int,
sourceID: String)
{
let tileStr = String(format: "(x: %ld, y: %ld, z: %ld, wrap: %ld, overscaledZ: %ld, sourceID: %@)",
x, y, z, wrap, overscaledZ, sourceID)

switch operation {
case MLNTileOperation.requestedFromCache:
print("Requesting tile \(tileStr) from cache")

case MLNTileOperation.requestedFromNetwork:
print("Requesting tile \(tileStr) from network")

case MLNTileOperation.loadFromCache:
print("Loading tile \(tileStr), requested from the cache")

case MLNTileOperation.loadFromNetwork:
print("Loading tile \(tileStr), requested from the network")

case MLNTileOperation.startParse:
print("Parsing tile \(tileStr)")

case MLNTileOperation.endParse:
print("Completed parsing tile \(tileStr)")

case MLNTileOperation.error:
print("An error occured during proccessing for tile \(tileStr)")

case MLNTileOperation.cancelled:
print("Pending work on tile \(tileStr)")

case MLNTileOperation.nullOp:
print("An unknown tile operation was emitted for tile \(tileStr)")

@unknown default:
assertionFailure()
}
}
```

## Sprite Loading

Observe sprite loading events with ``MLNMapViewDelegate/mapView:spriteWillLoad:url:`` and ``MLNMapViewDelegate/mapView:spriteDidLoad:url:``.

<!-- include-example(ObserverExampleSprites) -->

```swift
func mapView(_: MLNMapView, spriteWillLoad id: String, url: String) {
print("The sprite \(id) has been requested from \(url)")
}

func mapView(_: MLNMapView, spriteDidLoad id: String, url: String) {
print("The sprite \(id) has been loaded from \(url)")
}
```

See also: ``MLNMapViewDelegate/mapView:spriteDidError:url:``.
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.