Windows Compilation - Project-OSRM/osrm-backend GitHub Wiki
Building on Windows
Use Visual Studio with the C++ workload, CMake, Git and vcpkg. Current OSRM builds use vcpkg manifest mode; the repository's manifest and overlay ports supply the library dependencies. Do not install a separate hand-maintained list of Boost, Lua and other libraries.
Bootstrap vcpkg
In a command prompt:
git clone https://github.com/microsoft/vcpkg.git C:\src\vcpkg
C:\src\vcpkg\bootstrap-vcpkg.bat
set VCPKG_ROOT=C:\src\vcpkg
Configure and build
Clone OSRM and run the commands from its repository root:
git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
cmake --preset ci-windows
cmake --build --preset ci-windows
The ci-windows preset selects Visual Studio 2026 and the x64-windows-static-md triplet used by OSRM CI. The first configure builds its dependencies; later builds reuse vcpkg's binary cache.
For Visual Studio 2022, configure a fresh build directory explicitly:
cmake -S . -B build-vs2022 -G "Visual Studio 17 2022" -A x64 ^
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake ^
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DENABLE_CCACHE=OFF
cmake --build build-vs2022 --config Release
Choose the triplet when creating the build directory; use a new directory if changing it. The default x64-windows shared-library triplet is affected by the gauche import-library issue tracked in #7737. The static triplet above matches CI.
Run OSRM
For the preset build, the executables are under build\Release. From the repository root, for example:
build\Release\osrm-extract.exe -p profiles\car.lua data.osm.pbf
build\Release\osrm-partition.exe data.osrm
build\Release\osrm-customize.exe data.osrm
build\Release\osrm-routed.exe --algorithm mld data.osrm
For build-vs2022, substitute that build directory. See the README for the supported source-build workflow and the testing guide for tests. Multi-config CTest invocations need -C Release (or the selected configuration).