This guide provides step-by-step instructions for building the canonical C++ reference application for maplibre-native-slint on macOS with Apple Silicon (M1/M2/M3/M4).
The reusable Slint API lives in src/, but the authoritative backend wiring currently lives in cpp/.
- macOS 14.0 (Sonoma) or later
- Apple Silicon Mac (M1/M2/M3/M4)
- Xcode Command Line Tools
- Homebrew
- Rust
First, ensure Xcode Command Line Tools are installed:
xcode-select --installInstall Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install the required system packages:
brew install cmake pkg-config clang-format
brew install bazelisk webp libuv webp icu4c jpeg-turbo glfw
brew link icu4c --forceSlint requires the Rust toolchain. Install it using rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env# Clone the repository
git clone https://github.com/maplibre/maplibre-native-slint.git
cd maplibre-native-slint
# Initialize and update submodules
git submodule update --init --recursiveThe default desktop build now prefers WebGPU (wgpu-native). Metal is still useful as a fallback/comparison path on macOS.
# Configure with CMake. This will also download and build Slint automatically.
cmake -B build -DCMAKE_BUILD_TYPE=Release -G Xcode .
# Build the project
cmake --build buildIf you specifically want to compare against the Metal path:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DMLN_WITH_METAL=ON -DMLN_WITH_WEBGPU=OFF -G Xcode .
cmake --build buildThe build process can take 10-15 minutes on the first run. Subsequent builds will be much faster.
After a successful build, the executable will be located in the build/Debug directory.
./build/Debug/maplibre-slint-exampleThis will launch a window displaying the map. You can interact with it using your mouse to pan and zoom.
After that, the most important files to inspect are:
src/maplibre.slintcpp/map_window.slintcpp/main.cpp
- Build Fails: Ensure all dependencies are installed correctly and that your Rust environment is set up (
source ~/.cargo/env). cmakecommand not found: Make sure you have installedcmakevia Homebrew and that your shell can find it.- Linker Errors: If you encounter linker errors, try cleaning the build directory (
rm -rf build) and re-running the build process from Step 4.