108 lines
5.3 KiB
Markdown
108 lines
5.3 KiB
Markdown
# Mapbox GL Native SDK Open-Source Fork
|
||
|
||
For iOS and Android
|
||
|
||
MapLibre GL Native is a community led fork derived from [mapbox-gl-native](https://github.com/mapbox/mapbox-gl-native) prior to their switch to a non-OSS license. The fork also includes Maps SDK for iOS and MacOS (forked from [mapbox-gl-native-ios](https://github.com/mapbox/mapbox-gl-native-ios)) and Android SDK (forked from [mapbox-gl-native-android](https://github.com/mapbox/mapbox-gl-native-android)). These platform-specific SDKs were merged under platform directory and they reference mapbox-gl-native directly, not as a submodule.
|
||
|
||
Beside merging in platform specific SDKs, the following changes were made compared to original mapbox projects:
|
||
|
||
* The code was upgraded so that it can be built using latest clang compiler / Xcode 12.
|
||
* CI/CD was migrated from CircleCI to GitHub Actions.
|
||
* Along with GitHub releases, binaries are distributed as follows:
|
||
* The iOS binaries distribution was upgraded from fat packages to Swift package containing XCFramework.
|
||
* The Android binaries are distributed to GitHub maven package repository.
|
||
|
||
> The mapbox-gl-native was forked from [d60fd30 - mgbl 1.6.0](https://github.com/mapbox/mapbox-gl-native/tree/d60fd302b1f6563e7d16952f8855122fdcc85f73), mapbox-gl-native-ios from [a139216](https://github.com/mapbox/mapbox-gl-native-ios/commit/a139216) and mapbox-gl-native-android from [4c12fb2](https://github.com/mapbox/mapbox-gl-native-android/commit/4c12fb2c)
|
||
## Build Status
|
||
|
||
| SDK | Build | Build status |
|
||
|---------------------------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||
| [Mapbox Maps SDK for iOS](platform/ios/) | CI | [](https://github.com/maplibre/maplibre-gl-native/workflows/ios-ci) |
|
||
| [Mapbox Maps SDK for iOS](platform/ios/) | Release | [](https://github.com/maplibre/maplibre-gl-native/workflows/ios-release) |
|
||
| [Mapbox Maps SDK for Android](platform/android/) | CI | [](https://github.com/maplibre/maplibre-gl-native/workflows/android-ci) |
|
||
| [Mapbox Maps SDK for Android](platform/android/) | Release | [](https://github.com/maplibre/maplibre-gl-native/workflows/android-release) |
|
||
|
||
## Installation
|
||
|
||
### Android
|
||
|
||
1. Add bintray maven repositories to your build.gradle at project level so that you can access MapLibre packages for Android:
|
||
|
||
```gradle
|
||
allprojects {
|
||
repositories {
|
||
...
|
||
maven {
|
||
url = "https://dl.bintray.com/maplibre/maplibre-gl-native"
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
2. Add the library as a dependency into your module build.gradle
|
||
|
||
```gradle
|
||
dependencies {
|
||
...
|
||
implementation 'org.maplibre.gl:android-sdk:9.2.1'
|
||
...
|
||
}
|
||
```
|
||
|
||
3. Sync gradle and rebuild your app
|
||
|
||
### iOS
|
||
|
||
1. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL. You can also navigate to your target’s General pane, and in the “Frameworks, Libraries, and Embedded Content” section, click the + button, select Add Other, and choose Add Package Dependency.
|
||
|
||
2. Either add MapLibre GitHub distribution URL (https://github.com/maplibre/maplibre-gl-native-distribution) or search for `maplibre-gl-native` package.
|
||
|
||
3. Choose "next". Xcode should clone the distribution repository and download the binaries.
|
||
|
||
## Alternative installation
|
||
|
||
You can also download pre-build from releases in this repository.
|
||
|
||
## How to create your own build
|
||
|
||
### Source code checkout
|
||
|
||
```bash
|
||
git clone --recurse-submodules https://github.com/maplibre/maplibre-gl-native.git
|
||
```
|
||
|
||
### Build
|
||
|
||
#### Android
|
||
|
||
> Make sure you have set Android SDK path in platform/android/local.properties, variable sdk.dir
|
||
|
||
```bash
|
||
cd platform/android
|
||
BUILDTYPE=Release make apackage
|
||
```
|
||
|
||
Binaries are produced in `platform/android/MapboxGLAndroidSDK/build/outputs/aar/MapboxGLAndroidSDK-release.aar`
|
||
Please refer to [Mapbox Maps SDK for Android](platform/android/) for detailed instructions.
|
||
|
||
#### iOS
|
||
|
||
```bash
|
||
cd platform/ios
|
||
make xcframework BUILDTYPE=Release
|
||
```
|
||
|
||
The packaging script will produce a `platform/ios/build/ios/pkg/dynamic`
|
||
Please refer to [Mapbox Maps SDK for iOS](platform/ios/platform/ios/) for detailed instructions.
|
||
|
||
|
||
#### MacOS
|
||
|
||
```bash
|
||
cd platform/ios
|
||
make xpackage
|
||
```
|
||
|
||
This produces a `Mapbox.framework` in the `platform/ios/build/macos/pkg/` folder.
|
||
Please refer to [Mapbox Maps SDK for macos](platform/ios/platform/macos/) for detailed instructions.
|