Prerequisites
Before building from source, ensure you have the required tools installed:Common Requirements
- Git with submodule support
- Make
- C++ compiler with C++17 support
Android Requirements
- Android Studio (latest version recommended)
- Gradle
- Android SDK 8.0+ (API level 26+)
- NDK for C++ compilation
iOS Requirements
- macOS
- Xcode 16 or later
- Swift Package Manager (included with Xcode)
- Command Line Tools for Xcode
Initial Setup
First, clone the repository and initialize all submodules:The SDK uses git submodules for dependencies. Always ensure submodules are initialized and updated before building.
Architecture Overview
Open Mobile Maps uses a shared C++ core with platform-specific bindings:- C++ Core: Most of the codebase is written in C++ and shared between platforms
- Djinni: Interface bindings are generated using a fork of the Djinni library
- Platform Bindings: Kotlin bindings for Android, Swift bindings for iOS
- graphics-core: Generic structure for rendering basic graphic primitives
- maps-core: Collection of classes providing the basics for creating a digital map
Graphics Rendering
- Android: OpenGL code kept in C++
- iOS: Metal implementations written in Swift
Updating Djinni Bridging Files
If you modify the Djinni interface files under thedjinni/ directory, you’ll need to regenerate the bridging code.
Generate Bindings
From thedjinni/ folder, run:
- Kotlin bindings for Android
- C++ header files
- JNI glue code (Android)
- Objective-C glue code (iOS)
Building for Android
Using Android Studio
- Open Android Studio
- Select “Open an Existing Project”
- Navigate to the
android/folder in the repository - Wait for Gradle sync to complete
- Build the project using the Build menu
Using Command Line
From theandroid/ directory:
.aar library will be available at:
Development Setup
For development, include the library directly as a module in your Android application project:- In your app’s
settings.gradle, include the maps-core module - Add it as a dependency in your app’s
build.gradle - You can now run the app on a device and iterate on the library code
Current Android Dependencies
When including the SDK as an.aar file (not via Maven Central), add these dependencies to your app’s build.gradle:
Building for iOS
Using Xcode
- Open the
Package.swiftfile in Xcode (located at the repository root) - Xcode will automatically resolve dependencies
- Build the package using Product > Build (⌘B)
Using Command Line
From the repository root:Integration Methods
Swift Package Manager (Recommended)
Add to yourPackage.swift:
Xcode Project Integration
- In Xcode, go to File > Add Packages
- Enter the repository URL:
https://github.com/openmobilemaps/maps-core - Select the version or branch
- Add to your target
For local development, you can add the package using a local file path instead of a repository URL.
Platform-Specific Notes
Android
OpenGL ES Version
The SDK requires OpenGL ES 3.2, which is available on Android 8.0 (API level 26) and higher.Gradle Configuration
Recent versions of the SDK use:- AGP: 8.13.1 (as of version 3.7.0)
- Kotlin: 2.2.0 (as of version 3.4.0)
- OkHttp: 5.1.0 (as of version 3.4.0)
- Moshi: 1.15.2 (as of version 3.4.0)
16KB Page Size Support
Starting from version 3.5.0, the SDK supports 16KB page sizes on Android with target SDK 36.iOS
Deployment Target
The minimum iOS deployment target is iOS 14 (as of version 2.6.0).Metal vs OpenGL
The iOS implementation uses Metal for graphics rendering, providing better performance and integration with the iOS ecosystem.SwiftUI Support
Starting from version 3.0.0, the MapView is exposed to SwiftUI. However, the SwiftUI MapView requires iOS 17.0 or later. For iOS 14-16, use the UIKitMCMapView component.
Coordinate Systems
The SDK comes with implementations for two coordinate systems:- EPSG:2056 (LV95/LV03+)
- EPSG:3857 (Pseudo-Mercator / Web Mercator)
CoordinateSystemFactory.
Testing Your Build
Android
Create a test application that:-
Initializes MapsCore in the Application onCreate:
-
Creates a MapView and sets up the map:
- Adds a test layer (e.g., TiledRasterLayer)
iOS
Create a test application that:-
Imports MapCore:
-
Creates a MapView with a test layer:
Troubleshooting
Submodule Issues
If you encounter build errors, ensure submodules are properly initialized:Djinni Generation Errors
If Djinni code generation fails:- Ensure you have the correct version of Djinni (1.1.1 as of SDK version 3.2.0)
- Check that you’re running the command from the
djinni/directory - Verify that the Djinni configuration files are not corrupted
Android Build Errors
- Verify your Android SDK and NDK versions
- Check that Gradle can download dependencies
- Ensure you have the correct AGP and Kotlin versions
iOS Build Errors
- Verify Xcode Command Line Tools are installed:
xcode-select --install - Check that your deployment target is iOS 14 or higher
- Ensure Swift Package Manager can resolve dependencies
Contributing
If you plan to contribute to the project:- Fork the repository
- Create a feature branch
- Make your changes
- Ensure all builds pass (Android and iOS)
- Submit a pull request
Please follow the existing code style and conventions. Add tests for new features when applicable.