# Azure Pipelines for Valhalla # # TODO: Shallow clone blocked by # https://developercommunity.visualstudio.com/content/problem/294872/yaml-build-ignores-fetchdepth.html # TODO: Once CMake 3.13 is available replace -H with -S option # # No wildcards allowed for file patterns... # skip draft PR's, skip all commits except for PRs to master trigger: branches: include: - master pr: branches: include: - master paths: exclude: - README.md - CHANGELOG.md - bench/ - docs/ - run_route_scripts/ - test/ - .circleci/ - .github/ drafts: false jobs: - job: VS2022 displayName: 'Windows 2022 | VS2022' timeoutInMinutes: 120 pool: vmImage: 'windows-2022' variables: BUILD_CFG: 'Release' BUILD_DIR: '$(Agent.WorkFolder)\build' VCPKG_DIR: '$(Build.SourcesDirectory)\vcpkg' VCPKG_ROOT: '$(Build.SourcesDirectory)\vcpkg' VCPKG_INSTALLATION_ROOT: '$(Build.SourcesDirectory)\vcpkg' TRIPLET: 'x64' VCPKG_REF: 'f330a32' CONAN_HOME: '$(Build.SourcesDirectory)/conan' steps: - script: | git submodule update --init --recursive echo $(Build.SourceBranch) displayName: 'Pull submodules' - task: Cache@2 displayName: "Cache vcpkg's packages" inputs: key: .\vcpkg.json | "$(VCPKG_REF)" | ".v2" path: "$(VCPKG_DIR)" cacheHitVar: CACHE_RESTORED # TODO: cache build never worked, look into it # - task: Cache@2 # displayName: "Cache build" # inputs: # key: '"msvc-v16.10.0" | build | "$(Build.SourceBranch)"' # path: "$(BUILD_DIR)" # restoreKeys: | # "msvc-v16.10.0" | build | "$(Build.SourceBranch)" # "msvc-v16.10.0" | build # cacheHitVar: BUILD_CACHE_RESTORED - script: | git clone https://github.com/microsoft/vcpkg %VCPKG_DIR% git -C %VCPKG_DIR% checkout %VCPKG_REF% echo.set(VCPKG_BUILD_TYPE release)>> %VCPKG_DIR%\triplets\%TRIPLET%-windows.cmake call %VCPKG_DIR%\bootstrap-vcpkg.bat %VCPKG_DIR%\vcpkg.exe version displayName: 'Install vcpkg' condition: ne(variables.CACHE_RESTORED, 'true') - script: | %VCPKG_DIR%\vcpkg.exe install %VCPKG_DIR%\vcpkg.exe list displayName: 'Install vcpkg packages' condition: ne(variables.CACHE_RESTORED, 'true') - script: | move /Y third_party\OSM-binary\src\fileformat.proto third_party\OSM-binary\src\fileformat.proto.orig move /Y third_party\OSM-binary\src\osmformat.proto third_party\OSM-binary\src\osmformat.proto.orig echo syntax = "proto2"; > third_party\OSM-binary\src\fileformat.proto type third_party\OSM-binary\src\fileformat.proto.orig >> third_party\OSM-binary\src\fileformat.proto echo syntax = "proto2"; > third_party\OSM-binary\src\osmformat.proto type third_party\OSM-binary\src\osmformat.proto.orig >> third_party\OSM-binary\src\osmformat.proto del /Q third_party\OSM-binary\src\fileformat.proto.orig del /Q third_party\OSM-binary\src\osmformat.proto.orig displayName: 'Patch .proto files of OSMPBF with syntax=proto2' - script: | cmake --version cmake -G "Visual Studio 17 2022" -A %TRIPLET% -H$(Build.SourcesDirectory) -B%BUILD_DIR% -DCMAKE_BUILD_TYPE=%BUILD_CFG% -DCMAKE_TOOLCHAIN_FILE=%VCPKG_DIR%\scripts\buildsystems\vcpkg.cmake -DVCPKG_APPLOCAL_DEPS=ON -DENABLE_DATA_TOOLS=ON -DENABLE_TOOLS=ON -DENABLE_PYTHON_BINDINGS=ON -DENABLE_TESTS=OFF -DENABLE_CCACHE=OFF -DENABLE_HTTP=OFF -DENABLE_SERVICES=OFF -DENABLE_BENCHMARKS=OFF cmake --build %BUILD_DIR% --config %BUILD_CFG% -- /clp:ErrorsOnly /p:BuildInParallel=true /m:4 displayName: 'Build Valhalla' - script: | SET PATH=%PATH%;%BUILD_DIR%\vcpkg_installed\%TRIPLET%-windows\bin %BUILD_DIR%\%BUILD_CFG%\valhalla_build_tiles.exe -c .\test\win\valhalla.json .\test\data\utrecht_netherlands.osm.pbf %BUILD_DIR%\%BUILD_CFG%\valhalla_run_route.exe --config .\test\win\valhalla.json -j "{\"locations\": [{\"lat\": 52.10205, \"lon\": 5.114651}, {\"lat\": 52.093113, \"lon\": 5.100918}], \"costing\": \"auto\"}" %BUILD_DIR%\%BUILD_CFG%\valhalla_run_isochrone.exe --config .\test\win\valhalla.json -j "{\"locations\": [{\"lat\": 52.10205, \"lon\": 5.114651}], \"costing\": \"auto\", \"contours\":[{\"time\":15,\"color\":\"ff0000\"}]}" displayName: 'Test some executables'