Allow configuring iOS build with CMake (#3234)

This commit is contained in:
Bart Louwers
2025-02-28 14:25:36 +01:00
committed by GitHub
parent 7562931a43
commit b09235b41e
45 changed files with 696 additions and 954 deletions

View File

@@ -73,6 +73,20 @@ bazel run //platform/ios:App --//:renderer=metal
You can also build targets from the command line. For example, if you want to build your own XCFramework, see the 'Build XCFramework' step in the [iOS CI workflow](../../.github/workflows/ios-ci.yml).
## Swift App
## CMake
There is also an example app built with Swift instead of Objective-C. The target is called `MapLibreApp` and the source code lives in `platform/ios/app-swift`.
It is also possible to generate an Xcode project using CMake. As of February 2025, targets `mbgl-core`, `ios-sdk-static` and `app` (Objective-C development app) are supported.
```
cmake --preset ios -DDEVELOPMENT_TEAM_ID=YOUR_TEAM_ID
xed build-ios/MapLibre\ Native.xcodeproj
```
## Distribution
MapLibre iOS is distributed as an XCFramework via the [maplibre/maplibre-gl-native-distribution](https://github.com/maplibre/maplibre-gl-native-distribution) repository. See [Release MapLibre iOS](./release.md) for the release process. Refer to the [`ios-ci.yml`](https://github.com/maplibre/maplibre-native/blob/main/.github/workflows/ios-ci.yml) workflow for an up-to-date recipe for building an XCFramework. As of February 2025 we use:
```
bazel build --compilation_mode=opt --features=dead_strip,thin_lto --objc_enable_binary_stripping \
--apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)"
```

View File

@@ -48,9 +48,12 @@ In 2023 we co-opted Bazel as a build tool (generator), mostly due to it having b
| Platform | CMake | Bazel |
|---|---|---|
| Android | ✅ (via Gradle) | ❌ |
| iOS | ❌ | ✅ |
| iOS | ✅[^3] | ✅ |
| Linux | ✅ | ✅ |
| Windows | ✅ | ❌ |
| Windows | ✅ | ✅ |
| macOS | ✅ | ✅ |
| Node.js | ✅ | ❌ |
| Qt | ✅ | ❌ |
[^3]: Some targets are supported, see [here](ios/README.md#cmake).