This project demonstrates the integration of MapLibre Native (C++ mapping library) with Slint UI framework for creating interactive map applications.
For detailed build instructions, see the platform-specific guides:
- Linux: Ubuntu 24.04 Build Guide
- macOS: macOS Build Guide
- Windows: Windows Build Guide
- C++20 compatible compiler
- CMake 3.21 or later
- Rust toolchain (for Slint auto-download)
- OpenGL/GLES development headers
- Network connectivity for downloading dependencies
# Install dependencies (see platform guides for details)
# Clone and prepare
git clone https://github.com/maplibre/maplibre-native-slint.git
cd maplibre-native-slint
git submodule update --init --recursive
# Build (Slint will be automatically downloaded if needed)
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
# Run
./build/maplibre-slint-example
Note: Slint dependencies are now automatically resolved! CMake will download and build Slint if it's not found system-wide.
src/
- Main source code for the MapLibre-Slint integrationexamples/
- Example applicationsplatform/
- Platform-specific implementations (RunLoop, FileSource)vendor/
- MapLibre Native submoduleCMakeLists.txt
- Build configuration
- Hybrid GPU-CPU Rendering: MapLibre Native renders on GPU, with pixel data transferred to CPU for Slint integration.
- Slint UI Integration: Displays maps within Slint user interfaces
- Custom File Source: HTTP-based tile and resource loading
- Touch/Mouse Interaction: Interactive map navigation (Partial, in progress)
- Cross-platform: Supports Linux, Windows, and macOS
This project supports multiple rendering backends, automatically selected based on the target platform:
- OpenGL/GLES (primary on Linux/Windows): Uses HeadlessFrontend with CPU-based rendering
- Metal (primary on macOS): Native Metal framework integration for Apple Silicon
- Vulkan: Not currently implemented
The following platform and graphics backend combinations are supported and tested:
Platform | OpenGL/GLES | Metal | Vulkan | CI Status |
---|---|---|---|---|
Linux x86_64 | β | β | β | β |
Linux ARM64 | π¨* | β | β | β |
Windows x86_64 | β | β | β | β |
Windows ARM64 | π¨* | β | β | β |
macOS ARM64 | β | β | β | β |
macOS x86_64 | β | π¨* | β | β |
Legend:
- β Fully Supported: Tested and working
- π¨ Experimental: Should work but not extensively tested
- β Not Supported: Not implemented or not compatible
Notes:
- * Architecture should work but hasn't been extensively tested
- CI currently runs only on Ubuntu x86_64 with Xvfb for headless testing
- macOS builds explicitly target ARM64 only (x86_64 is excluded)
- Windows builds target x64 architecture via MSVC toolchain
The project automatically detects and configures the appropriate backend:
# Linux/Windows (OpenGL/GLES)
cmake -B build -DCMAKE_BUILD_TYPE=Release
# macOS (Metal backend)
cmake -B build -DCMAKE_BUILD_TYPE=Release -DMLN_WITH_METAL=ON -DMLN_WITH_OPENGL=OFF -G Xcode
This project has been updated to work with the latest MapLibre Native APIs:
- Modern RunLoop API using composition instead of inheritance
- Updated ResourceOptions without deprecated methods
- Current HeadlessFrontend construction patterns
- Proper OpenGL context management
The current rendering pipeline involves GPU-to-CPU data transfer:
- MapLibre Native's
HeadlessFrontend
renders the map using GPU (OpenGL/Metal/etc.) to an internal framebuffer. - The GPU-rendered image is read back to CPU memory as
mbgl::PremultipliedImage
. - This CPU image data is converted from premultiplied alpha format to non-premultiplied format.
- The pixel data is copied into a
slint::SharedPixelBuffer
for CPU-based rendering. - Slint displays the map image within its UI using the CPU pixel buffer.
- User interactions from the Slint UI are captured and forwarded to the MapLibre Native map instance.
Performance Note: This GPU-to-CPU data transfer creates overhead. Future improvements could use BorrowedOpenGLTexture
for direct GPU texture sharing.
- Implement a more efficient GPU-based rendering pipeline using
BorrowedOpenGLTexture
to eliminate GPU-to-CPU data transfer overhead. - Fully implement and stabilize touch and mouse interactions (zooming, panning, rotation).
- Add more examples and improve documentation.
- Ensure all dependencies are installed
- Check that Slint is properly installed system-wide
- Verify OpenGL/GLES development headers are available
- For headless environments, set up X11 forwarding or virtual display
- Check that OpenGL drivers are properly installed
- Verify network connectivity for map tile loading
- Fork the repository
- Create a feature branch
- Make your changes
- Test the build process
- Submit a pull request
- Slack: Join the conversation on the #maplibre-native channel on OSM-US Slack. Click here for an invite.
- Website: maplibre.org
Copyright (c) 2025 MapLibre contributors.
This project is licensed under the BSD 2-Clause License. See the LICENSE file for details.
This project integrates multiple components with different licenses:
- MapLibre Native: BSD License
- Slint: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0