diff --git a/.babelrc b/.babelrc index fd234626a..21e2dd7fd 100644 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,7 @@ { "plugins": ["transform-class-properties"], "presets": [ - "stage-0", - "es2015", - "react" + "@babel/preset-env", + "@babel/preset-react" ] } diff --git a/.clang-tidy b/.clang-tidy index de4303bf8..d1b047f3a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,86 @@ --- -Checks: '-clang-analyzer-*,google-*,llvm-*,misc-*,readability-*,-google-build-explicit-make-pair,-google-explicit-constructor,-google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,-google-readability-function,-google-readability-todo,-google-runtime-int,-llvm-namespace-comment,-llvm-header-guard,-llvm-twine-local,-misc-argument-comment,-readability-braces-around-statements,-readability-identifier-naming' -... +Checks: > + bugprone-*, + -bugprone-narrowing-conversions, + -bugprone-easily-swappable-parameters, + -bugprone-branch-clone, + -bugprone-misplaced-widening-cast, + -bugprone-exception-escape, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-integer-division, + -bugprone-reserved-identifier, + -bugprone-unhandled-self-assignment, + -bugprone-forward-declaration-namespace, + -bugprone-sizeof-expression, + -clang-analyzer-*, + -clang-diagnostic-deprecated-declarations, + -clang-diagnostic-constant-conversion, + cppcoreguidelines-avoid-goto, + cppcoreguidelines-no-malloc, + cppcoreguidelines-virtual-class-destructor, + google-*, + -google-build-explicit-make-pair, + -google-build-using-namespace, + -google-explicit-constructor, + -google-default-arguments, + -google-readability-braces-around-statements, + -google-readability-casting, + -google-readability-namespace-comments, + -google-readability-function, + -google-readability-todo, + -google-runtime-int, + -google-build-namespaces, + -google-runtime-references, + -google-readability-function-size, + llvm-*, + -llvm-namespace-comment, + -llvm-qualified-auto, + -llvm-include-order, + -llvm-else-after-return, + -llvm-header-guard, + -llvm-twine-local, + misc-*, + -misc-argument-comment, + -misc-non-private-member-variables-in-classes, + -misc-unconventional-assign-operator, + -misc-no-recursion, + -misc-misplaced-const, + -misc-definitions-in-headers, + -misc-unused-parameters, + performance-*, + -performance-noexcept-move-constructor, + -performance-move-const-arg, + -performance-no-int-to-ptr, + readability-*, + -readability-avoid-const-params-in-decls, + -readability-braces-around-statements, + -readability-container-size-empty, + -readability-convert-member-functions-to-static, + -readability-const-return-type, + -readability-function-cognitive-complexity, + -readability-function-size, + -readability-identifier-naming, + -readability-implicit-bool-conversion, + -readability-magic-numbers, + -readability-else-after-return, + -readability-inconsistent-declaration-parameter-name, + -readability-isolate-declaration, + -readability-redundant-declaration, + -readability-uppercase-literal-suffix, + -readability-named-parameter, + -readability-qualified-auto, + -readability-suspicious-call-argument, + -readability-redundant-access-specifiers, + -readability-redundant-member-init, + -readability-static-definition-in-anonymous-namespace, + -readability-use-anyofallof, + -readability-simplify-boolean-expr, + -readability-make-member-function-const, + -readability-redundant-string-init, + -readability-non-const-parameter, + -readability-static-accessed-through-instance + +WarningsAsErrors: '*' +HeaderFilterRegex: '.*' + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1d5fbec2d..5643bb9b7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,7 +9,7 @@ If your PR is still work in progress please attach the relevant label. - [ ] CHANGELOG.md entry ([How to write a changelog entry](http://keepachangelog.com/en/1.0.0/#how)) - [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki) - - [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md) + - [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md)) - [ ] review - [ ] adjust for comments - [ ] cherry pick to release branch diff --git a/.github/workflows/osrm-backend-docker.yml b/.github/workflows/osrm-backend-docker.yml new file mode 100644 index 000000000..e0cf8939d --- /dev/null +++ b/.github/workflows/osrm-backend-docker.yml @@ -0,0 +1,84 @@ +name: build and publish container image +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + + - name: Docker meta - debug + id: metadebug + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + flavor: | + latest=true + suffix=-debug,onlatest=true + + - name: Docker meta - assertions + id: metaassertions + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + flavor: | + latest=true + suffix=-assertions,onlatest=true + + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build container image - debug + uses: docker/build-push-action@v2 + with: + push: true + platforms: linux/amd64,linux/arm64 + file: ./docker/Dockerfile + tags: ${{ steps.metadebug.outputs.tags }} + build-args: | + DOCKER_TAG=${{ join(steps.metadebug.outputs.tags ) }} + + + - name: Build container image - assertions + uses: docker/build-push-action@v2 + with: + push: true + platforms: linux/amd64,linux/arm64 + file: ./docker/Dockerfile + tags: ${{ steps.metaassertions.outputs.tags }} + build-args: | + DOCKER_TAG=${{ join(steps.metaassertions.outputs.tags ) }} + + # build and publish "normal" image as last to get it listed on top + - name: Build container image - normal + uses: docker/build-push-action@v2 + with: + push: true + platforms: linux/amd64,linux/arm64 + file: ./docker/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + build-args: | + DOCKER_TAG=${{ join(steps.meta.outputs.tags ) }} + + + diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml new file mode 100644 index 000000000..4addd0564 --- /dev/null +++ b/.github/workflows/osrm-backend.yml @@ -0,0 +1,665 @@ +name: osrm-backend CI +on: + push: + branches: + - master + tags: + - v[1-9]+.[0-9]+.[0-9]+ + - v[1-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+ + - v[1-9]+.[0-9]+-[0-9a-zA-Z]+ + pull_request: + branches: + - master + +env: + CCACHE_TEMPDIR: /tmp/.ccache-temp + CCACHE_COMPRESS: 1 + CASHER_TIME_OUT: 599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742 + CCACHE_VERSION: 3.3.1 + CMAKE_VERSION: 3.21.2 + ENABLE_NODE_BINDINGS: "ON" + +jobs: + windows: + needs: format-taginfo-docs + runs-on: windows-2022 + continue-on-error: false + steps: + - uses: actions/checkout@v3 + - run: pip install conan==1.50.0 + - run: conan --version + - run: cmake --version + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: node --version + - run: npm --version + - run: npm install --ignore-scripts + - run: npm link --ignore-scripts + - uses: microsoft/setup-msbuild@v1.1 + - name: Build + run: | + .\scripts\ci\windows-build.bat + + format-taginfo-docs: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 12 + - name: Enable Node.js cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Prepare environment + run: | + npm ci --ignore-scripts + export MASON=${GITHUB_WORKSPACE}/scripts/mason.sh + ${MASON} install clang-format 10.0.0 + echo "$(${MASON} prefix clang-format 10.0.0)/bin" >> $GITHUB_PATH + - name: Run checks + run: | + ./scripts/check_taginfo.py taginfo.json profiles/car.lua + ./scripts/format.sh && ./scripts/error_on_dirty.sh + node ./scripts/validate_changelog.js + npm run docs && ./scripts/error_on_dirty.sh + + docker-image: + needs: format-taginfo-docs + runs-on: ubuntu-22.04 + continue-on-error: false + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Enable osm.pbf cache + uses: actions/cache@v2 + with: + path: berlin-latest.osm.pbf + key: v1-berlin-osm-pbf + restore-keys: | + v1-berlin-osm-pbf + - name: Docker build + run: | + docker build -t osrm-backend-local -f docker/Dockerfile . + - name: Test Docker image + run: | + if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then + wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf + fi + TAG=osrm-backend-local + # when `--memory-swap` value equals `--memory` it means container won't use swap + # see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details + MEMORY_ARGS="--memory=1g --memory-swap=1g" + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm + docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm + docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm & + curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true" + docker stop osrm-container + + build-test-publish: + needs: format-taginfo-docs + strategy: + matrix: + include: + - name: gcc-9-debug-cov + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CCOMPILER: gcc-9 + CUCUMBER_TIMEOUT: 20000 + CXXCOMPILER: g++-9 + ENABLE_COVERAGE: ON + + - name: gcc-9-debug-asan-ubsan + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CCOMPILER: gcc-9 + CUCUMBER_TIMEOUT: 20000 + CXXCOMPILER: g++-9 + ENABLE_SANITIZER: ON + TARGET_ARCH: x86_64-asan-ubsan + OSRM_CONNECTION_RETRIES: 10 + OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5 + + - name: clang-6.0-debug + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + CUCUMBER_TIMEOUT: 60000 + + - name: clang-11.0-debug-clang-tidy + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Debug + CLANG_VERSION: 11.0.0 + CUCUMBER_TIMEOUT: 60000 + ENABLE_CLANG_TIDY: ON + + - name: conan-linux-debug-asan-ubsan + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CLANG_VERSION: 11.0.0 + ENABLE_CONAN: ON + ENABLE_SANITIZER: ON + + - name: conan-linux-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_CONAN: ON + + - name: gcc-11-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-11 + CXXCOMPILER: g++-11 + + - name: gcc-10-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-10 + CXXCOMPILER: g++-10 + + - name: gcc-9-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-9 + CXXCOMPILER: g++-9 + CXXFLAGS: -Wno-cast-function-type + + - name: gcc-9-release-i686 + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-9 + CFLAGS: "-m32 -msse2 -mfpmath=sse" + CXXCOMPILER: g++-9 + CXXFLAGS: "-m32 -msse2 -mfpmath=sse" + TARGET_ARCH: i686 + + - name: gcc-8-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-8 + CXXCOMPILER: g++-8 + CXXFLAGS: -Wno-cast-function-type + + - name: gcc-7-release + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-7 + CXXCOMPILER: g++-7 + + - name: conan-osx-release-node-12 + build_node_package: true + continue-on-error: false + node: 12 + runs-on: macos-11 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_CONAN: ON + + - name: conan-osx-release-node-14 + build_node_package: true + continue-on-error: false + node: 14 + runs-on: macos-11 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_CONAN: ON + + - name: conan-osx-release-node-16 + build_node_package: true + continue-on-error: false + node: 16 + runs-on: macos-11 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_CONAN: ON + + - name: gcc-7-release-shared + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + BUILD_SHARED_LIBS: ON + CCOMPILER: gcc-7 + CXXCOMPILER: g++-7 + + - name: node-12-conan-linux-release + build_node_package: true + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-12-conan-linux-debug + build_node_package: true + continue-on-error: false + node: 12 + runs-on: ubuntu-20.04 + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-14-conan-linux-release + build_node_package: true + continue-on-error: false + node: 14 + runs-on: ubuntu-20.04 + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-14-conan-linux-debug + build_node_package: true + continue-on-error: false + node: 14 + runs-on: ubuntu-20.04 + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + + - name: node-16-conan-linux-release + build_node_package: true + continue-on-error: false + node: 16 + runs-on: ubuntu-20.04 + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-16-conan-linux-debug + build_node_package: true + continue-on-error: false + node: 16 + runs-on: ubuntu-20.04 + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: conan-osx-release-node-latest + build_node_package: true + continue-on-error: true + node: latest + runs-on: macos-11 + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_CONAN: ON + + - name: node-latest-conan-linux-release + build_node_package: true + continue-on-error: true + node: latest + runs-on: ubuntu-20.04 + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-latest-conan-linux-debug + build_node_package: true + continue-on-error: true + node: latest + runs-on: ubuntu-20.04 + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: conan-osx-release-node-lts + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: macos-11 + BUILD_TYPE: Release + CCOMPILER: clang + CXXCOMPILER: clang++ + CUCUMBER_TIMEOUT: 60000 + ENABLE_ASSERTIONS: ON + ENABLE_CONAN: ON + + - name: node-lts-conan-linux-release + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: ubuntu-20.04 + BUILD_TYPE: Release + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + - name: node-lts-conan-linux-debug + build_node_package: true + continue-on-error: true + node: "lts/*" + runs-on: ubuntu-20.04 + BUILD_TYPE: Debug + CLANG_VERSION: 6.0.0 + ENABLE_GLIBC_WORKAROUND: ON + ENABLE_CONAN: ON + NODE_PACKAGE_TESTS_ONLY: ON + + + name: ${{ matrix.name}} + continue-on-error: ${{ matrix.continue-on-error }} + runs-on: ${{ matrix.runs-on }} + env: + BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }} + CCOMPILER: ${{ matrix.CCOMPILER }} + CFLAGS: ${{ matrix.CFLAGS }} + CLANG_VERSION: ${{ matrix.CLANG_VERSION }} + CUCUMBER_TIMEOUT: ${{ matrix.CUCUMBER_TIMEOUT }} + CXXCOMPILER: ${{ matrix.CXXCOMPILER }} + CXXFLAGS: ${{ matrix.CXXFLAGS }} + ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }} + ENABLE_CLANG_TIDY: ${{ matrix.ENABLE_CLANG_TIDY }} + ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }} + ENABLE_GLIBC_WORKAROUND: ${{ matrix.ENABLE_GLIBC_WORKAROUND }} + ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }} + ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }} + NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }} + TARGET_ARCH: ${{ matrix.TARGET_ARCH }} + OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }} + OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }} + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + - name: Enable Node.js cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Enable compiler cache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ccache-${{ matrix.name }}-${{ github.sha }} + restore-keys: | + ccache-${{ matrix.name }}- + - name: Enable Conan cache + uses: actions/cache@v2 + with: + path: ~/.conan + key: v2-conan-${{ matrix.name }}-${{ github.sha }} + restore-keys: | + v2-conan-${{ matrix.name }}- + - name: Enable test cache + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/test/cache + key: v2-test-${{ matrix.name }}-${{ github.sha }} + restore-keys: | + v2-test-${{ matrix.name }}- + + - name: Prepare environment + run: | + PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") + echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV + + echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV + echo "OSRM_BUILD_DIR=${GITHUB_WORKSPACE}/build-osrm" >> $GITHUB_ENV + + if [[ "$ENABLE_SANITIZER" == 'ON' ]]; then + # We can only set this after checkout once we know the workspace directory + echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV + echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV + fi + + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "JOBS=$((`nproc` + 1))" >> $GITHUB_ENV + export MASON_OS=linux + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV + sudo mdutil -i off / + export MASON_OS=osx + fi + + echo "MASON=${GITHUB_WORKSPACE}/scripts/mason.sh" >> $GITHUB_ENV + echo "CMAKE_URL=https://mason-binaries.s3.amazonaws.com/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" >> $GITHUB_ENV + echo "CMAKE_DIR=mason_packages/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}" >> $GITHUB_ENV + + + - name: Install dev dependencies + run: | + python3 -m pip install conan==1.50.0 + + # CMake + mkdir -p ${CMAKE_DIR} + wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} + echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH + + # TBB + ${MASON} install tbb 2017_U7 + echo "LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + + # ccache + ${MASON} install ccache ${CCACHE_VERSION} + echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH + + # clang + if [[ -n ${CLANG_VERSION} ]]; then + echo "CCOMPILER=clang" >> $GITHUB_ENV + echo "CXXCOMPILER=clang++" >> $GITHUB_ENV + ${MASON} install clang++ ${CLANG_VERSION} + echo "$(${MASON} prefix clang++ ${CLANG_VERSION})/bin" >> $GITHUB_PATH + # we only enable lto for release builds + # and therefore don't need to us ld.gold or llvm tools for linking + # for debug builds + if [[ ${BUILD_TYPE} == 'Release' ]]; then + ${MASON} install binutils 2.27 + echo "$(${MASON} prefix binutils 2.27)/bin" >> $GITHUB_PATH + fi + fi + + # Linux dev packages + if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt-get update -y + sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libtbb-dev libboost-all-dev + if [[ -z "${CLANG_VERSION}" ]]; then + sudo apt-get install -y ${CXXCOMPILER} + fi + if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then + sudo apt-get install -y lcov + fi + elif [[ $TARGET_ARCH == "i686" ]]; then + source ./scripts/ci/before_install.${TARGET_ARCH}.sh + echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV + fi + + - name: Prepare build + run: | + mkdir ${OSRM_BUILD_DIR} + ccache --max-size=256M + npm ci --ignore-scripts + if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then + lcov --directory . --zerocounters # clean cached files + fi + echo "CC=${CCOMPILER}" >> $GITHUB_ENV + echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV + + - name: Build and install OSRM + run: | + echo "Using ${JOBS} jobs" + pushd ${OSRM_BUILD_DIR} + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DENABLE_CONAN=${ENABLE_CONAN:-OFF} \ + -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \ + -DENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY:-OFF} \ + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \ + -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ + -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ + -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ + -DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \ + -DENABLE_CCACHE=ON \ + -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ + -DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF} + make --jobs=${JOBS} + + if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then + make tests --jobs=${JOBS} + make benchmarks --jobs=${JOBS} + ccache -s + sudo make install + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV + fi + echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV + fi + popd + - name: Build example + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }} + run: | + mkdir example/build && pushd example/build + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} + make --jobs=${JOBS} + popd + + - name: Run all tests + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }} + run: | + make -C test/data benchmark + + # macOS SIP strips the linker path. Reset this inside the running shell + export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }} + ./example/build/osrm-example test/data/mld/monaco.osrm + + # All tests assume to be run from the build directory + pushd ${OSRM_BUILD_DIR} + for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done + if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then + npm run nodejs-tests + fi + popd + npm test + - name: Run Node package tests only + if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }} + run: | + npm run nodejs-tests + - name: Upload test logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: logs + path: test/logs/ + + - name: Generate code coverage + if: ${{ matrix.ENABLE_COVERAGE == 'ON' }} + run: | + lcov --directory . --capture --output-file coverage.info # capture coverage info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system + lcov --list coverage.info #debug info + # Uploading report to CodeCov + - name: Upload code coverage + if: ${{ matrix.ENABLE_COVERAGE == 'ON' }} + uses: codecov/codecov-action@v1 + with: + files: coverage.info + name: codecov-osrm-backend + fail_ci_if_error: true + verbose: true + + - name: Build Node package + if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }} + run: ./scripts/ci/node_package.sh + - name: Publish Node package + if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: build/stage/**/*.tar.gz + omitBody: true + omitBodyDuringUpdate: true + omitName: true + omitNameDuringUpdate: true + replacesArtifacts: true + token: ${{ secrets.GITHUB_TOKEN }} + + ci-complete: + runs-on: ubuntu-18.04 + needs: [build-test-publish, docker-image, windows] + steps: + - run: echo "CI complete" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8a62697ae..000000000 --- a/.travis.yml +++ /dev/null @@ -1,519 +0,0 @@ -language: cpp - -git: - depth: 10 - -# sudo:required is needed for trusty images -sudo: required -dist: trusty - -notifications: - email: false - -branches: - only: - - master - # enable building tags - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - -cache: - npm: true - ccache: true - apt: true - directories: - - test/cache - -env: - global: - - secure: "hk+32aXXF5t1ApaM2Wjqooz3dx1si907L87WRMkO47WlpJmUUU/Ye+MJk9sViH8MdhOcceocVAmdYl5/WFWOIbDWNlBya9QvXDZyIu2KIre/0QyOCTZbrsif8paBXKIO5O/R4OTvIZ8rvWZsadBdmAT9GSbDhih6FzqXAEgeIYQ=" - - secure: "VE+cFkseFwW4jK6XwkP0yW3h4DixPJ8+Eb3yKcchGZ5iIJxlZ/8i1vKHYxadgPRwSYwPSB14tF70xj2OmiT2keGzZUfphmPXinBaLEhYk+Bde+GZZkoSl5ND109I/LcyNr0nG9dDgtV6pkvFchgchpyP9JnVOOS0+crEZlAz0RE=" - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - - CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742 - - CCACHE_VERSION=3.3.1 - - CMAKE_VERSION=3.7.2 - - MASON="$(pwd)/scripts/mason.sh" - - ENABLE_NODE_BINDINGS=On - - NODE="10" - -stages: - - core - - optional - -matrix: - fast_finish: true - - # We override the compiler names here to yield better ccache behavior, which uses this as key - include: - - # Debug Builds - - stage: core - os: linux - compiler: "format-taginfo-docs" - env: NODE=10 - sudo: false - before_install: - install: - - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - - source $NVM_DIR/nvm.sh - - nvm install $NODE - - nvm use $NODE - - npm --version - - npm ci --ignore-scripts - script: - - ./scripts/check_taginfo.py taginfo.json profiles/car.lua - - ${MASON} install clang-format 3.8.1 - - PATH=$(${MASON} prefix clang-format 3.8.1)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh - - node ./scripts/validate_changelog.js - # See issue 4043 - #- npm run docs && ./scripts/error_on_dirty.sh - after_success: - - - os: linux - compiler: "gcc-7-debug-cov" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000 - before_script: - - cd ${TRAVIS_BUILD_DIR} - - lcov --directory . --zerocounters # clean cached da files - after_success: - # Creating report - - cd ${TRAVIS_BUILD_DIR} - - lcov --directory . --capture --output-file coverage.info # capture coverage info - - lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system - - lcov --list coverage.info #debug info - # Uploading report to CodeCov - - bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" - - - os: linux - compiler: "gcc-7-debug-asan" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" - - - os: linux - compiler: "clang-5.0-debug" - addons: &clang50 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000 - - - os: linux - compiler: "mason-linux-debug-asan" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf" - - # Release Builds - - os: linux - compiler: "mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON - - - os: linux - compiler: "gcc-9-release" - addons: &gcc9 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-9' CXXCOMPILER='g++-9' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type' - - - os: linux - compiler: "gcc-8-release" - addons: &gcc8 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-8', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-8' CXXCOMPILER='g++-8' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type' - - - os: linux - compiler: "gcc-7-release" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' - - - os: linux - compiler: "gcc-7-release-i686" - env: > - TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' - CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse' - - - os: linux - compiler: "gcc-5-release" - addons: &gcc49 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache'] - env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release' - - - os: linux - compiler: "gcc-6-release" - addons: &gcc49 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache'] - env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-10" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="10" - after_success: - - ./scripts/travis/publish.sh - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-8" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8" - after_success: - - ./scripts/travis/publish.sh - - # Shared Library - - os: linux - compiler: "gcc-7-release-shared" - addons: &gcc7 - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON - - # Node build jobs. These skip running the tests. - - os: linux - sudo: false - compiler: "node-8-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-8-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-10-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-10-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: osx - stage: optional - osx_image: xcode9.2 - compiler: "mason-osx-release-node-latest" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node" - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-latest-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-latest-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: osx - osx_image: xcode9.2 - compiler: "mason-osx-release-node-lts" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts" - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-lts-mason-linux-release" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - - os: linux - sudo: false - compiler: "node-lts-mason-linux-debug" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['libstdc++-4.9-dev'] - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=ON - - make --jobs=${JOBS} - - popd - script: - - npm run nodejs-tests - after_success: - - ./scripts/travis/publish.sh - - allow_failures: - - compiler: "mason-osx-release-node-latest" - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node" - - compiler: "node-latest-mason-linux-release" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - - compiler: "node-latest-mason-linux-debug" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node" - - compiler: "mason-osx-release-node-lts" - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts" - - compiler: "node-lts-mason-linux-release" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - - compiler: "node-lts-mason-linux-debug" - env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts" - -before_install: - - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - - source $NVM_DIR/nvm.sh - - nvm install $NODE - - nvm use $NODE - - node --version - - if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi - - | - if [[ -z $JOBS ]]; then - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - export JOBS=$((`nproc` + 1)) - elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - export JOBS=$((`sysctl -n hw.ncpu` + 1)) - fi - fi - - | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - sudo mdutil -i off / - fi - - export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") - - export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") - - echo "Using ${JOBS} jobs" - - npm ci --ignore-scripts - # Bootstrap cmake to be able to run mason - - CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" - - CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}" - - mkdir -p ${CMAKE_DIR} - - travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1 - - export PATH=${CMAKE_DIR}/bin:${PATH} - - ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH} - - ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH} - - | - if [[ ! -z ${CLANG_VERSION} ]]; then - export CCOMPILER='clang' - export CXXCOMPILER='clang++' - ${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1 - # we only enable lto for release builds - # and therefore don't need to us ld.gold or llvm tools for linking - # for debug builds - if [[ ${BUILD_TYPE} == 'Release' ]]; then - ${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1 - fi - fi - - ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes - - export OSRM_INSTALL_DIR="$(pwd)/install-osrm" - - export OSRM_BUILD_DIR="$(pwd)/build-osrm" - - export CC=${CCOMPILER} CXX=${CXXCOMPILER} - - mkdir ${OSRM_BUILD_DIR} - -install: - - pushd ${OSRM_BUILD_DIR} - - | - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DENABLE_MASON=${ENABLE_MASON:-OFF} \ - -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \ - -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \ - -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \ - -DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \ - -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \ - -DBUILD_TOOLS=ON \ - -DENABLE_CCACHE=ON \ - -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \ - -DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF} - - echo "travis_fold:start:MAKE" - - make --jobs=${JOBS} - - make tests --jobs=${JOBS} - - make benchmarks --jobs=${JOBS} - - echo "travis_fold:end:MAKE" - - ccache -s - - sudo make install - - | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib - fi - - popd - - mkdir example/build && pushd example/build - - export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig - - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - - make --jobs=${JOBS} - - popd - -script: - - if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi - - make -C test/data benchmark - - ./example/build/osrm-example test/data/mld/monaco.osrm - # All tests assume to be run from the build directory - - pushd ${OSRM_BUILD_DIR} - - ./unit_tests/library-tests - - ./unit_tests/extractor-tests - - ./unit_tests/contractor-tests - - ./unit_tests/engine-tests - - ./unit_tests/util-tests - - ./unit_tests/server-tests - - ./unit_tests/partitioner-tests - - | - if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then - npm run nodejs-tests - fi - - | - - popd - - npm test diff --git a/CHANGELOG.md b/CHANGELOG.md index cd658ba9b..3b1c3fbd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,90 @@ # Unreleased + - Changes from 5.26.0 + - API: + - FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294) + - FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) + - Misc: + - CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360) + - CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318) + - FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315) + - FIXED: Fix performance issue after migration to sol2 3.3.0. [#6304](https://github.com/Project-OSRM/osrm-backend/pull/6304) + - CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298) + - FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285) + - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296) + - Build: + - CHANGED: Use the latest node on CI. [#6317](https://github.com/Project-OSRM/osrm-backend/pull/6317) + - CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312) + - ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313) + - CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303) + - CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299) + - CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290) + - CHANGED: Use Conan instead of Mason to install code dependencies. [#6284](https://github.com/Project-OSRM/osrm-backend/pull/6284) + - CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [#6279](https://github.com/Project-OSRM/osrm-backend/pull/6279) + - CHANGED: Update macOS CI image to macos-11. [#6286](https://github.com/Project-OSRM/osrm-backend/pull/6286) + - CHANGED: Enable even more clang-tidy checks. [#6273](https://github.com/Project-OSRM/osrm-backend/pull/6273) + - CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274) + - CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270) + - CHANGED: Configure clang-tidy job on CI. [#6261](https://github.com/Project-OSRM/osrm-backend/pull/6261) + - CHANGED: Use Github Actions for building container images [#6138](https://github.com/Project-OSRM/osrm-backend/pull/6138) + - CHANGED: Upgrade Boost dependency to 1.70 [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) + - CHANGED: Upgrade Ubuntu CI builds to 20.04 [#6119](https://github.com/Project-OSRM/osrm-backend/pull/6119) + - CHANGED: Make building osrm-routed optional [#6144](https://github.com/Project-OSRM/osrm-backend/pull/6144) + - FIXED: Run all unit tests in CI [#5248](https://github.com/Project-OSRM/osrm-backend/pull/5248) + - FIXED: Fix installation of Mason CMake and 32 bit CI build [#6170](https://github.com/Project-OSRM/osrm-backend/pull/6170) + - FIXED: Fixed Node docs generation check in CI. [#6058](https://github.com/Project-OSRM/osrm-backend/pull/6058) + - CHANGED: Docker build, enabled arm64 build layer [#6172](https://github.com/Project-OSRM/osrm-backend/pull/6172) + - CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [#6175](https://github.com/Project-OSRM/osrm-backend/pull/6175) + +# 5.26.0 + - Changes from 5.25.0 + - API: + - FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090) + - FIXED: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112) + - Build: + - CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071) + - FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083) + - FIXED: Fixed test cache to consider MLD executable changes. [#6129](https://github.com/Project-OSRM/osrm-backend/pull/6129) + - Routing: + - FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084) + - FIXED: Fix MLD level mask generation to support 64-bit masks. [#6123](https://github.com/Project-OSRM/osrm-backend/pull/6123) + - FIXED: Fix metric offset overflow for large MLD partitions. This breaks the **data format** [#6124](https://github.com/Project-OSRM/osrm-backend/pull/6124) + +# 5.25.0 + - Changes from 5.24.0 + - Build: + - CHANGED: Node binaries now use Github Releases for hosting [#6030](https://github.com/Project-OSRM/osrm-backend/pull/6030) + - Misc: + - FIXED: Upgrade to @mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991) + - FIXED: `valid` type in documentation examples [#5990](https://github.com/Project-OSRM/osrm-backend/issues/5990) + - FIXED: Remove redundant loading of .osrm.cell_metrics [#6019](https://github.com/Project-OSRM/osrm-backend/issues/6019) + - CHANGED: Increase PackedOSMIDs size to 34 bits. This breaks the **data format** [#6020](https://github.com/Project-OSRM/osrm-backend/issues/6020) + - Profile: + - FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999) + +# 5.24.0 - Changes from 5.23.0 + - Features + - ADDED: Added support for multiple via-way restrictions. [#5907](https://github.com/Project-OSRM/osrm-backend/pull/5907) + - ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918) + - REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918) + - Routing: + - FIXED: Avoid copying ManyToMany table results [#5923](https://github.com/Project-OSRM/osrm-backend/pull/5923) + - FIXED: Reduce copying in API parameter constructors [#5925](https://github.com/Project-OSRM/osrm-backend/pull/5925) + - Misc: + - CHANGED: Cleanup NodeJS dependencies [#5945](https://github.com/Project-OSRM/osrm-backend/pull/5945) + - CHANGED: Unify `.osrm.turn_penalites_index` dump processing same with `.osrm.turn_weight_penalties` and `.osrm.turn_duration_penalties` [#5868](https://github.com/Project-OSRM/osrm-backend/pull/5868) + - FIXED: Properly validate source/destination validation in NodeJS table service [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595/files) + - FIXED: turn.roads_on_the_left not containing incoming roads and turn.roads_on_the_right not containing outgoing roads on two-way roads [#5128](https://github.com/Project-OSRM/osrm-backend/issues/5128) + - Profile: + - ADDED: Profile debug script which fetches a way from OSM then outputs the result of the profile. [#5908](https://github.com/Project-OSRM/osrm-backend/pull/5908) - Infrastructure - CHANGED: Bundled protozero updated to v1.7.0. [#5858](https://github.com/Project-OSRM/osrm-backend/pull/5858) - - Features - - CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360) + - Windows: + - FIXED: Fix bit-shift overflow in MLD partition step. [#5878](https://github.com/Project-OSRM/osrm-backend/pull/5878) + - FIXED: Fix vector bool permutation in graph contraction step [#5882](https://github.com/Project-OSRM/osrm-backend/pull/5882) + - API: + - FIXED: Undo libosrm API break by adding old interface as method overload [#5861](https://github.com/Project-OSRM/osrm-backend/pull/5861) + - FIXED: Fixed validation of sources/destinations when accessed via node bindings [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595) # 5.23.0 - Changes from 5.22.0 @@ -85,7 +166,7 @@ ](https://github.com/Project-OSRM/osrm-backend/pull/5076/) - CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077 ](https://github.com/Project-OSRM/osrm-backend/pull/5077/) - - CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101] + - CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101) - Bugfixes: - FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114) - Misc: diff --git a/CMakeLists.txt b/CMakeLists.txt index e6feb6de9..41875bbef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.2) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE) message(FATAL_ERROR "In-source builds are not allowed. @@ -18,10 +21,11 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR}) set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif() -option(ENABLE_MASON "Use mason for dependencies" OFF) +option(ENABLE_CONAN "Use conan for dependencies" OFF) option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON) option(BUILD_TOOLS "Build OSRM tools" OFF) option(BUILD_PACKAGE "Build OSRM package" OFF) +option(BUILD_ROUTED "Build osrm-routed HTTP server" ON) option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF) option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF) option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF) @@ -31,27 +35,20 @@ option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF) option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON) option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF) option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF) +option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF) + +if (ENABLE_CLANG_TIDY) + find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) + if(NOT CLANG_TIDY_COMMAND) + message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!") + else() + message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}") + set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*") + endif() +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -if(ENABLE_MASON) - # versions in use - set(MASON_BOOST_VERSION "1.65.1") - set(MASON_EXPAT_VERSION "2.2.0") - set(MASON_LUA_VERSION "5.2.4") - set(MASON_BZIP2_VERSION "1.0.6") - set(MASON_TBB_VERSION "2017_U7") - - message(STATUS "Enabling mason") - - find_program(CURL_FOUND curl) - if(NOT CURL_FOUND) - message(FATAL_ERROR "curl command required with -DENABLE_MASON") - endif() - - include(mason) -endif() - # be compatible with version handling before cmake 3.x if (POLICY CMP0048) cmake_policy(SET CMP0048 OLD) @@ -132,7 +129,7 @@ endif() include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/) -include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/) +include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2-3.3.0/include) include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include) set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework) @@ -162,7 +159,11 @@ add_library(CONTRACTOR OBJECT ${ContractorGlob}) add_library(UPDATER OBJECT ${UpdaterGlob}) add_library(STORAGE OBJECT ${StorageGlob}) add_library(ENGINE OBJECT ${EngineGlob}) -add_library(SERVER OBJECT ${ServerGlob}) + +if (BUILD_ROUTED) + add_library(SERVER OBJECT ${ServerGlob}) + add_executable(osrm-routed src/tools/routed.cpp $ $) +endif() set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX) @@ -170,7 +171,6 @@ add_executable(osrm-extract src/tools/extract.cpp) add_executable(osrm-partition src/tools/partition.cpp) add_executable(osrm-customize src/tools/customize.cpp) add_executable(osrm-contract src/tools/contract.cpp) -add_executable(osrm-routed src/tools/routed.cpp $ $) add_executable(osrm-datastore src/tools/store.cpp $ $) add_library(osrm src/osrm/osrm.cpp $ $ $ $) add_library(osrm_contract src/osrm/contractor.cpp $ $) @@ -201,13 +201,6 @@ if(ENABLE_GOLD_LINKER) endif() endif() -# Disable LTO when mason+gcc is detected before testing for / setting any flags. -# Mason builds libraries with Clang, mixing does not work in the context of lto. -if(ENABLE_MASON AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENABLE_LTO) - set(ENABLE_LTO OFF) - message(WARNING "Mason and GCC's LTO not work together. Disabling LTO.") -endif() - # Explicitly set the build type to Release if no other type is specified # on the command line. Without this, cmake defaults to an unoptimized, # non-debug build, which almost nobody wants. @@ -308,9 +301,9 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM endif() endif() -if(UNIX AND NOT APPLE AND ENABLE_MASON AND (LTO_WORKS OR ENABLE_GOLD_LINKER)) - message(WARNING "ENABLE_MASON and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently") - message(WARNING "For more details see: https://github.com/Project-OSRM/osrm-backend/issues/3202") +# TODO: this was added for Mason, we are not sure if it is true after migration to Conan +if(UNIX AND NOT APPLE AND ENABLE_CONAN AND (LTO_WORKS OR ENABLE_GOLD_LINKER)) + message(WARNING "ENABLE_CONAN and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently") endif() set(MAYBE_COVERAGE_LIBRARIES "") @@ -323,11 +316,14 @@ if (ENABLE_COVERAGE) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs") endif() + if (ENABLE_SANITIZER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") + set(SANITIZER_FLAGS "-g -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") + set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} ${SANITIZER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_FLAGS}") endif() # Configuring compilers @@ -360,7 +356,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # using Visual Studio C++ - set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC) @@ -397,16 +392,13 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") # Activate C++1y if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") + set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++17") endif() # Configuring other platform dependencies if(APPLE) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10") execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE) - set(CMAKE_OSX_ARCHITECTURES "x86_64") - message(STATUS "Set Architecture to x64 on OS X") exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) if(OSXLIBSTD) @@ -433,7 +425,7 @@ include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR}) set(MBXGEOM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/geometry.hpp-0.9.2/include") include_directories(SYSTEM ${MBXGEOM_INCLUDE_DIR}) -set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2.5.4/include") +set(CHEAPRULER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cheap-ruler-cpp-2778eb8/include") include_directories(SYSTEM ${CHEAPRULER_INCLUDE_DIR}) add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c") @@ -445,83 +437,98 @@ include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR}) set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include") include_directories(SYSTEM ${VTZERO_INCLUDE_DIR}) +set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Disable the build of Flatbuffers tests and samples.") set(FLATBUFFERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers") set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include") -include_directories(${FLATBUFFERS_INCLUDE_DIR}) +include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_DIR}) add_subdirectory(${FLATBUFFERS_SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build EXCLUDE_FROM_ALL) -# if mason is enabled no find_package calls are made -# to ensure that we are only compiling and linking against -# fully portable mason packages -if(ENABLE_MASON) - message(STATUS "Installing dependencies via mason") +# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package +if (MSVC) + add_definitions(-DBOOST_ALL_NO_LIB) +endif() + +if(ENABLE_CONAN) + message(STATUS "Installing dependencies via Conan") + + # Conan will generate Find*.cmake files to build directory, so we use them with the highest priority + list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR}) + list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR}) + + include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake) + + set(CONAN_BOOST_VERSION 1.79.0) + set(CONAN_BZIP2_VERSION 1.0.8) + set(CONAN_EXPAT_VERSION 2.2.10) + set(CONAN_LUA_VERSION 5.4.4) + set(CONAN_TBB_VERSION 2020.3) + + set(CONAN_SYSTEM_INCLUDES ON) + + # TODO: + # if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol + # with exit code = -1073741515, which means that program cannot load required DLL. + if (MSVC) + set(TBB_SHARED False) + else() + set(TBB_SHARED True) + endif() + + conan_cmake_run( + REQUIRES + boost/${CONAN_BOOST_VERSION} + bzip2/${CONAN_BZIP2_VERSION} + expat/${CONAN_EXPAT_VERSION} + lua/${CONAN_LUA_VERSION} + tbb/${CONAN_TBB_VERSION} + BASIC_SETUP + BUILD missing + GENERATORS cmake_find_package + KEEP_RPATHS + NO_OUTPUT_DIRS + OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake + tbb:shared=${TBB_SHARED} + ) + + add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST}) + add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2}) + add_dependency_includes(${CONAN_INCLUDE_DIRS_EXPAT}) + add_dependency_includes(${CONAN_INCLUDE_DIRS_LUA}) + add_dependency_includes(${CONAN_INCLUDE_DIRS_TBB}) set(Boost_USE_STATIC_LIBS ON) - mason_use(boost VERSION ${MASON_BOOST_VERSION} HEADER_ONLY) - add_dependency_includes(${MASON_PACKAGE_boost_INCLUDE_DIRS}) - mason_use(boost_libfilesystem VERSION ${MASON_BOOST_VERSION}) - set(Boost_FILESYSTEM_LIBRARY ${MASON_PACKAGE_boost_libfilesystem_STATIC_LIBS}) - mason_use(boost_libiostreams VERSION ${MASON_BOOST_VERSION}) - set(Boost_IOSTREAMS_LIBRARY ${MASON_PACKAGE_boost_libiostreams_STATIC_LIBS}) - mason_use(boost_libprogram_options VERSION ${MASON_BOOST_VERSION}) - set(Boost_PROGRAM_OPTIONS_LIBRARY ${MASON_PACKAGE_boost_libprogram_options_STATIC_LIBS}) - mason_use(boost_libregex VERSION ${MASON_BOOST_VERSION}) - set(Boost_REGEX_LIBRARY ${MASON_PACKAGE_boost_libregex_STATIC_LIBS}) - mason_use(boost_libtest VERSION ${MASON_BOOST_VERSION}) - set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY ${MASON_PACKAGE_boost_libtest_STATIC_LIBS}) - mason_use(boost_libdate_time VERSION ${MASON_BOOST_VERSION}) - set(Boost_DATE_TIME_LIBRARY ${MASON_PACKAGE_boost_libdate_time_STATIC_LIBS}) - mason_use(boost_libthread VERSION ${MASON_BOOST_VERSION}) - set(Boost_THREAD_LIBRARY ${MASON_PACKAGE_boost_libthread_STATIC_LIBS}) - mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION}) - set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS}) + find_package(Boost REQUIRED EXACT ${CONAN_BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS}) + set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}") + set(Boost_CHRONO_LIBRARY "${Boost_chrono_LIB_TARGETS}") + set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}") + set(Boost_FILESYSTEM_LIBRARY "${Boost_filesystem_LIB_TARGETS}") + set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}") + set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}") + set(Boost_SYSTEM_LIBRARY "${Boost_system_LIB_TARGETS}") + set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}") + set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}") + set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}") + + find_package(BZip2 REQUIRED) + find_package(EXPAT REQUIRED) + find_package(lua REQUIRED) + set(LUA_LIBRARIES ${lua_LIBRARIES}) - mason_use(expat VERSION ${MASON_EXPAT_VERSION}) - add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS}) - set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS}) + find_package(TBB REQUIRED) - mason_use(lua VERSION ${MASON_LUA_VERSION}) - add_dependency_includes(${MASON_PACKAGE_lua_INCLUDE_DIRS}) - set(USED_LUA_LIBRARIES ${MASON_PACKAGE_lua_STATIC_LIBS}) - - mason_use(bzip2 VERSION ${MASON_BZIP2_VERSION}) - add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS}) - set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS}) - - mason_use(tbb VERSION ${MASON_TBB_VERSION}) - add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS}) - set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS}) - - if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS) - message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work") - endif() - set(TBB_LINKER_RPATHS "") - foreach(libpath ${MASON_PACKAGE_tbb_LIBRARY_DIRS}) - set(TBB_LINKER_RPATHS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,${libpath}") - file(GLOB TBBGlob ${libpath}/*.*) - install(FILES ${TBBGlob} DESTINATION lib) - endforeach() - if(APPLE) - set(LINKER_FLAGS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,@loader_path") - elseif(UNIX) - set(LINKER_FLAGS "${TBB_LINKER_RPATHS} '-Wl,-rpath,$ORIGIN' -Wl,-z,origin") - endif() - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") - - # current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") # note: we avoid calling find_package(Osmium ...) here to ensure that the - # expat and bzip2 are used from mason rather than the system + # expat and bzip2 are used from conan rather than the system include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include) else() - - find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) + if (BUILD_ROUTED) + # osrm-routed requires newer boost:asio + find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) + else() + find_package(Boost 1.60 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) + endif() add_dependency_includes(${Boost_INCLUDE_DIRS}) find_package(TBB REQUIRED) @@ -541,7 +548,6 @@ else() message(STATUS "Using Lua ${LUA_VERSION_STRING}") endif() - set(USED_LUA_LIBRARIES ${LUA_LIBRARIES}) add_dependency_includes(${LUA_INCLUDE_DIR}) # add a target to generate API documentation with Doxygen @@ -575,19 +581,11 @@ if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILE endif() endif() -# even with mason builds we want to link to system zlib +# even with conan builds we want to link to system zlib # to ensure that osrm binaries play well with other binaries like nodejs find_package(ZLIB REQUIRED) add_dependency_includes(${ZLIB_INCLUDE_DIRS}) -if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS) - add_dependency_defines(-DBOOST_TEST_DYN_LINK) -endif() - -if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS) - add_dependency_defines(-DBOOST_TEST_DYN_LINK) -endif() - add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3) add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE) add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED) @@ -614,7 +612,9 @@ target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY} target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY}) -target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) +if (BUILD_ROUTED) + target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) +endif() set(EXTRACTOR_LIBRARIES ${BZIP2_LIBRARIES} @@ -622,7 +622,7 @@ set(EXTRACTOR_LIBRARIES ${BOOST_BASE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${EXPAT_LIBRARIES} - ${USED_LUA_LIBRARIES} + ${LUA_LIBRARIES} ${OSMIUM_LIBRARIES} ${TBB_LIBRARIES} ${ZLIB_LIBRARY} @@ -630,7 +630,7 @@ set(EXTRACTOR_LIBRARIES set(GUIDANCE_LIBRARIES ${BOOST_BASE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - ${USED_LUA_LIBRARIES} + ${LUA_LIBRARIES} ${TBB_LIBRARIES} ${MAYBE_COVERAGE_LIBRARIES}) set(PARTITIONER_LIBRARIES @@ -656,7 +656,7 @@ set(UPDATER_LIBRARIES set(CONTRACTOR_LIBRARIES ${BOOST_BASE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - ${USED_LUA_LIBRARIES} + ${LUA_LIBRARIES} ${TBB_LIBRARIES} ${MAYBE_RT_LIBRARY} ${MAYBE_COVERAGE_LIBRARIES}) @@ -697,7 +697,7 @@ install(TARGETS osrm-components DESTINATION bin) if(BUILD_TOOLS) message(STATUS "Activating OSRM internal tools") add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $) - target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES}) + target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES}) install(TARGETS osrm-io-benchmark DESTINATION bin) endif() @@ -719,7 +719,9 @@ set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) -set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) +if (BUILD_ROUTED) + set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) +endif() file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp) file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h) @@ -748,7 +750,9 @@ install(TARGETS osrm-partition DESTINATION bin) install(TARGETS osrm-customize DESTINATION bin) install(TARGETS osrm-contract DESTINATION bin) install(TARGETS osrm-datastore DESTINATION bin) -install(TARGETS osrm-routed DESTINATION bin) +if (BUILD_ROUTED) + install(TARGETS osrm-routed DESTINATION bin) +endif() install(TARGETS osrm DESTINATION lib) install(TARGETS osrm_extract DESTINATION lib) install(TARGETS osrm_partition DESTINATION lib) @@ -802,9 +806,26 @@ set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include") list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}") list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm") JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS) -JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY) +# Boost uses imported targets, we need to use a generator expression to extract +# the link libraries to be written to the pkg-config file. +# Conan defines dependencies as CMake targets too, that's why we do the same for them. +foreach(engine_lib ${ENGINE_LIBRARIES}) + if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*") + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$") + else() + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}") + endif() +endforeach(engine_lib) +JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY) +file(GENERATE + OUTPUT + ${PROJECT_BINARY_DIR}/libosrm.pc + INPUT + ${PROJECT_BINARY_DIR}/pkgconfig.configured) + install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig) # uninstall target @@ -862,4 +883,4 @@ if (ENABLE_NODE_BINDINGS) endforeach() add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources}) set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir}) -endif() \ No newline at end of file +endif() diff --git a/README.md b/README.md index 8435d558f..611b1b9c2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | Linux / macOS | Windows | Code Coverage | | ------------- | ------- | ------------- | -| [![Travis](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=master)](https://travis-ci.org/Project-OSRM/osrm-backend) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) | [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) | +| [![osrm-backend CI](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml/badge.svg)](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) | [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) | High performance routing engine written in C++14 designed to run on OpenStreetMap data. diff --git a/appveyor-build.bat b/appveyor-build.bat deleted file mode 100644 index c24f92382..000000000 --- a/appveyor-build.bat +++ /dev/null @@ -1,183 +0,0 @@ -@ECHO OFF -SETLOCAL -SET EL=0 - -ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SET PROJECT_DIR=%CD% -ECHO PROJECT_DIR^: %PROJECT_DIR% -ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% - - -:: Check CMake version -SET CMAKE_VERSION=3.16.3 -SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH% -ECHO cmake^: && cmake --version -IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK - -cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK - -:CMAKE_NOT_OK -ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION% -powershell Invoke-WebRequest https://cmake.org/files/v3.16/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive" -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -:CMAKE_OK -ECHO CMAKE_OK -cmake --version - -ECHO activating VS command prompt ... -SET PATH=C:\Program Files (x86)\MSBuild\15.0\Bin;%PATH% -CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - -ECHO platform^: %platform% - -ECHO cl.exe version -cl -ECHO msbuild version -msbuild /version - -:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive -SET DEPSPKG=osrm-deps-win-x64-14.2-2019.01.7z - -:: local development -ECHO. -ECHO LOCAL_DEV^: %LOCAL_DEV% -IF NOT DEFINED LOCAL_DEV SET LOCAL_DEV=0 -IF DEFINED LOCAL_DEV IF %LOCAL_DEV% EQU 1 IF EXIST %DEPSPKG% ECHO skipping deps download && GOTO SKIPDL - -IF EXIST %DEPSPKG% DEL %DEPSPKG% -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -ECHO downloading %DEPSPKG% -powershell Invoke-WebRequest http://project-osrm.wolt.com/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -:SKIPDL - -IF EXIST osrm-deps ECHO deleting osrm-deps... && RD /S /Q osrm-deps -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -IF EXIST build ECHO deleting build dir... && RD /S /Q build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -7z -y x %DEPSPKG% | %windir%\system32\FIND "ing archive" -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -::tree osrm-deps - -MKDIR build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -cd build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps -set PREFIX=%OSRMDEPSDIR%/libs -set BOOST_ROOT=%OSRMDEPSDIR% -set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib -set TBB_INSTALL_DIR=%OSRMDEPSDIR% -REM set TBB_ARCH_PLATFORM=intel64/vc17 - -ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR% -ECHO PREFIX ^: %PREFIX% -ECHO BOOST_ROOT ^: %BOOST_ROOT% -ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR% -ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR% -REM ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM% - - -ECHO calling cmake .... -cmake .. ^ --G "Visual Studio 16 2019" ^ --DBOOST_ROOT=%BOOST_ROOT% ^ --DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^ --DBoost_ADDITIONAL_VERSIONS=1.73.0 ^ --DBoost_USE_MULTITHREADED=ON ^ --DBoost_USE_STATIC_LIBS=ON ^ --DEXPAT_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DEXPAT_LIBRARY=%OSRMDEPSDIR%/lib/libexpat.lib ^ --DBZIP2_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DBZIP2_LIBRARIES=%OSRMDEPSDIR%/lib/libbz2.lib ^ --DLUA_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DLUA_LIBRARIES=%OSRMDEPSDIR%/lib/lua5.3.5.lib ^ --DZLIB_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DZLIB_LIBRARY=%OSRMDEPSDIR%/lib/libz.lib ^ --DCMAKE_BUILD_TYPE=%CONFIGURATION% ^ --DCMAKE_INSTALL_PREFIX=%PREFIX% -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -ECHO building ... -msbuild OSRM.sln ^ -/p:Configuration=%Configuration% ^ -/p:Platform=x64 ^ -/t:rebuild ^ -/p:BuildInParallel=true ^ -/m:%NUMBER_OF_PROCESSORS% ^ -/toolsversion:Current ^ -/p:PlatformToolset=v142 ^ -/clp:Verbosity=normal ^ -/nologo ^ -/flp1:logfile=build_errors.txt;errorsonly ^ -/flp2:logfile=build_warnings.txt;warningsonly -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -CD %PROJECT_DIR%\build -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -SET PATH=%PROJECT_DIR%\osrm-deps\lib;%PATH% - -ECHO running extractor-tests.exe ... -unit_tests\%Configuration%\extractor-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running engine-tests.exe ... -unit_tests\%Configuration%\engine-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running util-tests.exe ... -unit_tests\%Configuration%\util-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running server-tests.exe ... -unit_tests\%Configuration%\server-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -::TODO: CH processing sometimes mysteriously hangs, need to find why and enable tests below. -::ECHO running library-tests.exe ... -::SET test_region=monaco -::SET test_region_ch=ch\monaco -::SET test_region_corech=corech\monaco -::SET test_region_mld=mld\monaco -::SET test_osm=%test_region%.osm.pbf -::IF NOT EXIST %test_osm% powershell Invoke-WebRequest http://project-osrm.wolt.com/testing/monaco.osm.pbf -OutFile %test_osm% -::ECHO running %Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm% -::%Configuration%\osrm-extract.exe -::%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm% -::MKDIR ch -::XCOPY %test_region%.osrm.* ch\ -::XCOPY %test_region%.osrm ch\ -::MKDIR corech -::XCOPY %test_region%.osrm.* corech\ -::XCOPY %test_region%.osrm corech\ -::MKDIR mld -::XCOPY %test_region%.osrm.* mld\ -::XCOPY %test_region%.osrm mld\ -::%Configuration%\osrm-contract.exe %test_region_ch%.osrm -::%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm -::%Configuration%\osrm-partition.exe %test_region_mld%.osrm -::%Configuration%\osrm-customize.exe %test_region_mld%.osrm -::XCOPY /Y ch\*.* ..\test\data\ch\ -::XCOPY /Y corech\*.* ..\test\data\corech\ -::XCOPY /Y mld\*.* ..\test\data\mld\ -::unit_tests\%Configuration%\library-tests.exe - -:ERROR -ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -ECHO ERRORLEVEL^: %ERRORLEVEL% -SET EL=%ERRORLEVEL% - -:DONE -ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -EXIT /b %EL% diff --git a/appveyor.yml b/appveyor.yml index 3fbf89cb6..a1849a9e7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,3 @@ -environment: - matrix: - - configuration: Release -# - configuration: Debug - -install: - - ps: Install-Product node 6 - -# scripts that are called at very beginning, before repo cloning -init: - - git config --global core.autocrlf input - os: Visual Studio 2019 # clone directory @@ -17,20 +5,11 @@ clone_folder: c:\projects\osrm platform: x64 +# no-op for the time being until someone with access to GitHub checks settings will remove integration with AppVeyor +# https://github.com/Project-OSRM/osrm-backend/pull/6312#issuecomment-1217237055 build_script: - - CALL appveyor-build.bat - -before_test: - - node --version - - npm --version - - npm install --ignore-scripts - - npm link --ignore-scripts - - SET PATH=%CD%\osrm-deps\lib;%PATH% - - SET OSRM_BUILD_DIR=build\%Configuration% -# TODO tests fail with "JavaScript heap out of memory", need a better host? -# - npm test + - EXIT 0 branches: only: - master - diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake index 2b732ca21..237dca8e6 100644 --- a/cmake/FindLua.cmake +++ b/cmake/FindLua.cmake @@ -44,7 +44,7 @@ unset(_lua_append_versions) # this is a function only to have all the variables inside go away automatically function(_lua_set_version_vars) - set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0) if (Lua_FIND_VERSION_EXACT) if (Lua_FIND_VERSION_COUNT GREATER 1) diff --git a/cmake/conan.cmake b/cmake/conan.cmake new file mode 100644 index 000000000..4f5f67e74 --- /dev/null +++ b/cmake/conan.cmake @@ -0,0 +1,1026 @@ +# The MIT License (MIT) + +# Copyright (c) 2018 JFrog + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + + +# This file comes from: https://github.com/conan-io/cmake-conan. Please refer +# to this repository for issues and documentation. + +# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. +# It will take CMake current settings (os, compiler, compiler version, architecture) +# and translate them to conan settings for installing and retrieving dependencies. + +# It is intended to facilitate developers building projects that have conan dependencies, +# but it is only necessary on the end-user side. It is not necessary to create conan +# packages, in fact it shouldn't be use for that. Check the project documentation. + +# version: 0.18.1 + +include(CMakeParseArguments) + +function(_get_msvc_ide_version result) + set(${result} "" PARENT_SCOPE) + if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) + set(${result} 8 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) + set(${result} 9 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) + set(${result} 10 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) + set(${result} 11 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + set(${result} 12 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) + set(${result} 14 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) + set(${result} 15 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) + set(${result} 16 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) + set(${result} 17 PARENT_SCOPE) + else() + message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") + endif() +endfunction() + +macro(_conan_detect_build_type) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) + elseif(CMAKE_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) + if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") + set(_CONAN_SETTING_BUILD_TYPE "Debug") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") + set(_CONAN_SETTING_BUILD_TYPE "Release") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") + set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") + set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") + endif() +endmacro() + +macro(_conan_check_system_name) + #handle -s os setting + if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + #use default conan os setting if CMAKE_SYSTEM_NAME is not defined + set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(CONAN_SYSTEM_NAME Macos) + endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") + set(CONAN_SYSTEM_NAME Neutrino) + endif() + set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) + list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) + if (${_index} GREATER -1) + #check if the cmake system is a conan supported one + set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) + else() + message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") + endif() + endif() +endmacro() + +macro(_conan_check_language) + get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) + if (";${_languages};" MATCHES ";CXX;") + set(LANGUAGE CXX) + set(USING_CXX 1) + elseif (";${_languages};" MATCHES ";C;") + set(LANGUAGE C) + set(USING_CXX 0) + else () + message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") + endif() +endmacro() + +macro(_conan_detect_compiler) + + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_ARCH) + set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) + endif() + + if(USING_CXX) + set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) + endif() + + if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) + # using GCC + # TODO: Handle other params + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + if(${MAJOR} GREATER 4) + set(COMPILER_VERSION ${MAJOR}) + endif() + set(_CONAN_SETTING_COMPILER gcc) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + set(_CONAN_SETTING_COMPILER intel) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) + # using AppleClang + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER apple-clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") + + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if(APPLE) + cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) + if(NOT APPLE_CLANG_POLICY STREQUAL NEW) + message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") + set(_CONAN_SETTING_COMPILER apple-clang) + endif() + endif() + if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) + endif() + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC + OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) + + set(_VISUAL "Visual Studio") + _get_msvc_ide_version(_VISUAL_VERSION) + if("${_VISUAL_VERSION}" STREQUAL "") + message(FATAL_ERROR "Conan: Visual Studio not recognized") + else() + set(_CONAN_SETTING_COMPILER ${_VISUAL}) + set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) + endif() + + if(NOT _CONAN_SETTING_ARCH) + if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") + set(_CONAN_SETTING_ARCH x86_64) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") + message(STATUS "Conan: Using default ARM architecture from MSVC") + set(_CONAN_SETTING_ARCH armv6) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") + set(_CONAN_SETTING_ARCH x86) + else () + message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") + endif() + endif() + + conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) + message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") + set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) + + if (CMAKE_GENERATOR_TOOLSET) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + endif() + else() + message(FATAL_ERROR "Conan: compiler setup not recognized") + endif() + +endmacro() + +function(conan_cmake_settings result) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) + #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) + #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) + #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) + #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) + #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) + #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) + + message(STATUS "Conan: Automatic detection of conan settings from cmake") + + conan_parse_arguments(${ARGV}) + + _conan_detect_build_type(${ARGV}) + + _conan_check_system_name() + + _conan_check_language() + + _conan_detect_compiler(${ARGV}) + + # If profile is defined it is used + if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) + elseif(ARGUMENTS_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) + endif() + + foreach(ARG ${_APPLIED_PROFILES}) + set(_SETTINGS ${_SETTINGS} -pr=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) + conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) + set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) + endforeach() + + if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset) + endif() + + # remove any manually specified settings from the autodetected settings + foreach(ARG ${ARGUMENTS_SETTINGS}) + string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") + message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") + list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") + endforeach() + + # Automatic from CMake + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + + foreach(ARG ${ARGUMENTS_SETTINGS}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}) + endforeach() + + message(STATUS "Conan: Settings= ${_SETTINGS}") + + set(${result} ${_SETTINGS} PARENT_SCOPE) +endfunction() + + +function(conan_cmake_detect_unix_libcxx result) + # Take into account any -stdlib in compile options + get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) + string(GENEX_STRIP "${compile_options}" compile_options) + + # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions + get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) + string(GENEX_STRIP "${defines}" defines) + + foreach(define ${defines}) + if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") + if(define MATCHES "^-D") + set(compile_options ${compile_options} "${define}") + else() + set(compile_options ${compile_options} "-D${define}") + endif() + endif() + endforeach() + + # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable + set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) + if(CMAKE_CXX_COMPILER_ARG1) + # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" + # without this, ccache, winegcc, or other wrappers might lose all their arguments + separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) + list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) + # without --target= we may be calling the wrong underlying GCC + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) + # without --sysroot= we may find the wrong #include + if(CMAKE_SYSROOT_COMPILE) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") + elseif(CMAKE_SYSROOT) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") + endif() + endif() + + separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) + + if(CMAKE_OSX_SYSROOT) + set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") + endif() + + execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "#include " + COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - + OUTPUT_VARIABLE string_defines + ) + + if(string_defines MATCHES "#define __GLIBCXX__") + # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake + if(DEFINED _GLIBCXX_USE_CXX11_ABI) + if(_GLIBCXX_USE_CXX11_ABI) + set(${result} libstdc++11 PARENT_SCOPE) + return() + else() + set(${result} libstdc++ PARENT_SCOPE) + return() + endif() + endif() + + if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") + set(${result} libstdc++11 PARENT_SCOPE) + else() + # Either the compiler is missing the define because it is old, and so + # it can't use the new abi, or the compiler was configured to use the + # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) + set(${result} libstdc++ PARENT_SCOPE) + endif() + else() + set(${result} libc++ PARENT_SCOPE) + endif() +endfunction() + +function(conan_cmake_detect_vs_runtime result) + + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_BUILD_TYPE) + set(build_type "${ARGUMENTS_BUILD_TYPE}") + elseif(CMAKE_BUILD_TYPE) + set(build_type "${CMAKE_BUILD_TYPE}") + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + if(build_type) + string(TOUPPER "${build_type}" build_type) + endif() + set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) + foreach(variable ${variables}) + if(NOT "${${variable}}" STREQUAL "") + string(REPLACE " " ";" flags "${${variable}}") + foreach (flag ${flags}) + if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") + string(SUBSTRING "${flag}" 1 -1 runtime) + set(${result} "${runtime}" PARENT_SCOPE) + return() + endif() + endforeach() + endif() + endforeach() + if("${build_type}" STREQUAL "DEBUG") + set(${result} "MDd" PARENT_SCOPE) + else() + set(${result} "MD" PARENT_SCOPE) + endif() +endfunction() + +function(_collect_settings result) + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset + compiler.cppstd) + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + set(${result} ${detected_setings} PARENT_SCOPE) +endfunction() + +function(conan_cmake_autodetect detected_settings) + _conan_detect_build_type(${ARGV}) + _conan_check_system_name() + _conan_check_language() + _conan_detect_compiler(${ARGV}) + _collect_settings(collected_settings) + set(${detected_settings} ${collected_settings} PARENT_SCOPE) +endfunction() + +macro(conan_parse_arguments) + set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) + set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND) + set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE + PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO + INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) + cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) +endmacro() + +function(old_conan_cmake_install) + # Calls "conan install" + # Argument BUILD is equivalant to --build={missing, PkgName,...} or + # --build when argument is 'BUILD all' (which builds all packages from source) + # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source + # cmake does not identify conan as command, even if it is +x and it is in the path + conan_parse_arguments(${ARGV}) + + if(CONAN_CMAKE_MULTI) + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) + else() + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) + endif() + + set(CONAN_BUILD_POLICY "") + foreach(ARG ${ARGUMENTS_BUILD}) + if(${ARG} STREQUAL "all") + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) + break() + else() + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) + endif() + endforeach() + if(ARGUMENTS_CONAN_COMMAND) + set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + set(CONAN_OPTIONS "") + if(ARGUMENTS_CONANFILE) + if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) + set(CONANFILE ${ARGUMENTS_CONANFILE}) + else() + set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) + endif() + else() + set(CONANFILE ".") + endif() + foreach(ARG ${ARGUMENTS_OPTIONS}) + set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) + endforeach() + if(ARGUMENTS_UPDATE) + set(CONAN_INSTALL_UPDATE --update) + endif() + if(ARGUMENTS_NO_IMPORTS) + set(CONAN_INSTALL_NO_IMPORTS --no-imports) + endif() + set(CONAN_INSTALL_FOLDER "") + if(ARGUMENTS_INSTALL_FOLDER) + set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) + endif() + set(CONAN_OUTPUT_FOLDER "") + if(ARGUMENTS_OUTPUT_FOLDER) + set(CONAN_OUTPUT_FOLDER -of=${ARGUMENTS_OUTPUT_FOLDER}) + endif() + foreach(ARG ${ARGUMENTS_GENERATORS}) + set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_ENV}) + set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) + endforeach() + set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) + + string (REPLACE ";" " " _conan_args "${conan_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") + + if(ARGUMENTS_OUTPUT_QUIET) + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_output + ERROR_VARIABLE conan_output + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + else() + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + +endfunction() + +function(conan_cmake_install) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) + set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER OUTPUT_FOLDER) + set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) + foreach(arg ${installOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") + set(flag "--lockfile-node-id") + elseif("${arg}" STREQUAL "INSTALL_FOLDER") + set(flag "--install-folder") + elseif("${arg}" STREQUAL "OUTPUT_FOLDER") + set(flag "--output-folder") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "GENERATOR") + set(flag "--generator") + elseif("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED NO_IMPORTS) + set(NO_IMPORTS --no-imports) + endif() + set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} ${OUTPUT_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _install_args "${install_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${install_args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan install failed='${return_code}'") + else() + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + endif() + +endfunction() + +function(conan_cmake_lock_create) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(lockCreateOptions UPDATE BASE OUTPUT_QUIET ERROR_QUIET) + set(lockCreateOneValueArgs PATH REFERENCE REMOTE LOCKFILE LOCKFILE_OUT) + set(lockCreateMultiValueArgs BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${lockCreateOptions}" "${lockCreateOneValueArgs}" "${lockCreateMultiValueArgs}" ${ARGN}) + foreach(arg ${lockCreateOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED BASE) + set(BASE --base) + endif() + set(lock_create_Args lock create ${PATH} ${REFERENCE} ${UPDATE} ${BASE} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _lock_create_Args "${lock_create_Args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_lock_create_Args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${lock_create_Args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan lock create failed='${return_code}'") + else() + message(FATAL_ERROR "Conan lock create failed='${return_code}'") + endif() + endif() +endfunction() + +function(conan_cmake_setup_conanfile) + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_CONANFILE) + get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) + # configure_file will make sure cmake re-runs when conanfile is updated + configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) + else() + conan_cmake_generate_conanfile(ON ${ARGV}) + endif() +endfunction() + +function(conan_cmake_configure) + conan_cmake_generate_conanfile(OFF ${ARGV}) +endfunction() + +# Generate, writing in disk a conanfile.txt with the requires, options, and imports +# specified as arguments +# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) +function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) + + conan_parse_arguments(${ARGV}) + + set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") + file(WRITE ${_FN} "") + + if(DEFINED ARGUMENTS_REQUIRES) + file(APPEND ${_FN} "[requires]\n") + foreach(REQUIRE ${ARGUMENTS_REQUIRES}) + file(APPEND ${_FN} ${REQUIRE} "\n") + endforeach() + endif() + + if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) + file(APPEND ${_FN} "[generators]\n") + if (DEFAULT_GENERATOR) + file(APPEND ${_FN} "cmake\n") + endif() + if (DEFINED ARGUMENTS_GENERATORS) + foreach(GENERATOR ${ARGUMENTS_GENERATORS}) + file(APPEND ${_FN} ${GENERATOR} "\n") + endforeach() + endif() + endif() + + if(DEFINED ARGUMENTS_BUILD_REQUIRES) + file(APPEND ${_FN} "[build_requires]\n") + foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) + file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_IMPORTS) + file(APPEND ${_FN} "[imports]\n") + foreach(IMPORTS ${ARGUMENTS_IMPORTS}) + file(APPEND ${_FN} ${IMPORTS} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_OPTIONS) + file(APPEND ${_FN} "[options]\n") + foreach(OPTION ${ARGUMENTS_OPTIONS}) + file(APPEND ${_FN} ${OPTION} "\n") + endforeach() + endif() + +endfunction() + + +macro(conan_load_buildinfo) + if(CONAN_CMAKE_MULTI) + set(_CONANBUILDINFO conanbuildinfo_multi.cmake) + else() + set(_CONANBUILDINFO conanbuildinfo.cmake) + endif() + if(ARGUMENTS_INSTALL_FOLDER) + set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) + else() + set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) + endif() + # Checks for the existence of conanbuildinfo.cmake, and loads it + # important that it is macro, so variables defined at parent scope + if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") + message(STATUS "Conan: Loading ${_CONANBUILDINFO}") + include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) + else() + message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") + endif() +endmacro() + + +macro(conan_cmake_run) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) + message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") + elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) + message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") + endif() + + if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED + AND NOT ARGUMENTS_BUILD_TYPE) + set(CONAN_CMAKE_MULTI ON) + if (NOT ARGUMENTS_CONFIGURATION_TYPES) + set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") + endif() + message(STATUS "Conan: Using cmake-multi generator") + else() + set(CONAN_CMAKE_MULTI OFF) + endif() + + if(NOT CONAN_EXPORTED) + conan_cmake_setup_conanfile(${ARGV}) + if(CONAN_CMAKE_MULTI) + foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) + set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endforeach() + set(CMAKE_BUILD_TYPE) + else() + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endif() + endif() + + if (NOT ARGUMENTS_NO_LOAD) + conan_load_buildinfo() + endif() + + if(ARGUMENTS_BASIC_SETUP) + foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) + if(ARGUMENTS_${_option}) + if(${_option} STREQUAL "CMAKE_TARGETS") + list(APPEND _setup_options "TARGETS") + else() + list(APPEND _setup_options ${_option}) + endif() + endif() + endforeach() + conan_basic_setup(${_setup_options}) + endif() +endmacro() + +macro(conan_check) + # Checks conan availability in PATH + # Arguments REQUIRED, DETECT_QUIET and VERSION are optional + # Example usage: + # conan_check(VERSION 1.0.0 REQUIRED) + set(options REQUIRED DETECT_QUIET) + set(oneValueArgs VERSION) + cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: checking conan executable") + endif() + + find_program(CONAN_CMD conan) + if(NOT CONAN_CMD AND CONAN_REQUIRED) + message(FATAL_ERROR "Conan executable not found! Please install conan.") + endif() + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: Found program ${CONAN_CMD}") + endif() + execute_process(COMMAND ${CONAN_CMD} --version + RESULT_VARIABLE return_code + OUTPUT_VARIABLE CONAN_VERSION_OUTPUT + ERROR_VARIABLE CONAN_VERSION_OUTPUT) + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan --version failed='${return_code}'") + endif() + + if(NOT CONAN_DETECT_QUIET) + string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) + message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") + endif() + + if(DEFINED CONAN_VERSION) + string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO + "${CONAN_VERSION_OUTPUT}") + if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) + message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ + required: ${CONAN_VERSION}. Consider updating via 'pip \ + install conan==${CONAN_VERSION}'.") + endif() + endif() +endmacro() + +function(conan_add_remote) + # Adds a remote + # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional + # Example usage: + # conan_add_remote(NAME bincrafters INDEX 1 + # URL https://api.bintray.com/conan/bincrafters/public-conan + # VERIFY_SSL True) + set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) + + if(DEFINED CONAN_INDEX) + set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") + endif() + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED DETECT_QUIET) + endif() + set(CONAN_VERIFY_SSL_ARG "True") + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) + endif() + message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") + execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan remote failed='${return_code}'") + endif() +endfunction() + +macro(conan_config_install) + # install a full configuration from a local or remote zip file + # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional + # Example usage: + # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git + # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) + set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) + set(multiValueArgs ARGS) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") + endif() + + if(DEFINED CONAN_TYPE) + set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") + endif() + + if(DEFINED CONAN_ARGS) + set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") + endif() + + if(DEFINED CONAN_SOURCE) + set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") + endif() + + if(DEFINED CONAN_TARGET) + set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") + endif() + + set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} + ${CONAN_TYPE_ARG} + ${CONAN_ARGS_ARGS} + ${CONAN_SOURCE_ARGS} + ${CONAN_TARGET_ARGS}) + + message(STATUS "Conan: Installing config from ${CONAN_ITEM}") + execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan config failed='${return_code}'") + endif() +endmacro() diff --git a/docker/Dockerfile b/docker/Dockerfile index 056f8c7b6..5c06dc8ea 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,14 +1,16 @@ -FROM debian:stretch-slim as builder +FROM debian:bullseye-slim as builder ARG DOCKER_TAG ARG BUILD_CONCURRENCY RUN mkdir -p /src && mkdir -p /opt + +RUN apt-get update && \ + apt-get -y --no-install-recommends install cmake make git gcc g++ libbz2-dev libxml2-dev \ + libzip-dev libboost1.74-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 + COPY . /src WORKDIR /src RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \ - apt-get update && \ - apt-get -y --no-install-recommends install cmake make git gcc g++ libbz2-dev libxml2-dev \ - libzip-dev libboost1.62-all-dev lua5.2 liblua5.2-dev libtbb-dev -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 && \ echo "Building OSRM ${DOCKER_TAG}" && \ git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \ echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \ @@ -27,15 +29,15 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || strip /usr/local/bin/* && \ rm -rf /src /usr/local/lib/libosrm* - # Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds # Only the content below ends up in the image, this helps remove /src from the image (which is large) -FROM debian:stretch-slim as runstage +FROM debian:bullseye-slim as runstage RUN mkdir -p /src && mkdir -p /opt RUN apt-get update && \ - apt-get install -y --no-install-recommends libboost-program-options1.62.0 libboost-regex1.62.0 \ - libboost-date-time1.62.0 libboost-chrono1.62.0 libboost-filesystem1.62.0 \ - libboost-iostreams1.62.0 libboost-thread1.62.0 expat liblua5.2-0 libtbb2 &&\ + apt-get install -y --no-install-recommends libboost-program-options1.74.0 libboost-regex1.74.0 \ + libboost-date-time1.74.0 libboost-chrono1.74.0 libboost-filesystem1.74.0 \ + libboost-iostreams1.74.0 libboost-system1.74.0 libboost-thread1.74.0 \ + expat liblua5.2-0 libtbb2 &&\ rm -rf /var/lib/apt/lists/* COPY --from=builder /usr/local /usr/local COPY --from=builder /opt /opt diff --git a/docs/http.md b/docs/http.md index 346e6e2ec..60149856b 100644 --- a/docs/http.md +++ b/docs/http.md @@ -299,9 +299,9 @@ curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397 - `code` if the request was successful `Ok` otherwise see the service dependent and general status codes. - `durations` array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from - the i-th waypoint to the j-th waypoint. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found. + the i-th source to the j-th destination. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found. - `distances` array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel distance from - the i-th waypoint to the j-th waypoint. Values are given in meters. Can be `null` if no route between `i` and `j` can be found. + the i-th source to the j-th destination. Values are given in meters. Can be `null` if no route between `i` and `j` can be found. - `sources` array of `Waypoint` objects describing all sources in order - `destinations` array of `Waypoint` objects describing all destinations in order - `fallback_speed_cells` (optional) array of arrays containing `i,j` pairs indicating which cells contain estimated values based on `fallback_speed`. Will be absent if `fallback_speed` is not used. @@ -762,8 +762,8 @@ step. { "bearings" : [ 10, 92, 184, 270 ], "lanes" : [ { "indications" : [ "left", "straight" ], - "valid" : "false" }, - { "valid" : "true", + "valid" : false }, + { "valid" : true, "indications" : [ "right" ] } ], "out" : 2, @@ -774,9 +774,9 @@ step. { "out" : 1, "lanes" : [ { "indications" : [ "straight" ], - "valid" : "true" }, + "valid" : true }, { "indications" : [ "right" ], - "valid" : "false" } + "valid" : false } ], "bearings" : [ 60, 240, 330 ], "in" : 0, @@ -884,7 +884,7 @@ A `Lane` represents a turn lane at the corresponding turn location. ```json { "indications": ["left", "straight"], - "valid": "false" + "valid": false } ``` @@ -919,7 +919,7 @@ location of the StepManeuver. Further intersections are listed for every cross-w "classes": ["toll", "restricted"], "lanes":{ "indications": ["left", "straight"], - "valid": "false" + "valid": false } } ``` diff --git a/docs/nodejs/api.md b/docs/nodejs/api.md index 9bff3ada8..30358e4e2 100644 --- a/docs/nodejs/api.md +++ b/docs/nodejs/api.md @@ -20,23 +20,24 @@ var osrm = new OSRM('network.osrm'); **Parameters** -- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`) - - `options.algorithm` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'. +- `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`) + - `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'. Make sure you prepared the dataset with the correct toolchain. - - `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore. + - `options.shared_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore. This requires you to run `osrm-datastore` prior to creating an `OSRM` object. - - `options.dataset_name` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Connects to the persistent shared memory datastore defined by `--dataset_name` option when running `osrm-datastore` + - `options.dataset_name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Connects to the persistent shared memory datastore defined by `--dataset_name` option when running `osrm-datastore`. This requires you to run `osrm-datastore --dataset_name` prior to creating an `OSRM` object. - - `options.memory_file` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** *DEPRECATED* + - `options.memory_file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** **DEPRECATED** Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`. - - `options.mmap_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM. - - `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true. - - `options.max_locations_trip` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited). - - `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited). - - `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited). - - `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited). - - `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited). - - `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max.number of alternatives supported in alternative routes query (default: 3). + - `options.mmap_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM. + - `options.path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true. + - `options.max_locations_trip` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited). + - `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited). + - `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited). + - `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited). + - `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5). + - `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited). + - `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3). ### route @@ -44,39 +45,39 @@ Returns the fastest route between two or more coordinates while visiting the way **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query. - - `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query. + - `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. + - `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - - `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. - - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - - `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) - - `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`) - - `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes. + - `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. + - `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. + - `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) + - `options.alternatives` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`) + - `options.alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes. _Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`) - - `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`) - - `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) - - `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - - `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) - - `options.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile. - - `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. - - `options.waypoints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index. + - `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`) + - `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) + - `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) + - `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) + - `options.continue_straight` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile. + - `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. `null`/`true`/`false` - - `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** + - `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index. + - `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** ```javascript var osrm = new OSRM("berlin-latest.osrm"); -osrm.route({coordinates: [[13.438640,52.519930], [13.415852,52.513191]]}, function(err, result) { +osrm.route({coordinates: [[52.519930,13.438640], [52.513191,13.415852]]}, function(err, result) { if(err) throw err; console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order console.log(result.routes); // array of Route objects ordered by descending recommendation rank }); ``` -Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank. ### nearest @@ -86,18 +87,18 @@ Note: `coordinates` in the general options only supports a single `{longitude},{ **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query. - - `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query. + - `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. + - `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - - `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. - - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - - `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) - - `options.number` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned. + - `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. + - `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. + - `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) + - `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned. Must be an integer greater than or equal to `1`. (optional, default `1`) - - `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. - - `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** + - `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. + - `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** @@ -113,37 +114,34 @@ osrm.nearest(options, function(err, response) { }); ``` -Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`. **`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate. Each object has an additional `distance` property, which is the distance in meters to the supplied input coordinate. ### table -Computes duration table for the given locations. Allows for both symmetric and asymmetric -tables. Optionally returns distance table. +Computes duration table for the given locations. Allows for both symmetric and asymmetric tables. +Optionally returns distance table. **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query. - - `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query. + - `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. + - `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - - `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. - - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - - `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) - - `options.sources` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to - use - location with given index as source. Default is to use all. - - `options.destinations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < - #coordinates`) to use location with given index as destination. Default is to use all. - - `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. - - `options.fallback_speed` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second. - - `options.fallback_coordinate` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies diestance between two points. - - `options.scale_factor` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver. - - `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. - - `options.annotations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default) or `['duration', distance']` (return both the duration matrix and the distance matrix). - -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** + - `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`. + - `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. + - `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) + - `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use + location with given index as source. Default is to use all. + - `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all. + - `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. + - `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second. + - `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points. + - `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver. + - `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. + - `options.annotations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default), `[distance']` (return the distance matrix), or `['duration', distance']` (return both the duration matrix and the distance matrix). +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** @@ -158,14 +156,17 @@ var options = { }; osrm.table(options, function(err, response) { console.log(response.durations); // array of arrays, matrix in row-major order + console.log(response.distances); // array of arrays, matrix in row-major order console.log(response.sources); // array of Waypoint objects console.log(response.destinations); // array of Waypoint objects }); ``` -Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `sources`, and `destinations`. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `distances`, `sources`, and `destinations`. **`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint. Values are given in seconds. +**`distances`**: array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint. + Values are given in meters. **`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order. **`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order. **`fallback_speed_cells`**: (optional) if `fallback_speed` is used, will be an array of arrays of `row,column` values, indicating which cells contain estimated values. @@ -181,10 +182,10 @@ and what weights they have applied. **Parameters** -- `ZXY` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like +- `ZXY` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like [wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/). -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** @@ -208,23 +209,23 @@ if they can not be matched successfully. **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query. - - `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query. + - `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. + - `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - - `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) - - `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`) - - `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) - - `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - - `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) - - `options.timestamps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp). - - `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`. - - `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore` (optional, default `split`). - - `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Allows the input track modification to obtain better matching quality for noisy tracks (optional, default `false`). - - `options.waypoints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index. - - `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** + - `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. + - `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) + - `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`) + - `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) + - `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) + - `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`) + - `options.timestamps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp). + - `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`. + - `options.gaps` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore`. (optional, default `split`) + - `options.tidy` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allows the input track modification to obtain better matching quality for noisy tracks. (optional, default `false`) + - `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index. + - `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** @@ -241,12 +242,15 @@ osrm.match(options, function(err, response) { }); ``` -Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`. **`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order. If the trace point was ommited by map matching because it is an outlier, the entry will be null. - Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the - [`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of + Each `Waypoint` object has the following additional properties, + 1) `matchings_index`: Index to the + [`Route`](#route) object in matchings the sub-trace was matched to, + 2) `waypoint_index`: Index of the waypoint inside the matched route. + 3) `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching. **`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property, which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct. @@ -274,23 +278,23 @@ Right now, the following combinations are possible: **Parameters** -- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query. - - `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. - - `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query. + - `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees. + - `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`. - - `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default). - - `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. - - `options.generate_hints` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) - - `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`) - - `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) - - `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) - - `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`) - - `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`) - - `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`) - - `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`) - - `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. - - `options.snapping` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. -- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** + - `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default). + - `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings. + - `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`) + - `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`) + - `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`) + - `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`) + - `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`) + - `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`) + - `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`) + - `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`) + - `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`. + - `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph. +- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** @@ -312,19 +316,28 @@ osrm.trip(options, function(err, response) { }); ``` -Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`. **`waypoints`**: an array of [`Waypoint`](#waypoint) objects representing all waypoints in input order. Each Waypoint object has the following additional properties, 1) `trips_index`: index to trips of the sub-trip the point was matched to, and 2) `waypoint_index`: index of the point in the trip. **`trips`**: an array of [`Route`](#route) objects that assemble the trace. -## Plugin behaviour +## Configuration -All plugins support a second additional object that is available to configure some NodeJS specific behaviours. +All plugins support a second additional object that is available to configure some NodeJS +specific behaviours. -- `plugin_config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query. - - `plugin_config.format` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls. Valid options are `object` (default), which returns a standard Javascript object, as described above, and `json_buffer`, which will return a NodeJS **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string. The latter has the advantage that it can be immediately serialized to disk/sent over the network, and the generation of the string is performed outside the main NodeJS event loop. This option is ignored by the `tile` plugin. +**Parameters** + +- `plugin_config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query. + - `plugin_config.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls. + Valid options are `object` (default), which returns a + standard Javascript object, as described above, and `json_buffer`, which will return a NodeJS + **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string. The latter has + the advantage that it can be immediately serialized to disk/sent over the network, and the + generation of the string is performed outside the main NodeJS event loop. This option is ignored + by the `tile` plugin. **Examples** @@ -350,7 +363,7 @@ Represents a route through (potentially multiple) waypoints. **Parameters** -- **documentation** in +- `external` **documentation** in [`osrm-backend`](../http.md#route-object) ### RouteLeg @@ -359,7 +372,7 @@ Represents a route between two waypoints. **Parameters** -- **documentation** in +- `external` **documentation** in [`osrm-backend`](../http.md#routeleg-object) ### RouteStep @@ -369,14 +382,14 @@ single way to the subsequent step. **Parameters** -- **documentation** in +- `external` **documentation** in [`osrm-backend`](../http.md#routestep-object) ### StepManeuver **Parameters** -- **documentation** in +- `external` **documentation** in [`osrm-backend`](../http.md#stepmaneuver-object) ### Waypoint @@ -385,5 +398,5 @@ Object used to describe waypoint on a route. **Parameters** -- **documentation** in +- `external` **documentation** in [`osrm-backend`](../http.md#waypoint-object) diff --git a/docs/releasing.md b/docs/releasing.md index 9a492cd49..d28374f9e 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -50,7 +50,8 @@ We may introduce forward-compatible changes: query parameters and response prope 7. Push tags and commits: `git push; git push --tags` 8. On https://github.com/Project-OSRM/osrm-backend/releases press `Draft a new release`, write the release tag `vx.y.z` in the `Tag version` field, write the changelog entries in the `Describe this release` field - and press `Publish release`. + and press `Publish release`. Note that Travis deployments will create a release when publishing node binaries, so the release + may already exist. In which case the description should be updated with the changelog entries. 9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release 10. Wait until the travis build has been completed and check if the node binaries were published by doing: `rm -rf node_modules && npm install` locally. diff --git a/docs/windows-deps.md b/docs/windows-deps.md index 47fecc38a..a4965d265 100644 --- a/docs/windows-deps.md +++ b/docs/windows-deps.md @@ -12,20 +12,14 @@ Prepare directories for dependencies, build and target file location.Target dire ### Bzip2 -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/bzip2-1.0.8.tar.gz - * https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz - +1. Download from https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 3. Issue `nmake /f makefile.msc` 4. Copy bzlib.h to $target\include and libbz2.lib to $target\lib ### ZLib -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/zlib-1.2.11.tar.gz - * https://www.zlib.net/zlib-1.2.11.tar.gz - +1. Download https://www.zlib.net/zlib-1.2.11.tar.gz 2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 3. Switch to `contrib\vstudio\vc14` 4. If needed, open `zlibvc.sln` with Visual Studio and retarget to your version of compiler and SDK. @@ -34,10 +28,8 @@ Prepare directories for dependencies, build and target file location.Target dire ### ICU -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://wolt-project.wolt.com/deps/icu4c-66_1-src.zip +1. Download and unpack. * https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.zip - * https://wolt-project.wolt.com/deps/icu4c-66_1-data.zip * https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-data.zip 2. Do retarget if neededby openinig .\source\allinone\allinone.sln and editing projects 3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. @@ -48,10 +40,7 @@ Prepare directories for dependencies, build and target file location.Target dire ### Boost -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/boost_1_73_0.zip - * https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip - +1. Download and unpack https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip 2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 3. Build b2: bootstrap.bat --with-toolset=msvc-14.2 @@ -61,9 +50,7 @@ Prepare directories for dependencies, build and target file location.Target dire ### Expat -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/libexpat-2_2_9.zip - * https://github.com/libexpat/libexpat/archive/R_2_2_9.zip +1. Download and unpack https://github.com/libexpat/libexpat/archive/R_2_2_9.zip 2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 3. Configure build my calling cmake: mkdir expat\build @@ -74,9 +61,7 @@ Prepare directories for dependencies, build and target file location.Target dire ### LUA -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/lua-5.3.5.tar.gz - * https://www.lua.org/ftp/lua-5.3.5.tar.gz +1. Download and unpack https://www.lua.org/ftp/lua-5.3.5.tar.gz 2. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 3. Lua doesn't have native MSVC support, so you have to compile it by hand: cd src @@ -88,9 +73,7 @@ Prepare directories for dependencies, build and target file location.Target dire ### TBB -1. Download either from Wolt OSRM mirror or original distribution and unpack. - * https://project-osrm.wolt.com/deps/oneTBB-v2020.2.zip - * https://github.com/oneapi-src/oneTBB/archive/v2020.2.zip +1. Download and unpack https://github.com/oneapi-src/oneTBB/archive/v2020.2.zip 2. Retarget by opening build\vs2013\makefile.sln 3. Start 'x64 Native Tools Command Prompt for VS2019' and change directory to unpacked source tree. 4. Switch to build\vs2013 and build: `msbuild makefle.sln /nologo /p:Configuration=Release /p:Platform=x64` diff --git a/features/bicycle/exclude.feature b/features/bicycle/exclude.feature index 6fdcbfb07..f88315408 100644 --- a/features/bicycle/exclude.feature +++ b/features/bicycle/exclude.feature @@ -45,7 +45,7 @@ Feature: Bicycle - Exclude flags When I match I should get | trace | matchings | duration | - | abcf | abcf | 301.2 | + | abcf | abcf | 301 | When I request a travel time matrix I should get | | a | f | diff --git a/features/bicycle/maxspeed.feature b/features/bicycle/maxspeed.feature index a4fc57b3d..72f6a0ed6 100644 --- a/features/bicycle/maxspeed.feature +++ b/features/bicycle/maxspeed.feature @@ -9,7 +9,7 @@ Feature: Bike - Max speed restrictions Then routability should be | highway | maxspeed | bothw | | residential | | 15 km/h | - | residential | 10 | 9 km/h | + | residential | 10 | 10 km/h | Scenario: Bicycle - Ignore maxspeed when higher than way speed Then routability should be @@ -65,12 +65,12 @@ Feature: Bike - Max speed restrictions Then routability should be | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | | | | | 15 km/h | 15 km/h | - | 10 | | | 9 km/h | 9 km/h | - | | 10 | | 9 km/h | 15 km/h | - | | | 10 | 14 km/h | 9 km/h | - | 2 | 10 | | 9 km/h | 2 km/h | - | 2 | | 10 | 2 km/h | 9 km/h | - | 2 | 5 | 10 | 5 km/h | 9 km/h | + | 10 | | | 10 km/h | 10 km/h | + | | 10 | | 10 km/h | 15 km/h | + | | | 10 | 15 km/h | 10 km/h | + | 2 | 10 | | 10 km/h | 2 km/h | + | 2 | | 10 | 2 km/h | 10 km/h | + | 2 | 5 | 10 | 5 km/h | 10 km/h | Scenario: Bike - Maxspeed should not allow routing on unroutable ways Then routability should be diff --git a/features/bicycle/safety.feature b/features/bicycle/safety.feature index e45dae500..4561e1a5e 100644 --- a/features/bicycle/safety.feature +++ b/features/bicycle/safety.feature @@ -33,7 +33,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 | | residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 | | cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 | - | footway | track | 15 km/h | 15 km/h | 4.2 | 4.2 | + | footway | track | 14 km/h | 14 km/h | 4.2 | 4.2 | | motorway | lane | 15 km/h | | 4.2 | | | primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | | secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | @@ -41,7 +41,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | | secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | | tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | - | residential | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | + | residential | lane | 14 km/h | 14 km/h | 4.2 | 4.2 | | cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | | footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | | motorway | shared_lane | 15 km/h | | 4.2 | | @@ -59,7 +59,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 | | residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 | | cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 | - | footway | track | | 15 km/h | 4 km/h +-1 | 4.2 | 1.1 | + | footway | track | | 14 km/h | 4 km/h +-1 | 4.2 | 1.1 | | motorway | | track | 15 km/h | | 4.2 | | | primary | | track | 15 km/h | 15 km/h | 2.1 | 4.2 | | secondary | | track | 15 km/h | 15 km/h | 2.7 | 4.2 | @@ -67,7 +67,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | primary_link | | track | 15 km/h | 15 km/h | 2.1 | 4.2 | | secondary_link | | track | 15 km/h | 15 km/h | 2.7 | 4.2 | | tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 | - | residential | | track | 15 km/h | 15 km/h | 4.2 | 4.2 | + | residential | | track | 14 km/h | 14 km/h | 4.2 | 4.2 | | cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 | | footway | | track | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 | | motorway | lane | | 15 km/h | | 4.2 | | @@ -75,7 +75,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | secondary | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 | | tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 | | primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.1 | - | secondary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 | + | secondary_link | lane | | 14 km/h | 14 km/h | 4.2 | 2.7 | | tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 | | residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 | | cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 | @@ -84,7 +84,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | primary | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 | | secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 2.7 | 4.2 | | tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 | - | primary_link | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 | + | primary_link | | lane | 14 km/h | 14 km/h | 2.1 | 4.2 | | secondary_link | | lane | 15 km/h | 15 km/h | 2.7 | 4.2 | | tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 | | residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 | @@ -92,7 +92,7 @@ Feature: Bicycle - Adds penalties to unsafe roads | footway | | lane | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 | | motorway | shared_lane | | 15 km/h | | 4.2 | | | primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.1 | - | motorway | | shared_lane | 15 km/h | | 4.2 | | + | motorway | | shared_lane | 14 km/h | | 4.2 | | | primary | | shared_lane | 15 km/h | 15 km/h | 2.1 | 4.2 | diff --git a/features/bicycle/surface.feature b/features/bicycle/surface.feature index 1a4b5763a..98ec1c250 100644 --- a/features/bicycle/surface.feature +++ b/features/bicycle/surface.feature @@ -8,29 +8,29 @@ Feature: Bike - Surfaces Then routability should be | highway | surface | bothw | | cycleway | | 48 s | - | cycleway | asphalt | 48 s | + | cycleway | asphalt | 47.9 s | | cycleway | cobblestone:flattened | 72 s | | cycleway | paving_stones | 72 s | | cycleway | compacted | 72 s | | cycleway | cobblestone | 120 s | | cycleway | fine_gravel | 120 s | | cycleway | gravel | 120 s | - | cycleway | pebblestone | 120.1 s | + | cycleway | pebblestone | 120 s | | cycleway | dirt | 120 s | | cycleway | earth | 120 s | | cycleway | grass | 120 s | | cycleway | mud | 240 s | - | cycleway | sand | 240.1 s | + | cycleway | sand | 240 s | | cycleway | sett | 72 s | Scenario: Bicycle - Good surfaces on small paths Then routability should be - | highway | surface | bothw | - | cycleway | | 48 s | - | path | | 60 s | - | track | | 60 s | - | track | asphalt | 60 s | - | path | asphalt | 60 s | + | highway | surface | bothw | + | cycleway | | 48 s | + | path | | 59.9 s | + | track | | 60 s | + | track | asphalt | 60 s | + | path | asphalt | 60 s | Scenario: Bicycle - Surfaces should not make unknown ways routable Then routability should be diff --git a/features/bicycle/turn_penalty.feature b/features/bicycle/turn_penalty.feature index d0c144e32..763827527 100644 --- a/features/bicycle/turn_penalty.feature +++ b/features/bicycle/turn_penalty.feature @@ -37,6 +37,6 @@ Feature: Turn Penalties | from | to | distance | weight | # | | a | c | 900m +- 1 | 216 | Going straight has no penalties | | a | d | 900m +- 1 | 220.2 | Turning right had penalties | - | e | g | 2100m +- 4| 503.9 | Going straght has no penalties | - | e | h | 2100m +- 4| 515.1 | Turn sharp right has even higher penalties| + | e | g | 2100m +- 5| 503.9 | Going straght has no penalties | + | e | h | 2100m +- 5| 515.1 | Turn sharp right has even higher penalties| diff --git a/features/car/access.feature b/features/car/access.feature index 47ac4e3c2..0bebd2589 100644 --- a/features/car/access.feature +++ b/features/car/access.feature @@ -185,7 +185,7 @@ Feature: Car - Restricted access Then routability should be | highway | hov | bothw | forw_rate | backw_rate | | primary | designated | x | 18.2 | 18.2 | - | primary | yes | x | 18.2 | 18.2 | + | primary | yes | x | 18.3 | 18.3 | | primary | no | x | 18.2 | 18.2 | # Models: @@ -196,7 +196,7 @@ Feature: Car - Restricted access Then routability should be | highway | hov | hov:lanes | lanes | access | oneway | forw | backw | forw_rate | | motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 25 | - | motorway | lane | | 3 | designated | yes | x | | 25 | + | motorway | lane | | 3 | designated | yes | x | | 25.3 | @hov Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated) @@ -206,7 +206,7 @@ Feature: Car - Restricted access # This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769 #| primary | | designated | | | x | x | 18.2 | 18.2 | #| primary | designated | | | | x | x | 18.2 | 18.2 | - | primary | designated\|designated | designated\|designated | | | x | x | 18.2 | 18.2 | + | primary | designated\|designated | designated\|designated | | | x | x | 18.3 | 18.3 | | primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 | | primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 | | primary | | | | | x | x | 18.2 | 18.2 | diff --git a/features/car/barrier.feature b/features/car/barrier.feature index 3f3220602..fd7e7f834 100644 --- a/features/car/barrier.feature +++ b/features/car/barrier.feature @@ -46,6 +46,18 @@ Feature: Car - Barriers | bollard | rising | x | | bollard | removable | | + # https://github.com/Project-OSRM/osrm-backend/issues/5996 + Scenario: Car - Kerb exception for barriers + Then routability should be + | node/barrier | node/highway | node/kerb | bothw | + | kerb | | | | + | kerb | crossing | | x | + | kerb | crossing | yes | x | + | kerb | | lowered | x | + | kerb | | flush | x | + | kerb | | raised | | + | kerb | | yes | | + Scenario: Car - Height restrictions Then routability should be | node/barrier | node/maxheight | bothw | diff --git a/features/car/conditional_restrictions.feature b/features/car/conditional_restrictions.feature index 23a9e1efe..c2311067c 100644 --- a/features/car/conditional_restrictions.feature +++ b/features/car/conditional_restrictions.feature @@ -387,217 +387,37 @@ Feature: Car - Turn restrictions | m | p | mj,jp,jp | @no_turning @conditionals - Scenario: Car - only_right_turn + Scenario: Car - Multiple conditional restrictions applicable to same turn Given the extract extra arguments "--parse-conditional-restrictions" # time stamp for 10am on Tues, 02 May 2017 GMT Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the node map """ - a - d j b - c + j + | + k - l - m + | + n """ And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | + | nodes | + | kl | + | jl | + | ln | + | lm | And the relations | type | way:from | way:to | node:via | restriction:conditional | - | restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) | + | restriction | kl | lj | l | only_left_turn @ (Sa-Su 07:00-10:30) | + | restriction | kl | ln | l | only_right_turn @ (Mo-Fr 07:00-10:30) | When I route I should get | from | to | route | - | b | c | bj,aj,aj,jc,jc | - | b | a | bj,aj,aj | - | b | d | bj,aj,aj,jd,jd | + | k | m | kl,ln,ln,lm,lm | - @no_turning @conditionals - Scenario: Car - No right turn - Given the extract extra arguments "--parse-conditional-restrictions" - # time stamp for 10am on Tues, 02 May 2017 GMT - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the node map - """ - a - d j b - c - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) | - - When I route I should get - | from | to | route | # | - | b | c | bj,jc,jc | normal turn | - | b | a | bj,jc,jc,aj,aj | avoids right turn | - | b | d | bj,jd,jd | normal maneuver | - - @only_turning @conditionals - Scenario: Car - only_left_turn - Given the extract extra arguments "--parse-conditional-restrictions" - # time stamp for 10am on Tues, 02 May 2017 GMT - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the node map - """ - a - d j b - c - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) | - - When I route I should get - | from | to | route | - | b | c | bj,jc,jc | - | b | a | bj,jc,jc,aj,aj | - | b | d | bj,jc,jc,jd,jd | - - @no_turning @conditionals - Scenario: Car - No left turn - Given the extract extra arguments "--parse-conditional-restrictions" - # time stamp for 10am on Tues, 02 May 2017 GMT - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the node map - """ - a - d j b - c - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) | - - When I route I should get - | from | to | route | - | b | c | bj,aj,aj,jc,jc | - | b | a | bj,aj,aj | - | b | d | bj,jd,jd | - - @no_turning @conditionals - Scenario: Car - Conditional restriction is off - Given the extract extra arguments "--parse-conditional-restrictions" - # time stamp for 10am on Tues, 02 May 2017 GMT - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" - Given the node map - """ - a - d j b - c - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) | - - When I route I should get - | from | to | route | - | b | c | bj,jc,jc | - | b | a | bj,aj,aj | - | b | d | bj,jd,jd | - - @no_turning @conditionals - Scenario: Car - Conditional restriction is on - Given the extract extra arguments "--parse-conditional-restrictions" - # 10am utc, wed - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600" - Given the node map - """ - a - d j b - c - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | bj | yes | - | jd | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) | - - When I route I should get - | from | to | route | - | b | c | bj,jc,jc | - | b | a | bj,jc,jc,aj,aj | - | b | d | bj,jd,jd | - - @no_turning @conditionals - Scenario: Car - Conditional restriction with multiple time windows - Given the extract extra arguments "--parse-conditional-restrictions" - # 5pm Wed 02 May, 2017 GMT - Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400" - Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400" - - Given the node map - """ - a - p | - \ | - j - | \ - c m - """ - - And the ways - | nodes | oneway | - | aj | no | - | jc | no | - | jp | yes | - | mj | yes | - - And the relations - | type | way:from | way:to | node:via | restriction:conditional | - | restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) | - - When I route I should get - | from | to | route | - | a | p | aj,jc,jc,jp,jp | - | m | p | mj,jp,jp | @restriction-way Scenario: Car - prohibit turn @@ -719,7 +539,7 @@ Feature: Car - Turn restrictions When I route I should get | from | to | route | turns | | a | e | cap south,florida nw,florida nw,florida ne | depart,turn right,continue uturn,arrive | - | f | d | cap north,florida nw,florida nw | depart,turn left,arrive | + | f | d | cap north,florida nw,florida nw | depart,turn left,arrive | | e | c | florida ne,florida nw,cap south,cap south | depart,continue uturn,turn right,arrive | @no_turning @conditionals @@ -796,8 +616,8 @@ Feature: Car - Turn restrictions | nodes | name | | ab | albic | | bc | albic | - | db | dobe | - | be | dobe | + | db | dobe | + | be | dobe | And the relations | type | way:from | way:to | node:via | restriction:conditional | @@ -1047,7 +867,7 @@ Feature: Car - Turn restrictions | type | way:from | node:via | way:to | restriction:conditional | | restriction | be | e | de | no_right_turn @ (Mo-Fr 07:00-11:00) | - # node restrictino is off, way restriction is on + # node restriction is off, way restriction is on When I route I should get | from | to | route | turns | locations | | a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d | diff --git a/features/car/ferry.feature b/features/car/ferry.feature index 5a8de7b1b..e5b7d363c 100644 --- a/features/car/ferry.feature +++ b/features/car/ferry.feature @@ -46,10 +46,10 @@ Feature: Car - Handle ferry routes When I route I should get | from | to | route | modes | speed | time | - | a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.4s | - | b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.4s | - | c | e | cde,cde | ferry,ferry | 5 km/h | 151.4s | - | e | c | cde,cde | ferry,ferry | 5 km/h | 151.4s | + | a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.5s | + | b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.5s | + | c | e | cde,cde | ferry,ferry | 5 km/h | 151.5s | + | e | c | cde,cde | ferry,ferry | 5 km/h | 151.5s | Scenario: Car - Properly handle simple durations Given the node map @@ -117,4 +117,4 @@ Feature: Car - Handle ferry routes # Note that matching *should* work across unsnappable ferries When I match I should get | trace | geometry | duration | - | abcdef| 1,1,1.000899,1,1.000899,1,1.002697,1,1.002697,1,1.003596,1,1.003596,1,1.005394,1,1.005394,1,1.006293,1 | 610.9 | + | abcdef| 1,1,1.000898,1,1.000898,1,1.002695,1,1.002695,1,1.003594,1,1.003594,1,1.005391,1,1.005391,1,1.006289,1 | 611 | diff --git a/features/car/maxspeed.feature b/features/car/maxspeed.feature index c7169b37c..d2b8b4f5f 100644 --- a/features/car/maxspeed.feature +++ b/features/car/maxspeed.feature @@ -86,57 +86,57 @@ OSRM will use 4/5 of the projected free-flow speed. Then routability should be | highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | - | primary | | | | | 64 km/h | 64 km/h | 18 | 18 | + | primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 | | primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 | - | primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | - | primary | 60 | 3 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | - | primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | - | primary | | 3 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | - | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | - | primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | - | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | + | primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 | + | primary | 60 | 3 | | | 48 km/h | 48 km/h | 6.7 | 6.7 | + | primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 | + | primary | | 3 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 | + | primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 | + | primary | | 3 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 | + | primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 | | primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | - | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | - | primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | - | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | - | primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | + | primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 | + | primary | 15 | 3 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 | + | primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 | + | primary | 15 | 3 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 | Scenario: Car - Single lane streets be ignored or incur a penalty Then routability should be | highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate | - | primary | | | | | 64 km/h | 64 km/h | 18 | 18 | + | primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 | | primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 | - | primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 | - | primary | 60 | 1 | | | 47 km/h | 47 km/h | 6.7 | 6.7 | - | primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 | - | primary | | 1 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 | - | primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 | - | primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 | - | primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 | + | primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 | + | primary | 60 | 1 | | | 48 km/h | 48 km/h | 6.7 | 6.7 | + | primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 | + | primary | | 1 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 | + | primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 | + | primary | | 1 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 | + | primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 | | primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 | - | primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 | - | primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 | - | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 | - | primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 | + | primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 | + | primary | 15 | 1 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 | + | primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 | + | primary | 15 | 1 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 | Scenario: Car - Single lane streets only incur a penalty for two-way streets Then routability should be | highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate | - | primary | 30 | 1 | yes | 23 km/h | | 6.7 | | - | primary | 30 | 1 | -1 | | 23 km/h | | 6.7 | - | primary | 30 | 1 | | 23 km/h | 23 km/h | 3.3 | 3.3 | - | primary | 30 | 2 | | 23 km/h | 23 km/h | 6.7 | 6.7 | + | primary | 30 | 1 | yes | 24 km/h | | 6.7 | | + | primary | 30 | 1 | -1 | | 24 km/h | | 6.7 | + | primary | 30 | 1 | | 24 km/h | 24 km/h | 3.3 | 3.3 | + | primary | 30 | 2 | | 24 km/h | 24 km/h | 6.7 | 6.7 | Scenario: Car - Forward/backward maxspeed on reverse oneways Then routability should be | highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate | - | primary | | | | -1 | | 64 km/h | | 18 | - | primary | 30 | | | -1 | | 23 km/h | | 6.7 | - | primary | | 30 | | -1 | | 64 km/h | | 18 | - | primary | | | 30 | -1 | | 23 km/h | | 6.7 | - | primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 | - | primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 | + | primary | | | | -1 | | 64 km/h | | 18.1 | + | primary | 30 | | | -1 | | 24 km/h | | 6.7 | + | primary | | 30 | | -1 | | 64 km/h | | 18.1 | + | primary | | | 30 | -1 | | 24 km/h | | 6.7 | + | primary | 20 | 30 | | -1 | | 16 km/h | | 4.4 | + | primary | 20 | | 30 | -1 | | 24 km/h | | 6.7 | Scenario: Car - Respect source:maxspeed diff --git a/features/car/multi_via_restrictions.feature b/features/car/multi_via_restrictions.feature new file mode 100644 index 000000000..42c6c6d42 --- /dev/null +++ b/features/car/multi_via_restrictions.feature @@ -0,0 +1,1033 @@ +@routing @car @restrictions + +Feature: Car - Multiple Via Turn restrictions + + Background: Use car routing + Given the profile "car" + Given a grid size of 200 meters + + + @restriction-way @no_turning @overlap + Scenario: Car - Node restriction inside multiple via restriction + Given the node map + """ + 1 2 3 4 5 + a---b---c---d---e---------f---------g + | | | + |7 |8 |9 + | | | + x---h---------i---------j + """ + + And the ways + | nodes | oneway | name | + | ab | yes | forward | + | bc | yes | forward | + | cd | yes | forward | + | de | yes | forward | + | ef | yes | forward | + | fg | yes | forward | + | eh | yes | first | + | fi | yes | second | + | gj | yes | third | + | ih | yes | back | + | ji | yes | back | + | hx | yes | back | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bc,cd,de,ef | fi | no_right_turn | + + And the relations + | type | way:from | node:via | way:to | restriction | + | restriction | de | e | eh | no_right_turn | + + When I route I should get + | from | to | route | + | 1 | x | forward,third,back,back | + | 2 | x | forward,second,back,back | + | 3 | x | forward,second,back,back | + | 4 | x | forward,second,back,back | + | 5 | x | forward,third,back,back | + | 7 | x | first,back,back | + | 8 | x | second,back,back | + | 9 | x | third,back,back | + + + @restriction-way @no_turning @overlap @conditionals + Scenario: Car - Conditional node restriction inside conditional multiple via restriction + Given the origin -9.2972,10.3811 + # coordinate in Guinée, a country that observes GMT year round + Given the extract extra arguments "--parse-conditional-restrictions" + # time stamp for 10am on Tues, 02 May 2017 GMT + Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the node map + """ + 1 2 3 4 5 + a---b---c---d---e---------f---------g + | | | + |7 |8 |9 + | | | + x---h---------i---------j + """ + + And the ways + | nodes | oneway | name | + | ab | yes | forward | + | bc | yes | forward | + | cd | yes | forward | + | de | yes | forward | + | ef | yes | forward | + | fg | yes | forward | + | eh | yes | first | + | fi | yes | second | + | gj | yes | third | + | ih | yes | back | + | ji | yes | back | + | hx | yes | back | + + And the relations + | type | way:from | way:via | way:to | restriction:conditional | + | restriction | ab | bc,cd,de,ef | fi | no_right_turn @ (Mo-Fr 07:00-10:30) | + + And the relations + | type | way:from | node:via | way:to | restriction:conditional | + | restriction | de | e | eh | no_right_turn @ (Mo-Fr 07:00-10:30) | + | restriction | de | e | eh | only_right_turn @ (Sa-Su 07:00-10:30) | + + When I route I should get + | from | to | route | + | 1 | x | forward,third,back,back | + | 2 | x | forward,second,back,back | + | 3 | x | forward,second,back,back | + | 4 | x | forward,second,back,back | + | 5 | x | forward,third,back,back | + | 7 | x | first,back,back | + | 8 | x | second,back,back | + | 9 | x | third,back,back | + + + @restriction-way @no_turning @overlap + Scenario: Car - Multiple via restriction inside multiple via restriction + Given the node map + """ + 1 2 3 4 5 + a---b---c---d---e---------f---------g + | | | + |7 |8 |9 + | | | + x---h---------i---------j + """ + + And the ways + | nodes | oneway | name | + | ab | yes | forward | + | bc | yes | forward | + | cd | yes | forward | + | de | yes | forward | + | ef | yes | forward | + | fg | yes | forward | + | eh | yes | first | + | fi | yes | second | + | gj | yes | third | + | ih | yes | back | + | ji | yes | back | + | hx | yes | back | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bc,cd,de,ef | fi | no_right_turn | + | restriction | bc | cd,de | eh | no_right_turn | + + When I route I should get + | from | to | route | + | 1 | x | forward,third,back,back | + | 2 | x | forward,second,back,back | + | 3 | x | forward,first,back,back | + | 4 | x | forward,second,back,back | + | 5 | x | forward,third,back,back | + | 7 | x | first,back,back | + | 8 | x | second,back,back | + | 9 | x | third,back,back | + + + @restriction-way @no_turning @overlap @conditionals + Scenario: Car - Conditional multiple via restriction inside conditional multiple via restriction + + Given a grid size of 200 meters + Given the origin -9.2972,10.3811 + # coordinate in Guinée, a country that observes GMT year round + Given the extract extra arguments "--parse-conditional-restrictions" + # time stamp for 10am on Tues, 02 May 2017 GMT + Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the node map + + """ + 1 2 3 4 5 + a---b---c---d---e---------f---------g + | | | + |7 |8 |9 + | | | + x---h---------i---------j + """ + + And the ways + | nodes | oneway | name | + | ab | yes | forward | + | bc | yes | forward | + | cd | yes | forward | + | de | yes | forward | + | ef | yes | forward | + | fg | yes | forward | + | eh | yes | first | + | fi | yes | second | + | gj | yes | third | + | ih | yes | back | + | ji | yes | back | + | hx | yes | back | + + And the relations + | type | way:from | way:via | way:to | restriction:conditional | + | restriction | ab | bc,cd,de,ef | fi | no_right_turn @ (Mo-Fr 07:00-10:30) | + | restriction | bc | cd,de | eh | no_right_turn @ (Mo-Fr 07:00-10:30) | + | restriction | bc | cd,de | eh | only_right_turn @ (Sa-Su 07:00-10:30) | + + When I route I should get + | from | to | route | + | 1 | x | forward,third,back,back | + | 2 | x | forward,second,back,back | + | 3 | x | forward,first,back,back | + | 4 | x | forward,second,back,back | + | 5 | x | forward,third,back,back | + | 7 | x | first,back,back | + | 8 | x | second,back,back | + | 9 | x | third,back,back | + + + @restriction-way @only_turning @overlap + Scenario: Car - Overlapping multiple via restrictions + Given the node map + """ + a f j + | | | + b---d---e---i---k----m + | | | + c g l + """ + + And the ways + | nodes | oneway | name | + | ab | yes | down | + | cb | yes | up | + | bd | yes | right | + | de | yes | right | + | ef | yes | up | + | eg | yes | down | + | ei | yes | right | + | ik | yes | right | + | kj | yes | up | + | kl | yes | down | + | km | yes | right | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bd,de | ei | only_straight_on | + | restriction | de | ei,ik | km | only_straight_on | + + When I route I should get + | from | to | route | + | a | f | | + | a | g | | + | a | j | | + | a | l | | + | a | m | down,right,right | + | c | f | up,right,up,up | + | c | g | up,right,down,down | + | c | j | | + | c | l | | + | c | m | up,right,right | + | i | j | right,up,up | + | i | l | right,down,down | + | i | m | right,right | + + + @restriction-way @only_turning @overlap @conditionals + Scenario: Car - Overlapping conditional multiple via restrictions + Given a grid size of 200 meters + Given the origin -9.2972,10.3811 + # coordinate in Guinée, a country that observes GMT year round + Given the extract extra arguments "--parse-conditional-restrictions" + # time stamp for 10am on Tues, 02 May 2017 GMT + Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200" + Given the node map + """ + a f j + | | | + b---d---e---i---k----m + | | | + c g l + """ + + And the ways + | nodes | oneway | name | + | ab | yes | down | + | cb | yes | up | + | bd | yes | right | + | db | yes | left | + | de | yes | right | + | ed | yes | left | + | ef | yes | up | + | eg | yes | down | + | ei | yes | right | + | ie | yes | left | + | ik | yes | right | + | ki | yes | left | + | kj | yes | up | + | kl | yes | down | + | km | no | end | + + And the relations + | type | way:from | way:via | way:to | restriction:conditional | + | restriction | ab | bd,de | ei | only_straight_on @ (Mo-Fr 07:00-10:30) | + | restriction | ab | bd,de | ef | only_left_turn @ (Sa-Su 07:00-10:30) | + | restriction | de | ei,ik | km | only_straight_on @ (Mo-Fr 07:00-10:30) | + + When I route I should get + | from | to | route | + | a | f | down,right,end,end,left,up,up | + | a | g | down,right,end,end,left,down,down | + | a | j | down,right,end,end,up,up | + | a | l | down,right,end,end,down,down | + | a | m | down,right,end,end | + | c | f | up,right,up,up | + | c | g | up,right,down,down | + | c | j | up,right,end,end,up,up | + | c | l | up,right,end,end,down,down | + | c | m | up,right,end,end | + | i | j | right,up,up | + | i | l | right,down,down | + | i | m | right,end,end | + + + + @restriction-way @only_turning @geometry + Scenario: Car - Multiple via restriction with non-compressable via geometry + Given the node map + """ + a---b---c---d---e---f---g---h + | | | + i j k + """ + + And the ways + | nodes | oneway | name | + | ab | yes | right | + | bcd | yes | right | + | defg | yes | right | + | ci | yes | down | + | ej | yes | down | + | gh | yes | end | + | gk | yes | down | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bcd,defg | gh | only_straight_on | + + When I route I should get + | from | to | route | + | a | h | right,end,end | + | a | k | | + + @restriction-way @only_turning @geometry + Scenario: Car - Multiple via restriction with non-compressable from/to nodes + Given the node map + """ + a---b---c---d---e---f---g---h---i---j---k---l + | | | | | + m n o p q + """ + + And the ways + | nodes | oneway | name | + | abcdefg | yes | right | + | ghi | yes | right | + | ijkl | yes | end | + | cm | yes | down | + | en | yes | down | + | go | yes | down | + | ip | yes | down | + | kq | yes | down | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | abcdefg | ghi | ijkl | only_straight_on | + + When I route I should get + | from | to | route | + | a | l | right,end,end | + | a | p | | + + @restriction-way @no_turning + Scenario: Car - Long unrestricted route and short restricted route + Given the node map + """ + a------------------------------------b + | | + c--d--e--f--------------------------- + """ + + And the ways + | nodes | + | ac | + | ab | + | bf | + | cd | + | de | + | ef | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ac | cd | de | no_straight_on | + + When I route I should get + | from | to | route | + | a | f | ab,bf,bf | + + + @restriction-way @overlap @no_turning + Scenario: Car - Junction with multiple via u-turn restrictions + # Example: https://www.openstreetmap.org/#map=19/52.07399/5.09724 + Given the node map + """ + a b + | | + c---d---e---f + | | + g---h---i---j + | | + k l + """ + + And the ways + | nodes | oneway | name | + | ad | yes | down | + | eb | yes | up | + | fe | yes | left | + | ij | yes | right | + | li | yes | up | + | hk | yes | down | + | gh | yes | right | + | dc | yes | left | + | dh | yes | down | + | hi | yes | right | + | ie | yes | up | + | ed | yes | left | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ad | dh,hi | ie | no_u_turn | + | restriction | li | ie,ed | dh | no_u_turn | + + When I route I should get + | from | to | route | + | a | b | | + | a | c | down,left,left | + | a | k | down,down | + | a | j | down,right,right | + | f | b | left,up,up | + | f | c | left,left | + | f | k | left,down,down | + | f | j | left,down,right,right | + | l | b | up,up | + | l | c | up,left,left | + | l | k | | + | l | j | up,right,right | + | g | b | right,up,up | + | g | c | right,up,left,left | + | g | k | right,down,down | + | g | j | right,right | + + + @restriction-way @overlap @no_turning + Scenario: Car - Junction with multiple via u-turn restrictions, service roads + # Example: https://www.openstreetmap.org/#map=19/48.38566/10.88068 + Given the node map + """ + a b + | | + c---d--e--f---g + | _/| + h__/ | + |\ \ | + i---j-k-l-m---n + | | + o p + """ + + And the ways + | nodes | oneway | name | + | ad | yes | down | + | fb | yes | up | + | gf | yes | left | + | mn | yes | right | + | pm | yes | up | + | jo | yes | down | + | ij | yes | right | + | dc | yes | left | + | dh | yes | down | + | hj | yes | down | + | jkl | yes | right | + | lm | yes | right | + | mf | yes | up | + | fe | yes | left | + | ed | yes | left | + + And the ways + | nodes | oneway | name | highway | access | psv | + | kh | yes | service | service | no | yes | + | lh | no | service | service | no | yes | + | fh | yes | service | service | no | yes | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | hj | jkl,lm | mf | no_u_turn | + | restriction | lm | mf | fe | no_u_turn | + | restriction | mf | fe,ed | dh | no_u_turn | + | restriction | ed | dh,hj | jkl | no_u_turn | + + When I route I should get + | from | to | route | + | a | b | | + | a | c | down,left,left | + | a | o | down,down | + | a | n | down,right,right | + | i | b | right,up,up | + | i | c | | + | i | o | right,down,down | + | i | n | right,right | + | p | b | up,up | + | p | c | up,left,left | + | p | o | | + | p | n | up,right,right | + | g | b | left,up,up | + | g | c | left,left | + | g | o | left,down,down | + | g | n | | + + + @restriction-way @overlap @no_turning + Scenario: Car - Junction with overlapping and duplicate multiple via restrictions + # Example: https://www.openstreetmap.org/#map=19/34.66291/33.01711 + Given the profile file "car" initialized with + """ + profile.properties.left_hand_driving = true + """ + + And the node map + """ + a b + | | + c---d---e---f + | | + g---h---i---j + | | + k l + """ + + And the nodes + | node | highway | + | d | traffic_signals | + | e | traffic_signals | + | h | traffic_signals | + | i | traffic_signals | + + And the ways + | nodes | oneway | name | + | da | yes | up | + | be | yes | down | + | ef | yes | right | + | ji | yes | left | + | il | yes | down | + | kh | yes | up | + | hg | yes | left | + | cd | yes | right | + | hd | yes | up | + | ih | yes | left | + | ei | yes | down | + | de | yes | right | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | be | ei,ih | hd | no_u_turn | + | restriction | ji | ih,hd | de | no_u_turn | + | restriction | kh | hd,de | ei | no_u_turn | + | restriction | cd | de,ei | ih | no_u_turn | + | restriction | hd | de | ei | no_u_turn | + | restriction | de | ei | ih | no_u_turn | + | restriction | ei | ih | hd | no_u_turn | + | restriction | ei | ih,hd | de | no_u_turn | + | restriction | ih | hd | de | no_u_turn | + | restriction | ih | hd,de | ei | no_u_turn | + + When I route I should get + | from | to | route | + | b | a | | + | b | g | down,left,left | + | b | l | down,down | + | b | f | down,right,right | + | j | a | left,up,up | + | j | g | left,left | + | j | l | left,down,down | + | j | f | | + | k | a | up,up | + | k | g | up,left,left | + | k | l | | + | k | f | up,right,right | + | c | a | right,up,up | + | c | g | | + | c | l | right,down,down | + | c | f | right,right | + + + @restriction-way @no_turning + Scenario: Car - Junction with multiple via restriction to side road, traffic lights + # Example: https://www.openstreetmap.org/#map=19/48.23662/16.42545 + Given the node map + """ + e---d + | + f---c---g + | + h---b---i + | + a + """ + + And the nodes + | node | highway | + | c | traffic_signals | + | b | traffic_signals | + + And the ways + | nodes | oneway | name | + | ab | no | up | + | bc | no | up | + | cd | no | up | + | de | no | left | + | hb | yes | right | + | bi | yes | right | + | gc | yes | left | + | cf | yes | left | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bc,cd | de | no_left_turn | + + When I route I should get + | from | to | route | + | a | e | | + | a | f | up,left,left | + | a | g | | + | a | h | | + | a | i | up,right,right | + + + @restriction-way @overlap @no_turning + Scenario: Car - Many overlapping multiple via restrictions, traffic signals + # Example: https://www.openstreetmap.org/#map=19/48.76987/11.43410 + Given the node map + """ + 8 5 + p______a_______n________o__x + 1| | | + | \ / + r___q____b____ m + | \ \___ _/ 7 + \ c _l____k__w + s \ _/ _/ + \ _d/ __j + \ _/ \ _/ + | ___g e_____i + v__t__/ _/ \ 4 + 6 2/ 3\ + f h + """ + + And the nodes + | node | highway | + | n | traffic_signals | + | m | traffic_signals | + | q | traffic_signals | + + And the ways + | nodes | oneway | + | on | yes | + | na | yes | + | ap | yes | + | pr | yes | + | rqb | yes | + | bl | yes | + | oml | yes | + | ld | yes | + | lk | yes | + | ba | yes | + | bcd | no | + | de | no | + | eh | no | + | ei | no | + | ejk | yes | + | rst | yes | + | dgt | yes | + | fe | yes | + | xo | yes | + | tv | yes | + | kw | yes | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | pr | rqb,bcd | dgt | no_right_turn | + | restriction | rqb | bcd,de | ejk | no_left_turn | + | restriction | rqb | bcd | dgt | no_right_turn | + | restriction | fe | ed | dgt | no_u_turn | + | restriction | fe | ed,dcb | bl | no_right_turn | + | restriction | he | ed,dcb | bl | no_right_turn | + | restriction | oml | ld,de | ejk | no_u_turn | + + And the relations + | type | way:from | node:via | way:to | restriction | + | restriction | ap | p | pr | no_u_turn | + | restriction | rqb | b | ba | no_left_turn | + | restriction | ld | d | dcb | no_right_turn | + | restriction | oml | l | lk | no_left_turn | + | restriction | na | a | ab | no_left_turn | + | restriction | dcb | b | bl | no_right_turn | + | restriction | dcb | b | bcd | no_u_turn | + | restriction | bcd | d | dcb | no_u_turn | + | restriction | bl | l | ld | no_right_turn | + + # Additional relations to prevent u-turns on small roads polluting the results + And the relations + | type | way:from | node:via | way:to | restriction | + | restriction | eh | h | he | no_u_turn | + | restriction | ei | i | ie | no_u_turn | + + When I route I should get + | from | to | route | locations | + | 1 | 6 | pr,rst,tv,tv | _,r,t,_ | + | 1 | 3 | pr,rqb,bcd,de,eh,eh | _,r,b,d,e,_ | + | 1 | 4 | pr,rqb,bcd,de,ei,ei | _,r,b,d,e,_ | + | 1 | 7 | pr,rqb,bl,lk,kw,kw | _,r,b,l,k,_ | + | 1 | 8 | | | + | 2 | 6 | | | + | 2 | 3 | fe,eh,eh | _,e,_ | + | 2 | 4 | fe,ei,ei | _,e,_ | + | 2 | 7 | fe,ejk,kw,kw | _,e,k,_ | + | 2 | 8 | fe,de,bcd,ba,ap,ap | _,e,d,b,a,_ | + | 3 | 6 | eh,de,dgt,tv,tv | _,e,d,t,_ | + | 3 | 4 | eh,ei,ei | _,e,_ | + | 3 | 7 | eh,ejk,kw,kw | _,e,k,_ | + | 3 | 8 | eh,de,bcd,ba,ap,ap | _,e,d,b,a,_ | + | 4 | 6 | ei,de,dgt,tv,tv | _,e,d,t,_ | + | 4 | 3 | ei,eh,eh | _,e,_ | + | 4 | 7 | ei,ejk,kw,kw | _,e,k,_ | + | 4 | 8 | ei,de,bcd,ba,ap,ap | _,e,d,b,a,_ | + | 5 | 6 | xo,oml,ld,dgt,tv,tv | _,o,l,d,t,_ | + | 5 | 3 | xo,oml,ld,de,eh,eh | _,o,l,d,e,_ | + | 5 | 4 | xo,oml,ld,de,ei,ei | _,o,l,d,e,_ | + | 5 | 7 | | | + | 5 | 8 | xo,on,na,ap,ap | _,o,n,a,_ | + + + + @restriction-way @overlap @no_turning + Scenario: Car - Multiple via restriction with start and end on same node + # Example: https://www.openstreetmap.org/#map=19/52.41988/16.96088 + Given the node map + """ + |--g---f---e + a | | + |--b---c---d + + """ + + And the nodes + | node | highway | + | b | traffic_signals | + + And the ways + | nodes | oneway | name | + | abc | yes | enter | + | cd | yes | right | + | de | yes | up | + | ef | yes | left | + | fga | yes | exit | + | fc | yes | down | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | abc | cd,de,ef | fga | no_u_turn | + + When I route I should get + | from | to | route | locations | + | a | g | enter,right,up,left,down,right,up,left,exit,exit | a,c,d,e,f,c,d,e,f,g | + | b | a | enter,right,up,left,down,right,up,left,exit,exit | b,c,d,e,f,c,d,e,f,a | + # This is a correct but not within the spirit of the restriction. + # Does this indicate the restriction is not strong enough? + + + @restriction-way @no_turning + Scenario: Car - Multiple via restriction preventing bypassing main road + # Example: https://www.openstreetmap.org/#map=19/48.72429/21.25912 + Given the node map + """ + a--b--c--d--e--f + \ | + --g--h--i--j + | + k + """ + + And the nodes + | node | highway | + | d | traffic_signals | + | e | traffic_signals | + + And the ways + | nodes | oneway | name | + | ab | yes | main | + | bc | yes | main | + | cd | yes | main | + | de | yes | main | + | ef | yes | main | + | bg | yes | side | + | gh | yes | side | + | hi | yes | side | + | ij | yes | side | + | fj | yes | turn | + | jk | yes | turn | + + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bg,gh,hi,ij | jk | no_right_turn | + + When I route I should get + | from | to | route | + | a | k | main,turn,turn | + + + @restriction-way @overlap @no_turning @only_turning + Scenario: Car - Multiple via restriction with to,via,from sharing same node + # Example: https://www.openstreetmap.org/relation/3972923 + Given the node map + """ + e---d + | | + a---b---c + | + f + """ + + And the ways + | nodes | oneway | + | ab | yes | + | bc | yes | + | cd | yes | + | deb | yes | + | bf | yes | + + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bc,cd,deb | bf | no_u_turn | + + And the relations + | type | way:from | node:via | way:to | restriction | + | restriction | ab | b | bc | only_straight_on | + | restriction | deb | b | bc | no_left_turn | + + When I route I should get + | from | to | route | + | a | f | | + # The last restriction is missing from OSM. Without it, + # it produces the route: ab,bc,cd,deb,bc,cd,deb,bf,bf + + + @restriction-way @except + Scenario: Car - Multiple via restriction, exception applies + # Example: https://www.openstreetmap.org/#map=19/50.04920/19.93251 + Given the node map + """ + a---b---c---d--e + """ + + And the ways + | nodes | oneway | + | ab | yes | + | bc | yes | + | cd | yes | + | de | yes | + + + And the relations + | type | way:from | way:via | way:to | restriction | except | + | restriction | ab | bc,cd | de | no_straight_on | motorcar | + + When I route I should get + | from | to | route | + | a | e | ab,bc,cd,de,de | + + + @restriction-way @except @no_turning + Scenario: Car - Multiple via restriction, exception n/a + # Example: https://www.openstreetmap.org/#map=19/50.04920/19.93251 + Given the node map + """ + a---b---c---d--e + """ + + And the ways + | nodes | oneway | + | ab | yes | + | bc | yes | + | cd | yes | + | de | yes | + + + And the relations + | type | way:from | way:via | way:to | restriction | except | + | restriction | ab | bc,cd | de | no_straight_on | psv;emergency | + + When I route I should get + | from | to | route | + | a | e | | + + + @restriction-way @overlap @only_turning + Scenario: Car - Multiple via restriction overlapping single via restriction + Given the node map + """ + e + | + a---b---c---d + | + f - g + | + h + """ + + And the ways + | nodes | name | + | ab | abcd | + | bc | abcd | + | cd | abcd | + | hf | hfb | + | fb | hfb | + | gf | gf | + | ce | ce | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bc | ce | only_left_turn | + | restriction | gf | fb,bc | cd | only_u_turn | + + When I route I should get + | from | to | route | turns | locations | + | a | d | abcd,ce,ce,abcd,abcd | depart,turn left,continue uturn,turn left,arrive | a,c,e,c,d | + | a | e | abcd,ce,ce | depart,turn left,arrive | a,c,e | + | a | f | abcd,hfb,hfb | depart,turn right,arrive | a,b,f | + | g | e | gf,hfb,abcd,abcd,ce,ce | depart,turn right,turn right,continue uturn,turn right,arrive | g,f,b,d,c,e | + | g | d | gf,hfb,abcd,abcd | depart,turn right,turn right,arrive | g,f,b,d | + | h | e | hfb,abcd,ce,ce | depart,end of road right,turn left,arrive | h,b,c,e | + | h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d | + + + @restriction-way + Scenario: Ambiguous from/to ways + Given the node map + """ + a + | + b---d---e + | | + c f + """ + + And the ways + | nodes | + | abc | + | bd | + | de | + | ef | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | abc | bd,de | ef | no_right_turn | + | restriction | ef | de,bd | abc | no_right_turn | + + When I route I should get + | from | to | route | locations | + | a | f | abc,bd,de,ef,ef | a,b,d,e,f | + | f | a | ef,de,bd,abc,abc | f,e,d,b,a | + | c | f | abc,bd,de,ef,ef | c,b,d,e,f | + | f | c | ef,de,bd,abc,abc | f,e,d,b,c | + + + @restriction-way + Scenario: Ambiguous via ways + Given the node map + """ + a + | + b---d---e---c + | + f + """ + + And the ways + | nodes | + | ab | + | bd | + | dec | + | ef | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | bd,dec | ef | no_right_turn | + | restriction | ef | dec,bd | ab | no_right_turn | + + When I route I should get + | from | to | route | locations | + | a | f | ab,bd,dec,ef,ef | a,b,d,e,f | + | f | a | ef,dec,bd,ab,ab | f,e,d,b,a | + + + @restriction-way @invalid + Scenario: Badly tagged restrictions + Given the node map + """ + a--b--c--d--e--f + """ + + And the ways + | nodes | oneway | + | ab | yes | + | bc | yes | + | cd | yes | + | de | yes | + | ef | yes | + + And the relations + | type | way:from | way:via | way:to | restriction | + | restriction | ab | cd,de | ef | no_straight_on | + | restriction | ab | bc,de | ef | no_straight_on | + | restriction | ab | bc,cd | ef | no_straight_on | + | restriction | ef | de,cd | bc | no_straight_on | + + When I route I should get + | from | to | route | locations | + | a | f | ab,bc,cd,de,ef,ef | a,b,c,d,e,f | + diff --git a/features/car/restrictions.feature b/features/car/restrictions.feature index 80cb5b95e..da76f4ded 100644 --- a/features/car/restrictions.feature +++ b/features/car/restrictions.feature @@ -798,82 +798,6 @@ Feature: Car - Turn restrictions | from | to | route | | a | d | ab,be,de,de | - @restriction-way - Scenario: Multi Way restriction - Given the node map - """ - k j - | | - h - - g - f - - e - | | - | | - a - - b - c - - d - | | - l i - """ - - And the ways - | nodes | name | oneway | - | ab | horiz | yes | - | bc | horiz | yes | - | cd | horiz | yes | - | ef | horiz | yes | - | fg | horiz | yes | - | gh | horiz | yes | - | ic | vert | yes | - | cf | vert | yes | - | fj | vert | yes | - | kg | vert | yes | - | gb | vert | yes | - | bl | vert | yes | - - And the relations - | type | way:from | way:via | way:to | restriction | - | restriction | ab | bc,cf,fg | gh | no_u_turn | - - When I route I should get - | from | to | route | - | a | h | horiz,vert,horiz,horiz | - - @restriction-way - Scenario: Multi-Way overlapping single-way - Given the node map - """ - e - | - a - b - c - d - | - f - g - | - h - """ - - And the ways - | nodes | name | - | ab | abcd | - | bc | abcd | - | cd | abcd | - | hf | hfb | - | fb | hfb | - | gf | gf | - | ce | ce | - - And the relations - | type | way:from | way:via | way:to | restriction | - | restriction | ab | bc | ce | only_left_turn | - | restriction | gf | fb,bc | cd | only_u_turn | - - When I route I should get - | from | to | route | turns | locations | - | a | d | abcd,ce,ce,abcd,abcd | depart,turn left,continue uturn,turn left,arrive | a,c,e,c,d | - | a | e | abcd,ce,ce | depart,turn left,arrive | a,c,e | - | a | f | abcd,hfb,hfb | depart,turn right,arrive | a,b,f | - | g | e | gf,hfb,abcd,ce,ce | depart,turn right,turn right,turn left,arrive | g,f,b,c,e | - | g | d | gf,hfb,abcd,abcd | depart,turn right,turn right,arrive | g,f,b,d | - | h | e | hfb,abcd,ce,ce | depart,end of road right,turn left,arrive | h,b,c,e | - | h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d | - - @restriction-way Scenario: Car - prohibit turn, traffic lights Given the node map @@ -984,8 +908,6 @@ Feature: Car - Turn restrictions | restriction | ab | bge | de | no_right_turn | | restriction | bc | bge | ef | no_left_turn | - # this case is currently not handling the via-way restrictions and we need support for looking across traffic signals. - # It is mainly included to show limitations and to prove that we don't crash hard here When I route I should get | from | to | route | | a | d | ab,bge,ef,ef,de,de | diff --git a/features/car/speed.feature b/features/car/speed.feature index bbbb67b6f..37d9f3512 100644 --- a/features/car/speed.feature +++ b/features/car/speed.feature @@ -9,29 +9,29 @@ Feature: Car - speeds Scenario: Car - speed of various way types Then routability should be | highway | oneway | bothw | - | motorway | no | 89 km/h | - | motorway_link | no | 44 km/h | - | trunk | no | 85 km/h | - | trunk_link | no | 39 km/h | + | motorway | no | 90 km/h | + | motorway_link | no | 45 km/h | + | trunk | no | 84 km/h | + | trunk_link | no | 40 km/h | | primary | no | 64 km/h | - | primary_link | no | 29 km/h | - | secondary | no | 55 km/h | - | secondary_link | no | 24 km/h | - | tertiary | no | 39 km/h | + | primary_link | no | 30 km/h | + | secondary | no | 54 km/h | + | secondary_link | no | 25 km/h | + | tertiary | no | 40 km/h | | tertiary_link | no | 20 km/h | - | unclassified | no | 24 km/h | - | residential | no | 24 km/h | - | living_street | no | 9 km/h | + | unclassified | no | 25 km/h | + | residential | no | 25 km/h | + | living_street | no | 10 km/h | | service | no | 15 km/h | # Alternating oneways scale rates but not speeds Scenario: Car - scaled speeds for oneway=alternating Then routability should be | highway | oneway | junction | forw | backw | # | - | tertiary | | | 39 km/h | 39 km/h | | - | tertiary | alternating | | 39 km/h | 39 km/h | | - | motorway | | | 89 km/h | | implied oneway | - | motorway | alternating | | 89 km/h | | implied oneway | + | tertiary | | | 40 km/h | 40 km/h | | + | tertiary | alternating | | 40 km/h | 40 km/h | | + | motorway | | | 90 km/h | | implied oneway | + | motorway | alternating | | 90 km/h | | implied oneway | | motorway | reversible | | | | unroutable | | primary | | roundabout | 64 km/h | | implied oneway | | primary | alternating | roundabout | 64 km/h | | implied oneway | @@ -42,12 +42,12 @@ Feature: Car - speeds | highway | maxspeed | forw | backw | | primary | | 64 km/h | 64 km/h | - | primary | 60 | 47 km/h | 47 km/h | - | primary | 60 | 47 km/h | 47 km/h | - | primary | 60 | 47 km/h | 47 km/h | + | primary | 60 | 48 km/h | 48 km/h | + | primary | 60 | 48 km/h | 48 km/h | + | primary | 60 | 48 km/h | 48 km/h | Scenario: Car - Side road penalties Then routability should be | highway | side_road | forw | backw | forw_rate | backw_rate | - | primary | yes | 64 km/h | 64 km/h | 14.4 | 14.4 | + | primary | yes | 64 km/h | 64 km/h | 14.5 | 14.5 | diff --git a/features/car/startpoint.feature b/features/car/startpoint.feature index 9e753843b..696f1ae31 100644 --- a/features/car/startpoint.feature +++ b/features/car/startpoint.feature @@ -53,8 +53,8 @@ Feature: Car - Allowed start/end modes When I request a travel time matrix I should get | | 2 | c | - | 1 | 59.1 | 35.1 | - | b | 35.1 | 11.1 | + | 1 | 59.1 | 35.2 | + | b | 35 | 11.1 | When I route I should get | from | to | route | @@ -121,5 +121,5 @@ Feature: Car - Allowed start/end modes When I request a travel time matrix I should get | | 2 | c | - | 1 | 59.1 | 35.1 | - | b | 35.1 | 11.1 | \ No newline at end of file + | 1 | 59.1 | 35.2 | + | b | 35 | 11.1 | \ No newline at end of file diff --git a/features/car/surface.feature b/features/car/surface.feature index 8984a8e06..067e56500 100644 --- a/features/car/surface.feature +++ b/features/car/surface.feature @@ -65,7 +65,7 @@ Feature: Car - Surfaces Then routability should be | highway | oneway | surface | forw | backw | | motorway | no | | 90 km/h | 90 km/h | - | motorway | no | asphalt | 90 km/h | 90 km/h +-1 | + | motorway | no | asphalt | 91 km/h | 90 km/h +-1 | | motorway | no | concrete | 90 km/h +-1 | 90 km/h +-1 | | motorway | no | concrete:plates | 90 km/h +-1 | 90 km/h +-1 | | motorway | no | concrete:lanes | 90 km/h +-1 | 90 km/h +-1 | diff --git a/features/car/traffic_light_penalties.feature b/features/car/traffic_light_penalties.feature index e5bc313a0..e8961abb1 100644 --- a/features/car/traffic_light_penalties.feature +++ b/features/car/traffic_light_penalties.feature @@ -59,7 +59,7 @@ Feature: Car - Handle traffic lights When I route I should get | from | to | route | geometry | - | a | c | abc,abc | _ibE_ibE?gJ?gJ | + | a | c | abc,abc | _ibE_ibE?gJ?eJ | @traffic Scenario: Traffic update on the edge with a traffic signal @@ -89,5 +89,5 @@ Feature: Car - Handle traffic lights When I route I should get | from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight | - | a | c | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 | - | c | a | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 | + | a | c | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 | + | c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 | diff --git a/features/car/weight.feature b/features/car/weight.feature index 6bf7a1d6e..d7f02ac57 100644 --- a/features/car/weight.feature +++ b/features/car/weight.feature @@ -83,4 +83,4 @@ Feature: Car - weights | waypoints | bearings | route | distance | weights | times | | a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s | | b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s | - | a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s | + | a,d | 90 180 | abc,bd,bd | 400m | 200,200,0 | 13.2s,11.1s,0s | diff --git a/features/foot/names.feature b/features/foot/names.feature index c14b00b7f..8b8498c26 100644 --- a/features/foot/names.feature +++ b/features/foot/names.feature @@ -20,3 +20,20 @@ Feature: Foot - Street names in instructions When I route I should get | from | to | route | ref | | a | c | My Way,, | ,A7,A7 | + + + Scenario: Foot - Combines named roads with suffix changes + Given the node map + """ + a b c d + """ + + And the ways + | nodes | name | + | ab | High Street W | + | bc | High Street E | + | cd | Market Street | + + When I route I should get + | from | to | route | + | a | d | High Street W,Market Street,Market Street | diff --git a/features/foot/restrictions.feature b/features/foot/restrictions.feature index 5273a47b1..263aa6416 100644 --- a/features/foot/restrictions.feature +++ b/features/foot/restrictions.feature @@ -29,7 +29,7 @@ Feature: Foot - Turn restrictions When I route I should get | from | to | route | | s | w | sj,wj,wj | - | s | n | sj,nj,nj | + | s | n | sj,nj | | s | e | sj,ej,ej | @only_turning @@ -55,7 +55,7 @@ Feature: Foot - Turn restrictions When I route I should get | from | to | route | | s | w | sj,wj,wj | - | s | n | sj,nj,nj | + | s | n | sj,nj | | s | e | sj,ej,ej | @except diff --git a/features/guidance/anticipate-lanes.feature b/features/guidance/anticipate-lanes.feature index c082dc3c1..74f6f7d4c 100644 --- a/features/guidance/anticipate-lanes.feature +++ b/features/guidance/anticipate-lanes.feature @@ -103,7 +103,7 @@ Feature: Turn Lane Guidance When I route I should get | waypoints | route | turns | lanes | - | a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:false slight left:true,straight:false slight right:true, | + | a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:true slight left:true,straight:false slight right:true, | @anticipate @@ -364,8 +364,8 @@ Feature: Turn Lane Guidance When I route I should get | waypoints | route | turns | lanes | - | a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, | - | a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, | + | a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:true right:false, | + | a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:false right:true, | @anticipate Scenario: Anticipate Lanes for through with turn before / after @@ -390,15 +390,15 @@ Feature: Turn Lane Guidance | il | | il | | When I route I should get - | waypoints | route | turns | lanes | # | - | a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | - | a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | - | a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | | - | a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect | - | c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | - | c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | - | c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | | - | c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect | + | waypoints | route | turns | lanes | # | + | a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:true right:true right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | + | a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:true right:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | + | a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:true right:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | | + | a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:true right:true right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect | + | c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:true left:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | | + | c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:true left:true left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | | + | c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:true left:true left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | | + | c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:true left:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect | @anticipate Scenario: Anticipate Lanes for turns with through before and after @@ -811,9 +811,9 @@ Feature: Turn Lane Guidance | hj | 7th | | no | When I route I should get - | waypoints | route | turns | locations | lanes | - | a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, | - | a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, | + | waypoints | route | turns | locations | lanes | + | a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;none:true none:true right:false, | + | a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true,none:false none:false right:true, | @anticipate Scenario: Oak St, Franklin St diff --git a/features/guidance/dedicated-turn-roads.feature b/features/guidance/dedicated-turn-roads.feature index 03213bd70..055f2af88 100644 --- a/features/guidance/dedicated-turn-roads.feature +++ b/features/guidance/dedicated-turn-roads.feature @@ -687,7 +687,7 @@ Feature: Slipways and Dedicated Turn Lanes When I route I should get | waypoints | route | turns | locations | - | s,f | sabc,ae,dbef,dbef | depart,fork slight right,turn right,arrive | s,a,e,f | + | s,f | sabc,ae,dbef,dbef | depart,turn straight,turn right,arrive | s,a,e,f | @sliproads Scenario: Traffic Signal on Sliproad diff --git a/features/guidance/merge-segregated-roads.feature b/features/guidance/merge-segregated-roads.feature index 8134a2fc0..c802d4ade 100644 --- a/features/guidance/merge-segregated-roads.feature +++ b/features/guidance/merge-segregated-roads.feature @@ -64,7 +64,7 @@ Feature: Merge Segregated Roads When I route I should get | waypoints | route | intersections | - | a,f | road,road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315;true:90 false:225 true:315;true:270 | + | a,f | road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315,true:90 false:225 true:315;true:270 | #https://www.openstreetmap.org/#map=19/52.50003/13.33915 @negative @@ -193,7 +193,7 @@ Feature: Merge Segregated Roads When I route I should get | waypoints | route | intersections | - | a,g | road,road | true:90,false:90 true:150 false:270,true:90 false:270 true:345;true:270 | + | a,g | road,road | true:90,false:90 true:165 false:270,true:90 false:270 true:345;true:270 | Scenario: Merging parallel roads with intermediate bridges # https://www.mapillary.com/app/?lat=52.466483333333336&lng=13.431908333333332&z=17&focus=photo&pKey=LWXnKqoGqUNLnG0lofiO0Q diff --git a/features/guidance/obvious-turn-discovery.feature b/features/guidance/obvious-turn-discovery.feature index fd846acef..0ad8a0845 100644 --- a/features/guidance/obvious-turn-discovery.feature +++ b/features/guidance/obvious-turn-discovery.feature @@ -277,7 +277,7 @@ Feature: Simple Turns When I route I should get | from | to | route | turns | | a | c | menz,rem | depart,arrive | - | d | c | rem,rem,rem | depart,continue left,arrive | + | d | c | rem,rem | depart,arrive | | c | d | rem,rem,rem | depart,continue right,arrive | | c | a | rem,menz | depart,arrive | diff --git a/features/guidance/ramp.feature b/features/guidance/ramp.feature index a4e823ded..560952d0b 100644 --- a/features/guidance/ramp.feature +++ b/features/guidance/ramp.feature @@ -160,8 +160,8 @@ Feature: Ramp Guidance When I route I should get | waypoints | route | turns | - | a,d | ab,bd,bd | depart,on ramp right,arrive | - | a,c | ab,bc,bc | depart,turn left,arrive | + | a,d | ab,bd,bd | depart,on ramp right,arrive | + | a,c | ab,bc | depart,arrive | Scenario: Fork Slight Ramp Given the node map @@ -179,8 +179,8 @@ Feature: Ramp Guidance When I route I should get | waypoints | route | turns | - | a,d | ab,bd,bd | depart,on ramp slight right,arrive | - | a,c | ab,bc,bc | depart,turn slight left,arrive | + | a,d | ab,bd,bd | depart,on ramp slight right,arrive | + | a,c | ab,bc | depart,arrive | Scenario: Fork Slight Ramp on Through Street Given the node map diff --git a/features/guidance/roundabout.feature b/features/guidance/roundabout.feature index 3b5610dcd..5245c310a 100644 --- a/features/guidance/roundabout.feature +++ b/features/guidance/roundabout.feature @@ -791,10 +791,10 @@ Feature: Basic Roundabout # the turn angles here are quite strange, so we do get uturns for exiting When I route I should get | from | to | route | turns | distance | - | e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80.1m | - | f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m | - | k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80.1m | - | l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m | + | e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80m | + | f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m | + | k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80m | + | l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m | @4030 @4075 Scenario: Service roundabout with service exits @@ -846,5 +846,5 @@ Feature: Basic Roundabout When I route I should get | from | to | route | turns | distance | - | e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.1m | + | e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.2m | | 1 | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 159.1m | diff --git a/features/guidance/turn-lanes.feature b/features/guidance/turn-lanes.feature index f34774e9e..1db63bfcb 100644 --- a/features/guidance/turn-lanes.feature +++ b/features/guidance/turn-lanes.feature @@ -836,9 +836,9 @@ Feature: Turn Lane Guidance | cf | secondary | bottom | | When I route I should get - | waypoints | turns | route | lanes | - | a,d | depart,continue right,continue right,arrive | road,road,road,road | ,straight:false right:true,, | - | d,a | depart,continue left,continue left,arrive | road,road,road,road | ,left:true straight:false,, | + | waypoints | turns | route | lanes | + | a,d | depart,continue uturn,arrive | road,road,road | ,straight:false right:true;, | + | d,a | depart,continue uturn,arrive | road,road,road | ,left:true straight:false;, | @simple Scenario: Merge Lanes Onto Freeway diff --git a/features/lib/osrm_loader.js b/features/lib/osrm_loader.js index a29d53b8e..9d409f3d6 100644 --- a/features/lib/osrm_loader.js +++ b/features/lib/osrm_loader.js @@ -45,11 +45,12 @@ class OSRMBaseLoader{ var retryCount = 0; let retry = (err) => { if (err) { - if (retryCount < 10) { + if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) { + const timeoutMs = 10 * Math.pow(this.scope.OSRM_CONNECTION_EXP_BACKOFF_COEF, retryCount); retryCount++; - setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, 10); + setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, timeoutMs); } else { - callback(new Error("Could not connect to osrm-routed after ten retries.")); + callback(new Error(`Could not connect to osrm-routed after ${this.scope.OSRM_CONNECTION_RETRIES} retries.`)); } } else diff --git a/features/options/extract/turn_function.feature b/features/options/extract/turn_function.feature index a1db9339f..eecb29604 100644 --- a/features/options/extract/turn_function.feature +++ b/features/options/extract/turn_function.feature @@ -180,3 +180,30 @@ Feature: Turn Function Information And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 3, access_turn_classification: 0/ # turning abc, give information about about db And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: false, highway_turn_classification: 0, access_turn_classification: 1/ + + Scenario: Turns should have correct information of two-way roads at intersection + Given the node map + """ + b + | + a-c-d + | + e + """ + And the ways + | nodes | highway | oneway | + | ac | motorway | yes | + | cd | motorway_link | yes | + | bc | trunk | yes | + | cb | trunk_link | yes | + | ce | primary | yes | + | ec | primary_link | yes | + And the data has been saved to disk + + When I run "osrm-extract --profile {profile_file} {osm_file}" + Then it should exit successfully + # Turn acd + # on the left there should be cb (and bc) + And stdout should contain /roads_on_the_left \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: true, highway_turn_classification: [0-9]+, access_turn_classification: 0, priority_class: 3/ + # on the right there should be ce and ec + And stdout should contain /roads_on_the_right \[1\] speed: [0-9]+, is_incoming: true, is_outgoing: true, highway_turn_classification: [0-9]+, access_turn_classification: 0, priority_class: 4/ diff --git a/features/raster/extract.feature b/features/raster/extract.feature index 8f2514aef..ad35b9bac 100644 --- a/features/raster/extract.feature +++ b/features/raster/extract.feature @@ -20,6 +20,6 @@ Feature: osrm-extract with a profile containing raster source And the data has been saved to disk When I run "osrm-extract {osm_file} -p {profile_file}" Then stdout should contain "source loader" - Then stdout should contain "slope: 0.0899" - Then stdout should contain "slope: -0.0899" + Then stdout should contain "slope: 0.0904" + Then stdout should contain "slope: -0.0904" And it should exit successfully diff --git a/features/step_definitions/routability.js b/features/step_definitions/routability.js index 93aa9e41c..7c9c55d8f 100644 --- a/features/step_definitions/routability.js +++ b/features/step_definitions/routability.js @@ -1,6 +1,6 @@ -var util = require('util'); -var d3 = require('d3-queue'); -var classes = require('../support/data_classes'); +const util = require('util'); +const d3 = require('d3-queue'); +const classes = require('../support/data_classes'); module.exports = function () { this.Then(/^routability should be$/, (table, callback) => { @@ -115,8 +115,11 @@ module.exports = function () { var result = {}; var testDirection = (dir, callback) => { - var a = new classes.Location(this.origin[0] + (1+this.WAY_SPACING*i) * this.zoom, this.origin[1]), - b = new classes.Location(this.origin[0] + (3+this.WAY_SPACING*i) * this.zoom, this.origin[1]), + const coordA = this.offsetOriginBy(1+this.WAY_SPACING*i, 0); + const coordB = this.offsetOriginBy(3+this.WAY_SPACING*i, 0); + + var a = new classes.Location(coordA[0], coordA[1]), + b = new classes.Location(coordB[0], coordB[1]), r = {}; r.which = dir; diff --git a/features/support/cache.js b/features/support/cache.js index 2d9f99239..ccf6a8568 100644 --- a/features/support/cache.js +++ b/features/support/cache.js @@ -114,9 +114,12 @@ module.exports = function() { let dependencies = [ this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, + this.OSRM_CUSTOMIZE_PATH, + this.OSRM_PARTITION_PATH, this.LIB_OSRM_EXTRACT_PATH, - this.LIB_OSRM_GUIDANCE_PATH, - this.LIB_OSRM_CONTRACT_PATH + this.LIB_OSRM_CONTRACT_PATH, + this.LIB_OSRM_CUSTOMIZE_PATH, + this.LIB_OSRM_PARTITION_PATH ]; var addLuaFiles = (directory, callback) => { diff --git a/features/support/data.js b/features/support/data.js index e9e1f06f4..6dd5fc545 100644 --- a/features/support/data.js +++ b/features/support/data.js @@ -9,17 +9,27 @@ const classes = require('./data_classes'); const tableDiff = require('../lib/table_diff'); const ensureDecimal = require('../lib/utils').ensureDecimal; const errorReason = require('../lib/utils').errorReason; +const CheapRuler = require('cheap-ruler'); module.exports = function () { this.setGridSize = (meters) => { + this.gridSize = parseFloat(meters); + // the constant is calculated (with BigDecimal as: 1.0/(DEG_TO_RAD*EARTH_RADIUS_IN_METERS // see ApproximateDistance() in ExtractorStructs.h // it's only accurate when measuring along the equator, or going exactly north-south - this.zoom = parseFloat(meters) * 0.8990679362704610899694577444566908445396483347536032203503E-5; + this.zoom = this.gridSize * 0.8990679362704610899694577444566908445396483347536032203503E-5; }; this.setOrigin = (origin) => { this.origin = origin; + // we use C++ version of `cheap-ruler` inside OSRM in order to do distance calculations, + // so here we use it too to have a bit more precise assertions + this.ruler = new CheapRuler(this.origin[1], 'meters'); + }; + + this.offsetOriginBy = (xCells, yCells) => { + return this.ruler.offset(this.origin, xCells * this.gridSize, yCells * this.gridSize); }; this.buildWaysFromTable = (table, callback) => { @@ -35,9 +45,10 @@ module.exports = function () { // add some nodes var makeFakeNode = (namePrefix, offset) => { + const coord = this.offsetOriginBy(offset + this.WAY_SPACING * ri, 0); return new OSM.Node(this.makeOSMId(), this.OSM_USER, this.OSM_TIMESTAMP, - this.OSM_UID, this.origin[0]+(offset + this.WAY_SPACING * ri) * this.zoom, - this.origin[1], {name: util.format('%s%d', namePrefix, ri)}); + this.OSM_UID, coord[0], + coord[1], {name: util.format('%s%d', namePrefix, ri)}); }; var nodes = ['a','b','c','d','e'].map((l, i) => makeFakeNode(l, i)); @@ -98,7 +109,7 @@ module.exports = function () { }; this.tableCoordToLonLat = (ci, ri) => { - return [this.origin[0] + ci * this.zoom, this.origin[1] - ri * this.zoom].map(ensureDecimal); + return this.offsetOriginBy(ci, -ri).map(ensureDecimal); }; this.addOSMNode = (name, lon, lat, id) => { diff --git a/features/support/env.js b/features/support/env.js index 9b4c5acc9..eaa25fbc5 100644 --- a/features/support/env.js +++ b/features/support/env.js @@ -40,6 +40,9 @@ module.exports = function () { this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000; this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1'; + this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10; + this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0; + this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`; this.OSRM_PROFILE = process.env.OSRM_PROFILE; @@ -67,10 +70,13 @@ module.exports = function () { this.OSRM_EXTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-extract', this.EXE)); this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE)); + this.OSRM_CUSTOMIZE_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-customize', this.EXE)); + this.OSRM_PARTITION_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-partition', this.EXE)); this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE)); this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'), - this.LIB_OSRM_GUIDANCE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_guidance'), this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'), + this.LIB_OSRM_CUSTOMIZE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_customize'), + this.LIB_OSRM_PARTITION_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_partition'), this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm'); // eslint-disable-next-line no-console @@ -111,7 +117,7 @@ module.exports = function () { }; var q = d3.queue(); - [this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); }); + [this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_CUSTOMIZE_PATH, this.OSRM_PARTITION_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); }); q.awaitAll(callback); }; diff --git a/features/testbot/annotations.feature b/features/testbot/annotations.feature index 706eb9504..5e31be73a 100644 --- a/features/testbot/annotations.feature +++ b/features/testbot/annotations.feature @@ -115,4 +115,4 @@ Feature: Annotations When I route I should get | from | to | route | a:speed | a:distance | a:duration | a:nodes | - | a | c | abc,abc | 10:10 | 249.998641:299.931643 | 25:30 | 1:2:3 | + | a | c | abc,abc | 10:10 | 249.987619:299.962882 | 25:30 | 1:2:3 | diff --git a/features/testbot/bearing_param.feature b/features/testbot/bearing_param.feature index ec6708a70..227324bff 100644 --- a/features/testbot/bearing_param.feature +++ b/features/testbot/bearing_param.feature @@ -108,12 +108,12 @@ Feature: Bearing parameter | ha | yes | ring | When I route I should get - | from | to | bearings | route | bearing | - | 0 | q | 0 90 | ia,ring,ring,ring,ring,ring | 0->0,0->90,180->270,270->0,0->90,90->0 | - | 0 | a | 45 90 | jb,ring,ring,ring,ring,ring | 0->45,45->180,180->270,270->0,0->90,90->0 | - | 0 | q | 90 90 | kc,ring,ring,ring,ring | 0->90,90->180,270->0,0->90,90->0 | - | 0 | a | 135 90 | ld,ring,ring,ring,ring | 0->135,135->270,270->0,0->90,90->0 | - | 0 | a | 180 90 | me,ring,ring,ring,ring | 0->180,180->270,270->0,0->90,90->0 | - | 0 | a | 225 90 | nf,ring,ring,ring | 0->225,225->0,0->90,90->0 | - | 0 | a | 270 90 | og,ring,ring,ring | 0->270,270->0,0->90,90->0 | - | 0 | a | 315 90 | ph,ring,ring | 0->315,315->90,90->0 | + | from | to | bearings | route | bearing | + | 0 | q | 0 90 | ia,ring,ring,ring,ring,ring,ring | 0->0,0->90,90->180,180->270,270->0,0->90,90->0 | + | 0 | a | 45 90 | jb,ring,ring,ring,ring,ring | 0->45,45->180,180->270,270->0,0->90,90->0 | + | 0 | q | 90 90 | kc,ring,ring,ring,ring,ring | 0->90,90->180,180->270,270->0,0->90,90->0 | + | 0 | a | 135 90 | ld,ring,ring,ring,ring | 0->135,135->270,270->0,0->90,90->0 | + | 0 | a | 180 90 | me,ring,ring,ring | 0->180,180->270,0->90,90->0 | + | 0 | a | 225 90 | nf,ring,ring,ring | 0->225,225->0,0->90,90->0 | + | 0 | a | 270 90 | og,ring,ring | 0->270,270->0,90->0 | + | 0 | a | 315 90 | ph,ring,ring | 0->315,315->90,90->0 | diff --git a/features/testbot/compression.feature b/features/testbot/compression.feature index 033cc3335..da8c0cdef 100644 --- a/features/testbot/compression.feature +++ b/features/testbot/compression.feature @@ -20,5 +20,5 @@ Feature: Geometry Compression When I route I should get | from | to | route | distance | speed | - | b | e | abcdef,abcdef | 588.5m | 36 km/h | - | e | b | abcdef,abcdef | 588.5m | 36 km/h | + | b | e | abcdef,abcdef | 588.7m | 36 km/h | + | e | b | abcdef,abcdef | 588.7m | 36 km/h | diff --git a/features/testbot/distance.feature b/features/testbot/distance.feature index 1b76f45a6..50595b087 100644 --- a/features/testbot/distance.feature +++ b/features/testbot/distance.feature @@ -90,8 +90,8 @@ Feature: Distance calculation | b | a | abc,abc | 100m | | b | c | abc,abc | 100m | | c | b | abc,abc | 100m | - | a | c | abc,abc | 200m | - | c | a | abc,abc | 200m | + | a | c | abc,abc | 199.9m | + | c | a | abc,abc | 199.9m | Scenario: 1km distance Given a grid size of 1000 meters @@ -134,7 +134,7 @@ Feature: Distance calculation | a | c | abcdefgh,abcdefgh | 20m | | a | d | abcdefgh,abcdefgh | 30m | | a | e | abcdefgh,abcdefgh | 40m | - | a | f | abcdefgh,abcdefgh | 50m | + | a | f | abcdefgh,abcdefgh | 50.1m | | a | g | abcdefgh,abcdefgh | 60m +-1 | | a | h | abcdefgh,abcdefgh | 70m +-1 | @@ -154,9 +154,9 @@ Feature: Distance calculation | from | to | route | distance | | a | b | abcdefgh,abcdefgh | 10m | | a | c | abcdefgh,abcdefgh | 20m | - | a | d | abcdefgh,abcdefgh | 30m | - | a | e | abcdefgh,abcdefgh | 40m | - | a | f | abcdefgh,abcdefgh | 50m | + | a | d | abcdefgh,abcdefgh | 29.9m | + | a | e | abcdefgh,abcdefgh | 39.9m | + | a | f | abcdefgh,abcdefgh | 49.9m | | a | g | abcdefgh,abcdefgh | 60m +-1 | | a | h | abcdefgh,abcdefgh | 70m +-1 | diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 6ac1ce21b..c1340146f 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -22,10 +22,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | - | b | 100.1 | 0 | 99.4 | 199.5 | - | e | 199.5 | 99.4 | 0 | 100.1 | - | f | 299.5 | 199.5 | 100.1 | 0 | + | a | 0 | 100 | 199.9 | 300 | + | b | 100 | 0 | 100 | 200 | + | e | 199.9 | 100 | 0 | 100.1 | + | f | 300 | 200 | 100.1 | 0 | Scenario: Testbot - Travel distance matrix of minimal network exact distances Given the node map @@ -43,11 +43,11 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | z | b | c | d | - | a | 0 | 100.1 | 199.5 | 298.9 | 398.3 | - | z | 100.1 | 0 | 99.4 | 198.8 | 298.2 | - | b | 199.5 | 99.4 | 0 | 99.4 | 198.8 | - | c | 298.9 | 198.8 | 99.4 | 0 | 99.4 | - | d | 398.3 | 298.2 | 198.8 | 99.4 | 0 | + | a | 0 | 100 | 199.9 | 300 | 399.9 | + | z | 100 | 0 | 100 | 200 | 300 | + | b | 199.9 | 100 | 0 | 100.1 | 200 | + | c | 300 | 200 | 100.1 | 0 | 100 | + | d | 399.9 | 300 | 200 | 100 | 0 | Scenario: Testbot - Travel distance matrix of minimal network with toll exclude Given the query options @@ -68,10 +68,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 100.1 | | | - | b | 100.1 | 0 | | | - | c | | | 0 | 100.1 | - | d | | | 100.1 | 0 | + | a | 0 | 100 | | | + | b | 100 | 0 | | | + | c | | | 0 | 100 | + | d | | | 100 | 0 | Scenario: Testbot - Travel distance matrix of minimal network with motorway exclude Given the query options @@ -92,7 +92,7 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 298.9 | 99.4 | 199.5 | + | a | 0 | 299.9 | 100 | 199.9 | Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude Given the query options @@ -113,7 +113,7 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | e | - | a | 0 | 50.1 | | + | a | 0 | 50 | | Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes Given the query options @@ -134,7 +134,7 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | e | g | - | a | 0 | 100.1 | | | + | a | 0 | 100 | | | Scenario: Testbot - Travel distance matrix with different way speeds Given the node map @@ -150,21 +150,21 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 100.1 | 200.1 | 300.2 | - | b | 100.1 | 0 | 100.1 | 200.1 | - | c | 200.1 | 100.1 | 0 | 100.1 | - | d | 300.2 | 200.1 | 100.1 | 0 | + | a | 0 | 100 | 200 | 300 | + | b | 100 | 0 | 100.1 | 200 | + | c | 200 | 100.1 | 0 | 100 | + | d | 300 | 200 | 100 | 0 | When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 100.1 | 200.1 | 300.2 | + | a | 0 | 100 | 200 | 300 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 100.1 | - | c | 200.1 | - | d | 300.2 | + | b | 100 | + | c | 200 | + | d | 300 | Scenario: Testbot - Travel distance matrix of small grid Given the node map @@ -183,10 +183,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | - | b | 100.1 | 0 | 99.4 | 199.5 | - | e | 199.5 | 99.4 | 0 | 100.1 | - | f | 299.5 | 199.5 | 100.1 | 0 | + | a | 0 | 100 | 199.9 | 300 | + | b | 100 | 0 | 100 | 200 | + | e | 199.9 | 100 | 0 | 100.1 | + | f | 300 | 200 | 100.1 | 0 | Scenario: Testbot - Travel distance matrix of network with unroutable parts Given the node map @@ -200,7 +200,7 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | - | a | 0 | 100.1 | + | a | 0 | 100 | | b | | 0 | Scenario: Testbot - Travel distance matrix of network with oneways @@ -218,10 +218,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | x | y | d | e | - | x | 0 | 300.2 | 399.6 | 299.5 | - | y | 499 | 0 | 299.5 | 199.5 | - | d | 199.5 | 299.5 | 0 | 298.9 | - | e | 299.5 | 399.6 | 100.1 | 0 | + | x | 0 | 300 | 400 | 300 | + | y | 499.9 | 0 | 300 | 199.9 | + | d | 199.9 | 300 | 0 | 300 | + | e | 300 | 400 | 100.1 | 0 | Scenario: Testbot - Rectangular travel distance matrix Given the node map @@ -240,53 +240,53 @@ Feature: Basic Distance Matrix When I route I should get | from | to | distance | - | e | a | 200m | + | e | a | 199.9m | | e | b | 100m | - | f | a | 299.9m | + | f | a | 300m | | f | b | 200m | When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | + | a | 0 | 100 | 199.9 | 300 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 100.1 | - | e | 199.5 | - | f | 299.5 | + | b | 100 | + | e | 199.9 | + | f | 300 | When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | - | b | 100.1 | 0 | 99.4 | 199.5 | + | a | 0 | 100 | 199.9 | 300 | + | b | 100 | 0 | 100 | 200 | When I request a travel distance matrix I should get | | a | b | - | a | 0 | 100.1 | - | b | 100.1 | 0 | - | e | 199.5 | 99.4 | - | f | 299.5 | 199.5 | + | a | 0 | 100 | + | b | 100 | 0 | + | e | 199.9 | 100 | + | f | 300 | 200 | When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | - | b | 100.1 | 0 | 99.4 | 199.5 | - | e | 199.5 | 99.4 | 0 | 100.1 | + | a | 0 | 100 | 199.9 | 300 | + | b | 100 | 0 | 100 | 200 | + | e | 199.9 | 100 | 0 | 100.1 | When I request a travel distance matrix I should get | | a | b | e | - | a | 0 | 100.1 | 199.5 | - | b | 100.1 | 0 | 99.4 | - | e | 199.5 | 99.4 | 0 | - | f | 299.5 | 199.5 | 100.1 | + | a | 0 | 100 | 199.9 | + | b | 100 | 0 | 100 | + | e | 199.9 | 100 | 0 | + | f | 300 | 200 | 100.1 | When I request a travel distance matrix I should get | | a | b | e | f | - | a | 0 | 100.1 | 199.5 | 299.5 | - | b | 100.1 | 0 | 99.4 | 199.5 | - | e | 199.5 | 99.4 | 0 | 100.1 | - | f | 299.5 | 199.5 | 100.1 | 0 | + | a | 0 | 100 | 199.9 | 300 | + | b | 100 | 0 | 100 | 200 | + | e | 199.9 | 100 | 0 | 100.1 | + | f | 300 | 200 | 100.1 | 0 | Scenario: Testbot - Travel distance 3x2 matrix Given the node map @@ -306,8 +306,8 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | b | e | f | - | a | 100.1 | 199.5 | 299.5 | - | b | 0 | 99.4 | 199.5 | + | a | 100 | 199.9 | 300 | + | b | 0 | 100 | 200 | Scenario: Testbot - All coordinates are from same small component Given a grid size of 300 meters @@ -328,8 +328,8 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | f | g | - | f | 0 | 298.2 | - | g | 298.2 | 0 | + | f | 0 | 300 | + | g | 300 | 0 | Scenario: Testbot - Coordinates are from different small component and snap to big CC Given a grid size of 300 meters @@ -362,10 +362,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | f | g | h | i | - | f | 0 | 298.2 | 0 | 298.2 | - | g | 298.2 | 0 | 298.2 | 0 | - | h | 0 | 298.2 | 0 | 298.2 | - | i | 298.2 | 0 | 298.2 | 0 | + | f | 0 | 300 | 0 | 300 | + | g | 300 | 0 | 300 | 0 | + | h | 0 | 300 | 0 | 300 | + | i | 300 | 0 | 300 | 0 | Scenario: Testbot - Travel distance matrix with loops Given the node map @@ -383,10 +383,10 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | 1 | 2 | 3 | 4 | - | 1 | 0 | 100.1 | 399.6 | 499.7 | - | 2 | 699.1 | 0 | 299.5 | 399.6 | - | 3 | 399.6 | 499.7 | 0 | 100.1 | - | 4 | 299.5 | 399.6 | 699.1 | 0 | + | 1 | 0 | 100.1 | 399.9 | 500 | + | 2 | 699.8 | 0 | 299.9 | 399.9 | + | 3 | 399.9 | 500 | 0 | 100.1 | + | 4 | 299.9 | 399.9 | 699.8 | 0 | Scenario: Testbot - Travel distance matrix based on segment durations @@ -424,11 +424,11 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | e | - | a | 0 | 100.1 | 200.1 | 300.2 | 398.9 | - | b | 100.1 | 0 | 100.1 | 200.1 | 298.9 | - | c | 200.1 | 100.1 | 0 | 100.1 | 198.8 | - | d | 300.2 | 200.1 | 100.1 | 0 | 298.9 | - | e | 398.9 | 298.9 | 198.8 | 298.9 | 0 | + | a | 0 | 100 | 200 | 300 | 400 | + | b | 100 | 0 | 100.1 | 200 | 300.1 | + | c | 200 | 100.1 | 0 | 100 | 200 | + | d | 300 | 200 | 100 | 0 | 300 | + | e | 400 | 300.1 | 200 | 300 | 0 | Scenario: Testbot - Travel distance matrix for alternative loop paths Given the profile file @@ -468,25 +468,25 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | - | 1 | 0 | 1096.7 | 298.9 | 199.5 | 598.4 | 498.3 | 897.3 | 797.9 | - | 2 | 100.1 | 0 | 398.9 | 299.5 | 698.5 | 598.4 | 997.3 | 897.9 | - | 3 | 897.9 | 797.9 | 0 | 1097.4 | 299.5 | 199.5 | 598.4 | 499 | - | 4 | 997.3 | 897.3 | 99.4 | 0 | 398.9 | 298.9 | 697.8 | 598.4 | - | 5 | 598.4 | 498.3 | 897.3 | 797.9 | 0 | 1096.7 | 298.9 | 199.5 | - | 6 | 698.5 | 598.4 | 997.3 | 897.9 | 100.1 | 0 | 398.9 | 299.5 | - | 7 | 299.5 | 199.5 | 598.4 | 499 | 897.9 | 797.9 | 0 | 1097.4 | - | 8 | 398.9 | 298.9 | 697.8 | 598.4 | 997.3 | 897.3 | 99.4 | 0 | + | 1 | 0 | 1099.8 | 300 | 199.9 | 600 | 499.9 | 899.9 | 799.9 | + | 2 | 100.1 | 0 | 400 | 300 | 700 | 600 | 1000 | 899.9 | + | 3 | 899.9 | 799.9 | 0 | 1099.8 | 300 | 199.9 | 600 | 499.9 | + | 4 | 1000 | 899.9 | 100.1 | 0 | 400 | 300 | 700 | 600 | + | 5 | 600 | 499.9 | 899.9 | 799.9 | 0 | 1099.8 | 300 | 199.9 | + | 6 | 700 | 600 | 1000 | 899.9 | 100.1 | 0 | 400 | 300 | + | 7 | 300 | 199.9 | 600 | 499.9 | 899.9 | 799.9 | 0 | 1099.8 | + | 8 | 400 | 300 | 700 | 600 | 1000 | 899.9 | 100.1 | 0 | When I request a travel distance matrix I should get | | 1 | | 1 | 0 | | 2 | 100.1 | - | 3 | 897.9 | - | 4 | 997.3 | - | 5 | 598.4 | - | 6 | 698.5 | - | 7 | 299.5 | - | 8 | 398.9 | + | 3 | 899.9 | + | 4 | 1000 | + | 5 | 600 | + | 6 | 700 | + | 7 | 300 | + | 8 | 400 | Scenario: Testbot - Travel distance matrix with ties Given the node map @@ -511,23 +511,23 @@ Feature: Basic Distance Matrix | from | to | route | distance | | a | b | ab,ab | 450m | | a | c | ac,ac | 200m | - | a | d | ac,dc,dc | 499.9m | + | a | d | ac,dc,dc | 500m | When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 450.3 | 198.8 | 499 | + | a | 0 | 450 | 200 | 500 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 450.3 | - | c | 198.8 | - | d | 499 | + | b | 450 | + | c | 200 | + | d | 500 | When I request a travel distance matrix I should get | | a | c | - | a | 0 | 198.8 | - | c | 198.8 | 0 | + | a | 0 | 200 | + | c | 200 | 0 | # Check rounding errors @@ -544,7 +544,7 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | - | a | 0 | 1000.7 | 2001.4 | 3002.1 | + | a | 0 | 1000.1 | 2000 | 3000.1 | Scenario: Testbot - OneToMany vs ManyToOne @@ -562,12 +562,12 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | - | b | 240.4 | 0 | + | b | 241.3 | 0 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 240.4 | + | b | 241.3 | Scenario: Testbot - Varying distances between nodes Given the node map @@ -589,12 +589,13 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | c | d | e | f | - | a | 0 | 100.1 | 300.2 | 650.5 | 1930.6 | 1533 | - | b | 759 | 0 | 200.1 | 550.4 | 1830.5 | 1432.9 | - | c | 558.8 | 658.9 | 0 | 350.3 | 1630.4 | 1232.8 | - | d | 1478.9 | 1579 | 1779.1 | 0 | 1280.1 | 882.5 | - | e | 198.8 | 298.9 | 499 | 710.3 | 0 | 1592.8 | - | f | 596.4 | 696.5 | 896.6 | 1107.9 | 397.6 | 0 | + | a | 0 | 100 | 300 | 650 | 1934.5 | 1534.6 | + | b | 760.6 | 0 | 200 | 550.1 | 1834.6 | 1434.6 | + | c | 560.6 | 660.5 | 0 | 350 | 1634.6 | 1234.6 | + | d | 1484.6 | 1584.5| 1784.5 | 0 | 1284.5 | 884.6 | + | e | 200 | 300 | 500 | 710.6 | 0 | 1595.2 | + | f | 600 | 699.9 | 899.9 | 1110.5 | 399.9 | 0 | + Scenario: Testbot - Filling in noroutes with estimates (defaults to input coordinate location) Given a grid size of 300 meters @@ -614,21 +615,21 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1501.1 | - | b | 300.2 | 0 | 600.5 | 1200.9 | - | f | 900.7 | 600.5 | 0 | 300.2 | - | 1 | 1501.1 | 1200.9 | 300.2 | 0 | + | a | 0 | 300 | 900 | 1500 | + | b | 300 | 0 | 600 | 1200.1 | + | f | 900 | 600 | 0 | 300 | + | 1 | 1500 | 1200.1 | 300 | 0 | When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1501.1 | + | a | 0 | 300 | 900 | 1500 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 300.2 | - | f | 900.7 | - | 1 | 1501.1 | + | b | 300 | + | f | 900 | + | 1 | 1500 | Scenario: Testbot - Fise input coordinate Given a grid size of 300 meters @@ -649,21 +650,21 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1501.1 | - | b | 300.2 | 0 | 600.5 | 1200.9 | - | f | 900.7 | 600.5 | 0 | 300.2 | - | 1 | 1501.1 | 1200.9 | 300.2 | 0 | + | a | 0 | 300 | 900 | 1500 | + | b | 300 | 0 | 600 | 1200.1 | + | f | 900 | 600 | 0 | 300 | + | 1 | 1500 | 1200.1 | 300 | 0 | When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1501.1 | + | a | 0 | 300 | 900 | 1500 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 300.2 | - | f | 900.7 | - | 1 | 1501.1 | + | b | 300 | + | f | 900 | + | 1 | 1500 | Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate @@ -685,28 +686,28 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1200.9 | - | b | 300.2 | 0 | 600.5 | 900.7 | - | f | 900.7 | 600.5 | 0 | 300.2 | - | 1 | 1200.9 | 900.7 | 300.2 | 0 | + | a | 0 | 300 | 900 | 1200 | + | b | 300 | 0 | 600 | 900 | + | f | 900 | 600 | 0 | 300 | + | 1 | 1200 | 900 | 300 | 0 | When I request a travel distance matrix I should get | | a | b | f | 1 | - | a | 0 | 300.2 | 900.7 | 1200.9 | + | a | 0 | 300 | 900 | 1200 | When I request a travel distance matrix I should get | | a | | a | 0 | - | b | 300.2 | - | f | 900.7 | - | 1 | 1200.9 | + | b | 300 | + | f | 900 | + | 1 | 1200 | Scenario: Ensure consistency with route, and make sure offsets work in both directions Given a grid size of 100 meters Given the node map """ a b c d e f g h i j - 1 2 + 1 2 3 """ And the ways @@ -715,11 +716,14 @@ Feature: Basic Distance Matrix | fghij | When I route I should get - | from | to | route | distance | - | 1 | 2 | abcdef,fghij,fghij | 999.9m | + | from | to | route | distance | + | 1 | 2 | abcdef,fghij,fghij | 1000.1m | + | 1 | 3 | abcdef,fghij,fghij | 1400.1m | + | 2 | 3 | fghij,fghij | 400m | + - # TODO: this is "correct", but inconsistent with viaroute When I request a travel distance matrix I should get - | | 1 | 2 | - | 1 | 0 | 1000.7 | - | 2 | 1000.7 | 0 | \ No newline at end of file + | | 1 | 2 | 3 | + | 1 | 0 | 1000.1 | 1400.1 | + | 2 | 1000.1 | 0 | 400 | + | 3 | 1400.1 | 400 | 0 | \ No newline at end of file diff --git a/features/testbot/duration_matrix.feature b/features/testbot/duration_matrix.feature index 94e0a6414..28ffaaed3 100644 --- a/features/testbot/duration_matrix.feature +++ b/features/testbot/duration_matrix.feature @@ -446,15 +446,15 @@ Feature: Basic Duration Matrix | ca | yes | When I request a travel time matrix I should get - | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | - | 1 | 0 | 11 | 3 | 2 | 6 | 5 | 8.9 | 7.9 | - | 2 | 1 | 0 | 4 | 3 | 7 | 6 | 9.9 | 8.9 | - | 3 | 9 | 8 | 0 | 11 | 3 | 2 | 5.9 | 4.9 | - | 4 | 10 | 9 | 1 | 0 | 4 | 3 | 6.9 | 5.9 | - | 5 | 6 | 5 | 9 | 8 | 0 | 11 | 2.9 | 1.9 | - | 6 | 7 | 6 | 10 | 9 | 1 | 0 | 3.9 | 2.9 | - | 7 | 3.1 | 2.1 | 6.1 | 5.1 | 9.1 | 8.1 | 0 | 11 | - | 8 | 4.1 | 3.1 | 7.1 | 6.1 | 10.1 | 9.1 | 1 | 0 | + | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | + | 1 | 0 | 10.9 | 3 | 1.9 | 6 | 4.9 | 9 | 7.9 | + | 2 | 1.1 | 0 | 4.1 | 3 | 7.1 | 6 | 10.1 | 9 | + | 3 | 9 | 7.9 | 0 | 10.9 | 3 | 1.9 | 6 | 4.9 | + | 4 | 10.1 | 9 | 1.1 | 0 | 4.1 | 3 | 7.1 | 6 | + | 5 | 6 | 4.9 | 9 | 7.9 | 0 | 10.9 | 3 | 1.9 | + | 6 | 7.1 | 6 | 10.1 | 9 | 1.1 | 0 | 4.1 | 3 | + | 7 | 3 | 1.9 | 6 | 4.9 | 9 | 7.9 | 0 | 10.9 | + | 8 | 4.1 | 3 | 7.1 | 6 | 10.1 | 9 | 1.1 | 0 | Scenario: Testbot - Travel time matrix with ties @@ -543,22 +543,22 @@ Feature: Basic Duration Matrix | fhigf | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 30 | - | b | 30 | 0 | 12 | 24 | - | f | 18 | 12 | 0 | 30 | - | 1 | 30 | 24 | 30 | 0 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 30 | + | b | 30 | 0 | 12 | 24 | + | f | 17.9 | 12 | 0 | 30 | + | 1 | 30 | 24 | 30 | 0 | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 30 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 30 | When I request a travel time matrix I should get - | | a | - | a | 0 | - | b | 30 | - | f | 18 | - | 1 | 30 | + | | a | + | a | 0 | + | b | 30 | + | f | 17.9 | + | 1 | 30 | When I request a travel time matrix I should get estimates for | | a | b | f | 1 | @@ -596,22 +596,22 @@ Feature: Basic Duration Matrix | fhigf | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 30 | - | b | 30 | 0 | 12 | 24 | - | f | 18 | 12 | 0 | 30 | - | 1 | 30 | 24 | 30 | 0 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 30 | + | b | 30 | 0 | 12 | 24 | + | f | 17.9 | 12 | 0 | 30 | + | 1 | 30 | 24 | 30 | 0 | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 30 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 30 | When I request a travel time matrix I should get - | | a | - | a | 0 | - | b | 30 | - | f | 18 | - | 1 | 30 | + | | a | + | a | 0 | + | b | 30 | + | f | 17.9 | + | 1 | 30 | When I request a travel time matrix I should get estimates for | | a | b | f | 1 | @@ -650,22 +650,22 @@ Feature: Basic Duration Matrix | fhigf | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 24 | - | b | 30 | 0 | 12 | 18 | - | f | 18 | 12 | 0 | 30 | - | 1 | 24 | 18 | 30 | 0 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 23.9 | + | b | 30 | 0 | 12 | 17.9 | + | f | 17.9 | 12 | 0 | 30 | + | 1 | 23.9 | 17.9 | 30 | 0 | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 30 | 18 | 24 | + | | a | b | f | 1 | + | a | 0 | 30 | 17.9 | 23.9 | When I request a travel time matrix I should get - | | a | - | a | 0 | - | b | 30 | - | f | 18 | - | 1 | 24 | + | | a | + | a | 0 | + | b | 30 | + | f | 17.9 | + | 1 | 23.9 | When I request a travel time matrix I should get estimates for | | a | b | f | 1 | @@ -719,22 +719,22 @@ Feature: Basic Duration Matrix | fhigf | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 60 | 36 | 48 | - | b | 60 | 0 | 24 | 36 | - | f | 36 | 24 | 0 | 60 | - | 1 | 48 | 36 | 60 | 0 | + | | a | b | f | 1 | + | a | 0 | 60 | 35.8 | 47.8 | + | b | 60 | 0 | 24 | 35.8 | + | f | 35.8 | 24 | 0 | 60 | + | 1 | 47.8 | 35.8 | 60 | 0 | When I request a travel time matrix I should get - | | a | b | f | 1 | - | a | 0 | 60 | 36 | 48 | + | | a | b | f | 1 | + | a | 0 | 60 | 35.8 | 47.8 | When I request a travel time matrix I should get - | | a | - | a | 0 | - | b | 60 | - | f | 36 | - | 1 | 48 | + | | a | + | a | 0 | + | b | 60 | + | f | 35.8 | + | 1 | 47.8 | When I request a travel time matrix I should get estimates for | | a | b | f | 1 | diff --git a/features/testbot/matching.feature b/features/testbot/matching.feature index 599afcb1d..f8e1b2738 100644 --- a/features/testbot/matching.feature +++ b/features/testbot/matching.feature @@ -279,8 +279,8 @@ Feature: Basic Map Matching | fb | yes | When I match I should get - | trace | matchings | geometry | - | efbc | efbc | 1,0.99964,1.00036,0.99964,1.00036,1,1.000719,1 | + | trace | matchings | geometry | + | efbc | efbc | 1,0.999638,1.000359,0.999638,1.000359,1,1.000719,1 | Scenario: Testbot - Geometry details using geojson Given the query options @@ -356,7 +356,7 @@ Feature: Basic Map Matching When I match I should get | trace | matchings | alternatives | - | abcdef | abcde | 0,0,0,0,1,1 | + | abcdef | abcde | 0,0,0,1,1,1 | Scenario: Testbot - Speed greater than speed threshold Given a grid size of 100 meters @@ -652,7 +652,7 @@ Feature: Basic Map Matching When I match I should get | trace | geometry | code | - | defgh | 1,1,1,0.999461,1.000674,0.999461 | Ok | + | defgh | 1,1,1,0.999457,1.000674,0.999457 | Ok | @match @testbot Scenario: Regression test - waypoints trimming too much geometry @@ -682,8 +682,8 @@ Feature: Basic Map Matching | waypoints | 0;3 | | overview | full | When I match I should get - | trace | geometry | code | - | bgkj | 1.000135,1,1.000135,0.99964,1.000387,0.999137 | Ok | + | trace | geometry | code | + | bgkj | 1.000135,1,1.000135,0.999638,1.000386,0.999132 | Ok | @match @testbot @@ -712,12 +712,12 @@ Feature: Basic Map Matching | overview | full | | steps | true | When I match I should get - | trace | geometry | turns | code | - | abc | 1,0.99973,1.00027,0.99973,1.000539,0.99973 | depart,arrive | Ok | - | abd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok | - | abe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok | - | ahd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok | - | ahe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok | + | trace | geometry | turns | code | + | abc | 1,0.999729,1.000269,0.999729,1.000539,0.999729 | depart,arrive | Ok | + | abd | 1,0.999729,1.000269,0.999729,1.000269,0.999457 | depart,turn right,arrive | Ok | + | abe | 1,0.999729,1.000269,0.999729,1.000269,1 | depart,turn left,arrive | Ok | + | ahd | 1,0.999729,1.000269,0.999729,1.000269,0.999457 | depart,turn right,arrive | Ok | + | ahe | 1,0.999729,1.000269,0.999729,1.000269,1 | depart,turn left,arrive | Ok | @match @testbot Scenario: Regression test - add source phantoms properly (one phantom on one edge) @@ -740,9 +740,9 @@ Feature: Basic Map Matching | annotations | duration,weight | | generate_hints | false | When I match I should get - | trace | geometry | a:duration | a:weight | duration | - | 123 | 1.000135,1,1.000225,1,1.00036,1,1.000405,1,1.00045,1 | 1:1.5:0.5:0.5 | 1:1.5:0.5:0.5 | 3.5 | - | 321 | 1.00045,1,1.000405,1,1.00036,1,1.000225,1,1.000135,1 | 0.5:0.5:1.5:1 | 0.5:0.5:1.5:1 | 3.5 | + | trace | geometry | a:duration | a:weight | duration | + | 123 | 1.000135,1,1.000225,1,1.000359,1,1.000404,1,1.000449,1 | 1:1.5:0.5:0.4 | 1:1.5:0.5:0.4 | 3.4 | + | 321 | 1.000449,1,1.000404,1,1.000359,1,1.000225,1,1.000135,1 | 0.4:0.5:1.5:1 | 0.4:0.5:1.5:1 | 3.4 | @match @testbot Scenario: Regression test - add source phantom properly (two phantoms on one edge) @@ -765,9 +765,9 @@ Feature: Basic Map Matching | annotations | duration,weight | | generate_hints | false | When I match I should get - | trace | geometry | a:duration | a:weight | duration | - | 1234 | 1.000135,1,1.000225,1,1.000405,1,1.00045,1 | 1:2:0.5 | 1:2:0.5 | 3.5 | - | 4321 | 1.00045,1,1.000405,1,1.000225,1,1.000135,1 | 0.5:2:1 | 0.5:2:1 | 3.5 | + | trace | geometry | a:duration | a:weight | duration | + | 1234 | 1.000135,1,1.000225,1,1.000404,1,1.000449,1 | 1:2:0.4 | 1:2:0.4 | 3.4 | + | 4321 | 1.000449,1,1.000404,1,1.000225,1,1.000135,1 | 0.4:2:1 | 0.4:2:1 | 3.4 | @match @testbot Scenario: Regression test - add source phantom properly (two phantoms on one edge) @@ -791,5 +791,5 @@ Feature: Basic Map Matching # These should have the same weights/duration in either direction When I match I should get | trace | geometry | a:distance | a:duration | a:weight | duration | - | 2345 | 1.00018,1,1.000315,1 | 15.013264 | 1.5 | 1.5 | 1.5 | - | 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 | \ No newline at end of file + | 2345 | 1.00018,1,1.000314,1 | 14.914666 | 1.4 | 1.4 | 1.4 | + | 4321 | 1.00027,1,1.000135,1 | 15.02597 | 1.5 | 1.5 | 1.5 | \ No newline at end of file diff --git a/features/testbot/multi_level_routing.feature b/features/testbot/multi_level_routing.feature index 467ddd26f..5ffabec5e 100644 --- a/features/testbot/multi_level_routing.feature +++ b/features/testbot/multi_level_routing.feature @@ -110,33 +110,34 @@ Feature: Multi level routing When I request a travel distance matrix I should get | | a | f | l | o | - | a | 0 | 2383.7 | 1566.9 | 1366.8 | - | f | 2383.7 | 0 | 1293.3 | 1617.3 | - | l | 1566.9 | 1293.3 | 0 | 800.5 | - | o | 1366.8 | 1617.3 | 800.5 | 0 | + | a | 0 | 2391.6 | 1570.8 | 1370.9 | + | f | 2391.6 | 0 | 1297.2 | 1620.9 | + | l | 1570.8 | 1297.2 | 0 | 800 | + | o | 1370.9 | 1620.9 | 800 | 0 | + When I request a travel distance matrix I should get | | a | f | l | o | - | a | 0 | 2383.7 | 1566.9 | 1366.8 | + | a | 0 | 2391.6 | 1570.8 | 1370.9 | When I request a travel distance matrix I should get | | a | | a | 0 | - | f | 2383.7 | - | l | 1566.9 | - | o | 1366.8 | + | f | 2391.6 | + | l | 1570.8 | + | o | 1370.9 | When I request a travel distance matrix I should get | | a | f | l | o | - | a | 0 | 2383.7 | 1566.9 | 1366.8 | - | f | 2383.7 | 0 | 1293.3 | 1617.3 | + | a | 0 | 2391.6 | 1570.8 | 1370.9 | + | f | 2391.6 | 0 | 1297.2 | 1620.9 | When I request a travel distance matrix I should get | | a | o | - | a | 0 | 1366.8 | - | f | 2383.7 | 1617.3 | - | l | 1566.9 | 800.5 | - | o | 1366.8 | 0 | + | a | 0 | 1370.9 | + | f | 2391.6 | 1620.9 | + | l | 1570.8 | 800 | + | o | 1370.9 | 0 | Scenario: Testbot - Multi level routing: horizontal road Given the node map diff --git a/features/testbot/nil.feature b/features/testbot/nil.feature index af8a0b988..521720af7 100644 --- a/features/testbot/nil.feature +++ b/features/testbot/nil.feature @@ -1,18 +1,18 @@ @routing @testbot @nil -Feature: Testbot - Check assigning nil values - Scenario: Assign nil values to all way strings +Feature: Testbot - Check assigning empty values + Scenario: Assign empty values to all way strings Given the profile file """ functions = require('testbot') function way_function(profile, way, result) - result.name = nil - result.ref = nil - result.destinations = nil - result.exits = nil - result.pronunciation = nil - result.turn_lanes_forward = nil - result.turn_lanes_backward = nil + result.name = "" + result.ref = "" + result.destinations = "" + result.exits = "" + result.pronunciation = "" + result.turn_lanes_forward = "" + result.turn_lanes_backward = "" result.forward_speed = 10 result.backward_speed = 10 diff --git a/features/testbot/origin.feature b/features/testbot/origin.feature index c21febd07..fd14c86f7 100644 --- a/features/testbot/origin.feature +++ b/features/testbot/origin.feature @@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin When I route I should get | from | to | route | distance | - | b | d | abcde,abcde | 200m | + | b | d | abcde,abcde | 198.8m | | d | b | | | Scenario: North-south oneways crossing the origin @@ -71,5 +71,5 @@ Feature: Routing close to the [0,0] origin When I route I should get | from | to | route | distance | - | b | d | abcde,abcde | 200m | + | b | d | abcde,abcde | 200.2m | | d | b | | | diff --git a/features/testbot/planetary.feature b/features/testbot/planetary.feature index 1fff4bded..c70cedb3d 100644 --- a/features/testbot/planetary.feature +++ b/features/testbot/planetary.feature @@ -26,8 +26,8 @@ Feature: Distance calculation | cd | When I route I should get - | from | to | route | distance | - | c | d | cd,cd | 6028844m ~4.5% | + | from | to | route | distance | + | c | d | cd,cd | 6310675.7m ~4.5% | Scenario: Approximated Longitudinal distances at latitude 80 Given the node locations @@ -54,8 +54,8 @@ Feature: Distance calculation | ab | When I route I should get - | from | to | route | distance | - | a | b | ab,ab | 8905559m ~0.1% | + | from | to | route | distance | + | a | b | ab,ab | 8882574.6m ~0.1% | Scenario: Approximated Latitudinal distances at longitude 45 Given the node locations @@ -68,8 +68,8 @@ Feature: Distance calculation | ab | When I route I should get - | from | to | route | distance | - | a | b | ab,ab | 8905559m ~0.1% | + | from | to | route | distance | + | a | b | ab,ab | 8882574.6m ~0.1% | Scenario: Approximated Latitudinal distances at longitude 80 Given the node locations @@ -83,4 +83,4 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | ab,ab | 8905559m ~0.1% | + | a | b | ab,ab | 8882574.6m ~0.1% | diff --git a/features/testbot/projection.feature b/features/testbot/projection.feature index 49a5d8df1..c5bd6be18 100644 --- a/features/testbot/projection.feature +++ b/features/testbot/projection.feature @@ -23,13 +23,13 @@ Feature: Projection to nearest point on road Scenario: Projection onto way at high latitudes, 1km distance When I route I should get - | from | to | route | bearing | distance | - | b | a | abc,abc | 0->225,225->0 | 1000m | - | b | c | abc,abc | 0->45,45->0 | 1000m +- 3 | - | a | d | abc,abc | 0->45,45->0 | 1000m | - | d | a | abc,abc | 0->225,225->0 | 1000m | - | c | d | abc,abc | 0->225,225->0 | 1000m +- 3 | - | d | c | abc,abc | 0->45,45->0 | 1000m +- 3 | + | from | to | route | bearing | distance | + | b | a | abc,abc | 0->225,225->0 | 1002.9m | + | b | c | abc,abc | 0->45,45->0 | 1005m +- 3 | + | a | d | abc,abc | 0->45,45->0 | 1002.9m | + | d | a | abc,abc | 0->225,225->0 | 1002.9m | + | c | d | abc,abc | 0->225,225->0 | 1005m +- 3 | + | d | c | abc,abc | 0->45,45->0 | 1005m +- 3 | Scenario: Projection onto way at high latitudes, no distance When I route I should get diff --git a/features/testbot/traffic_speeds.feature b/features/testbot/traffic_speeds.feature index f5f2198f3..db3b2372b 100644 --- a/features/testbot/traffic_speeds.feature +++ b/features/testbot/traffic_speeds.feature @@ -48,13 +48,13 @@ Feature: Traffic - speeds When I route I should get | from | to | route | speed | weights | a:datasources | - | a | b | ad,de,eb,eb | 30 km/h | 1275.7,400.4,378.2,0 | 1:0:0 | - | a | c | ad,dc,dc | 31 km/h | 1275.7,956.8,0 | 1:0 | - | b | c | bc,bc | 27 km/h | 741.5,0 | 1 | - | a | d | ad,ad | 27 km/h | 1275.7,0 | 1 | - | d | c | dc,dc | 36 km/h | 956.8,0 | 0 | - | g | b | fb,fb | 36 km/h | 164.7,0 | 0 | - | a | g | ad,df,fb,fb | 30 km/h | 1295.7,487.5,304.7,0 | 1:0:0 | + | a | b | ad,de,eb,eb | 30 km/h | 1273.9,400.8,378.5,0 | 1:0:0 | + | a | c | ad,dc,dc | 31 km/h | 1273.9,955.4,0 | 1:0 | + | b | c | bc,bc | 27 km/h | 737.2,0 | 1 | + | a | d | ad,ad | 27 km/h | 1273.9,0 | 1 | + | d | c | dc,dc | 36 km/h | 955.4,0 | 0 | + | g | b | fb,fb | 36 km/h | 164.4,0 | 0 | + | a | g | ad,df,fb,fb | 30 km/h | 1293.9,486.8,304.3,0 | 1:0:0 | Scenario: Weighting based on speed file weights, ETA based on file durations @@ -74,13 +74,13 @@ Feature: Traffic - speeds When I route I should get | from | to | route | speed | weights | a:datasources | - | a | b | ad,de,eb,eb | 30 km/h | 1275.7,400.4,378.2,0 | 1:0:0 | - | a | c | ad,dc,dc | 31 km/h | 1275.7,956.8,0 | 1:0 | - | b | c | bc,bc | 27 km/h | 741.5,0 | 1 | - | a | d | ad,ad | 27 km/h | 1275.7,0 | 1 | - | d | c | dc,dc | 36 km/h | 956.8,0 | 0 | - | g | b | ab,ab | 1 km/h | 10010.4,0 | 1 | - | a | g | ab,ab | 1 km/h | 10010.3,0 | 1 | + | a | b | ad,de,eb,eb | 30 km/h | 1273.9,400.8,378.5,0 | 1:0:0 | + | a | c | ad,dc,dc | 31 km/h | 1273.9,955.4,0 | 1:0 | + | b | c | bc,bc | 27 km/h | 737.2,0 | 1 | + | a | d | ad,ad | 27 km/h | 1273.9,0 | 1 | + | d | c | dc,dc | 36 km/h | 955.4,0 | 0 | + | g | b | ab,ab | 1 km/h | 9951.7,0 | 1 | + | a | g | ab,ab | 1 km/h | 9951.7,0 | 1 | Scenario: Weighting based on speed file weights, ETA based on file durations @@ -106,14 +106,14 @@ Feature: Traffic - speeds When I route I should get | from | to | route | speed | weights | a:datasources | - | a | b | ab,ab | 1 km/h | 20020.73,0 | 1 | - | a | c | ab,bc,bc | 2 km/h | 20020.73,741.51,0 | 1:1 | - | b | c | bc,bc | 27 km/h | 741.51,0 | 1 | - | a | d | ab,eb,de,de | 2 km/h | 20020.73,378.17,400.41,0 | 1:0:0 | - | d | c | dc,dc | 36 km/h | 956.8,0 | 0 | - | g | b | ab,ab | 1 km/h | 10010.37,0 | 1 | - | a | g | ab,ab | 1 km/h | 10010.36,0 | 1 | - | g | a | ab,ab | 1 km/h | 10010.36,0 | 1 | + | a | b | ab,ab | 1 km/h | 19903.37,0 | 1 | + | a | c | ab,bc,bc | 2 km/h | 19903.37,737.16,0 | 1:1 | + | b | c | bc,bc | 27 km/h | 737.16,0 | 1 | + | a | d | ab,eb,de,de | 2 km/h | 19903.37,378.49,400.75,0 | 1:0:0 | + | d | c | dc,dc | 36 km/h | 955.45,0 | 0 | + | g | b | ab,ab | 1 km/h | 9951.69,0 | 1 | + | a | g | ab,ab | 1 km/h | 9951.68,0 | 1 | + | g | a | ab,ab | 1 km/h | 9951.68,0 | 1 | Scenario: Speeds that isolate a single node (a) @@ -136,13 +136,13 @@ Feature: Traffic - speeds When I route I should get | from | to | route | speed | weights | a:datasources | a:speed | a:nodes| - | a | b | fb,fb | 36 km/h | 329.4,0 | 0 | 10 | 6:2 | - | a | c | fb,bc,bc | 30 km/h | 329.4,741.5,0 | 0:1 | 10:7.5 | 6:2:3 | - | b | c | bc,bc | 27 km/h | 741.5,0 | 1 | 7.5 | 2:3 | - | a | d | fb,df,df | 36 km/h | 140,487.5,0 | 0:0 | 10:10 | 2:6:4 | - | d | c | dc,dc | 36 km/h | 956.8,0 | 0 | 10 | 4:3 | - | g | b | fb,fb | 36 km/h | 164.7,0 | 0 | 10 | 6:2 | - | a | g | fb,fb | 36 km/h | 164.7,0 | 0 | 10 | 6:2 | + | a | b | fb,fb | 36 km/h | 328.9,0 | 0 | 10 | 6:2 | + | a | c | fb,bc,bc | 30 km/h | 328.9,737.2,0 | 0:1 | 10:7.5 | 6:2:3 | + | b | c | bc,bc | 27 km/h | 737.2,0 | 1 | 7.5 | 2:3 | + | a | d | fb,df,df | 36 km/h | 139.8,486.8,0 | 0:0 | 10:10 | 2:6:4 | + | d | c | dc,dc | 36 km/h | 955.4,0 | 0 | 10 | 4:3 | + | g | b | fb,fb | 36 km/h | 164.4,0 | 0 | 10 | 6:2 | + | a | g | fb,fb | 36 km/h | 164.5,0 | 0 | 10 | 6:2 | Scenario: Verify that negative values cause an error, they're not valid at all diff --git a/features/testbot/traffic_turn_penalties.feature b/features/testbot/traffic_turn_penalties.feature index 9d3c45412..4ab9aa8b2 100644 --- a/features/testbot/traffic_turn_penalties.feature +++ b/features/testbot/traffic_turn_penalties.feature @@ -62,8 +62,8 @@ Feature: Traffic - turn penalties applied to turn onto which a phantom node snap When I route I should get | from | to | route | speed | time | weights | | a | e | ab,be,be | 36 km/h | 40s +-1 | 16.7,20,0 | - | 1 | e | ab,be,be | 36 km/h | 30s +-1 | 6.7,20,0 | + | 1 | e | ab,be,be | 36 km/h | 30s +-1 | 6.8,20,0 | | b | f | bc,cf,cf | 36 km/h | 40s +-1 | 20,20,0 | - | 2 | f | bc,cf,cf | 36 km/h | 30s +-1 | 10,20,0 | + | 2 | f | bc,cf,cf | 36 km/h | 30s +-1 | 10.1,20,0 | | c | g | cd,dg,dg | 144 km/h | 10s +-1 | 120.8,20,0 | - | 3 | g | cd,dg,dg | 54 km/h | 20s +-1 | 110.8,20,0 | + | 3 | g | cd,dg,dg | 54 km/h | 20s +-1 | 110.9,20,0 | diff --git a/features/testbot/trip.feature b/features/testbot/trip.feature index c254f8d75..9fe3c23ae 100644 --- a/features/testbot/trip.feature +++ b/features/testbot/trip.feature @@ -221,7 +221,7 @@ Feature: Basic trip planning When I plan a trip I should get | waypoints | source | destination |roundtrip | trips | durations | distance | - | a,b,d,e,c | first | last | false | abedc | 8.200000000000001 | 81.6 | + | a,b,d,e,c | first | last | false | abedc | 8.200000000000001 | 81.4 | Scenario: Testbot - Trip: FSE with waypoints (more than 10) diff --git a/features/testbot/weight.feature b/features/testbot/weight.feature index eae35c0ff..5d8aadee3 100644 --- a/features/testbot/weight.feature +++ b/features/testbot/weight.feature @@ -28,12 +28,12 @@ Feature: Weight tests | cde | When I route I should get - | waypoints | route | a:weight | - | s,t | abc,cde | 1.1:2:2:1 | + | waypoints | route | a:weight | + | s,t | abc,cde | 1.1:2:2:0.9 | When I route I should get | waypoints | route | times | weight_name | weights | - | s,t | abc,cde | 6.1s,0s | duration | 6.1,0 | + | s,t | abc,cde | 6s,0s | duration | 6,0 | # FIXME include/engine/guidance/assemble_geometry.hpp:95 Scenario: Start and target on the same and adjacent edge @@ -53,10 +53,10 @@ Feature: Weight tests When I route I should get | waypoints | route | distances | weights | times | a:distance | a:duration | a:weight | a:speed | - | s,t | abc,abc | 20m,0m | 2.1,0 | 2.1s,0s | 20.017685 | 2.1 | 2.1 | 9.5 | - | t,s | abc,abc | 20m,0m | 2.1,0 | 2.1s,0s | 20.017685 | 2.1 | 2.1 | 9.5 | - | s,e | abc,abc | 40m,0m | 4.1,0 | 4.1s,0s | 30.026527:10.008842 | 3.1:1 | 3.1:1 | 9.7:10 | - | e,s | abc,abc | 40m,0m | 4.1,0 | 4.1s,0s | 10.008842:30.026527 | 1:3.1 | 1:3.1 | 10:9.7 | + | s,t | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034627 | 2 | 2 | 10 | + | t,s | abc,abc | 20m,0m | 2,0 | 2s,0s | 20.034627 | 2 | 2 | 10 | + | s,e | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 29.940636:10.017313 | 3:0.9 | 3:0.9 | 10:11.1 | + | e,s | abc,abc | 40m,0m | 3.9,0 | 3.9s,0s | 10.017313:29.940636 | 0.9:3 | 0.9:3 | 11.1:10 | Scenario: Step weights -- way_function: fail if no weight or weight_per_meter property @@ -173,13 +173,13 @@ Feature: Weight tests | fgh | When I route I should get - | waypoints | route | distance | weights | times | - | a,f | , | 100m | 99.9,0 | 30s,0s | - | f,a | , | 100m | 199.8,0 | 30s,0s | - | a,h | , | 140m | 139.9,0 | 42s,0s | - | h,a | , | 140m | 279.8,0 | 42s,0s | - | f,h | , | 40m | 40,0 | 12s,0s | - | h,f | , | 40m | 80,0 | 12s,0s | + | waypoints | route | distance | weights | times | + | a,f | , | 100m | 99.8,0 | 30s,0s | + | f,a | , | 100m | 199.9,0 | 30s,0s | + | a,h | , | 140m | 139.8,0 | 42s,0s | + | h,a | , | 140m | 280.1,0 | 42s,0s | + | f,h | , | 40.1m | 40,0 | 12s,0s | + | h,f | , | 40.1m | 80.2,0 | 12s,0s | Scenario: Step weights -- segment_function Given the profile file @@ -281,11 +281,11 @@ Feature: Weight tests When I route I should get | waypoints | route | distance | weights | times | - | a,c | , | 40m +-.1 | 5.119,0 | 289.9s,0s | - | a,e | ,, | 60m +-.1 | 5.119,1.11,0 | 289.9s,100s,0s | - | e,a | ,, | 60m +-.1 | 2.21,2.22,0 | 10.1s,200s,0s | - | e,d | ,, | 40m +-.1 | 4.009,1.11,0 | 189.9s,100s,0s | - | d,e | ,, | 40m +-.1 | 2.21,1.11,0 | 10.1s,100s,0s | + | a,c | , | 40m +-.1 | 5.12,0 | 290s,0s | + | a,e | ,, | 60m +-.1 | 5.12,1.11,0 | 290s,100s,0s | + | e,a | ,, | 60m +-.1 | 2.21,2.22,0 | 10s,200s,0s | + | e,d | ,, | 40m +-.1 | 4.01,1.11,0 | 190s,100s,0s | + | d,e | ,, | 40m +-.1 | 2.21,1.11,0 | 10s,100s,0s | @traffic @speed Scenario: Step weights -- segment_function with speed and turn updates @@ -341,9 +341,9 @@ Feature: Weight tests When I route I should get | waypoints | route | distance | weights | times | - | a,d | , | 59.9m | 20.5,0 | 24s,0s | - | a,e | ,, | 60.1m | 27.2,10,0 | 38.5s,11s,0s | - | d,e | ,, | 39.9m | 10,10,0 | 11s,11s,0s | + | a,d | , | 60m | 20.5,0 | 24s,0s | + | a,e | ,, | 60m | 27.2,10,0 | 38.5s,11s,0s | + | d,e | ,, | 40m | 10,10,0 | 11s,11s,0s | @traffic @speed Scenario: Step weights -- segment_function with speed and turn updates with fallback to durations @@ -375,10 +375,10 @@ Feature: Weight tests And the customize extra arguments "--segment-speed-file {speeds_file} --turn-penalty-file {penalties_file}" When I route I should get - | waypoints | route | distance | weights | times | - | a,d | abcd,abcd | 59.9m | 6.996,0 | 7s,0s | - | a,e | abcd,ce,ce | 60.1m | 6.005,2.002,0 | 6s,2s,0s | - | d,e | abcd,ce,ce | 39.9m | 1.991,2.002,0 | 2s,2s,0s | + | waypoints | route | distance | weights | times | + | a,d | abcd,abcd | 60m | 7,0 | 7s,0s | + | a,e | abcd,ce,ce | 60m | 5.997,2.001,0 | 6s,2s,0s | + | d,e | abcd,ce,ce | 40m | 2.003,2.001,0 | 2s,2s,0s | @traffic @speed Scenario: Updating speeds without affecting weights. @@ -410,5 +410,5 @@ Feature: Weight tests And the customize extra arguments "--segment-speed-file {speeds_file}" When I route I should get - | waypoints | route | distance | weights | times | - | a,b | acdb,acdb | 78.3m | 11.744,0 | 56.4s,0s | + | waypoints | route | distance | weights | times | + | a,b | acdb,acdb | 78.3m | 11.742,0 | 56.4s,0s | diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 17b26b6e0..67792e07a 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -38,8 +38,7 @@ if (ENABLE_FUZZING) "table_parameters" "tile_parameters" "trip_parameters" - "url_parser" - "request_parser") + "url_parser") foreach (target ${ServerTargets}) add_fuzz_target(${target}) diff --git a/fuzz/request_parser.cc b/fuzz/request_parser.cc deleted file mode 100644 index e292ab27e..000000000 --- a/fuzz/request_parser.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include "server/request_parser.hpp" -#include "server/http/request.hpp" - -#include "util.hpp" - -#include -#include - -using osrm::server::RequestParser; -using osrm::server::http::request; - -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) -{ - std::string in(reinterpret_cast(data), size); - - auto first = begin(in); - auto last = end(in); - - RequestParser parser; - request req; - - // &(*it) is needed to go from iterator to underlying item to pointer to underlying item - parser.parse(req, &(*first), &(*last)); - - escape(&req); - - return 0; -} diff --git a/include/contractor/contract_excludable_graph.hpp b/include/contractor/contract_excludable_graph.hpp index 6ae29282a..9d0cc6979 100644 --- a/include/contractor/contract_excludable_graph.hpp +++ b/include/contractor/contract_excludable_graph.hpp @@ -18,7 +18,7 @@ inline auto contractFullGraph(ContractorGraph contractor_graph, std::vector node_weights) { auto num_nodes = contractor_graph.GetNumberOfNodes(); - contractGraph(contractor_graph, node_weights); + contractGraph(contractor_graph, std::move(node_weights)); auto edges = toEdges(std::move(contractor_graph)); std::vector edge_filter(edges.size(), true); @@ -94,7 +94,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_, return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)}, edge_container.MakeEdgeFilters()}; } -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contracted_edge_container.hpp b/include/contractor/contracted_edge_container.hpp index 8b37f5d4a..db3ae5cc9 100644 --- a/include/contractor/contracted_edge_container.hpp +++ b/include/contractor/contracted_edge_container.hpp @@ -164,7 +164,7 @@ struct ContractedEdgeContainer std::vector flags; std::vector edges; }; -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contracted_metric.hpp b/include/contractor/contracted_metric.hpp index f44f49e83..c795a139a 100644 --- a/include/contractor/contracted_metric.hpp +++ b/include/contractor/contracted_metric.hpp @@ -15,11 +15,11 @@ template struct ContractedMetric detail::QueryGraph graph; std::vector> edge_filter; }; -} +} // namespace detail using ContractedMetric = detail::ContractedMetric; using ContractedMetricView = detail::ContractedMetric; -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contractor.hpp b/include/contractor/contractor.hpp index ee1d2dd42..a0335d8ea 100644 --- a/include/contractor/contractor.hpp +++ b/include/contractor/contractor.hpp @@ -49,7 +49,7 @@ class Contractor private: ContractorConfig config; }; -} -} +} // namespace contractor +} // namespace osrm #endif // PROCESSING_CHAIN_HPP diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index 8f1455cce..18e8ae222 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -43,10 +43,8 @@ namespace contractor struct ContractorConfig final : storage::IOConfig { ContractorConfig() - : IOConfig({".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"}, - {}, - {".osrm.hsgr", ".osrm.enw"}), - requested_num_threads(0) + : IOConfig( + {".osrm.ebg", ".osrm.ebg_nodes", ".osrm.properties"}, {}, {".osrm.hsgr", ".osrm.enw"}) { } @@ -62,18 +60,18 @@ struct ContractorConfig final : storage::IOConfig updater::UpdaterConfig updater_config; // DEPRECATED to be removed in v6.0 - bool use_cached_priority; + bool use_cached_priority = false; - unsigned requested_num_threads; + unsigned requested_num_threads = 0; // DEPRECATED to be removed in v6.0 // A percentage of vertices that will be contracted for the hierarchy. // Offers a trade-off between preprocessing and query time. // The remaining vertices form the core of the hierarchy //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) - double core_factor; + double core_factor = 1.0; }; -} -} +} // namespace contractor +} // namespace osrm #endif // EXTRACTOR_OPTIONS_HPP diff --git a/include/contractor/crc32_processor.hpp b/include/contractor/crc32_processor.hpp index 4130ed583..a441ae576 100644 --- a/include/contractor/crc32_processor.hpp +++ b/include/contractor/crc32_processor.hpp @@ -125,7 +125,7 @@ struct RangebasedCRC32 private: IteratorbasedCRC32 crc32; }; -} -} +} // namespace contractor +} // namespace osrm #endif /* ITERATOR_BASED_CRC32_H */ diff --git a/include/contractor/files.hpp b/include/contractor/files.hpp index 8dcade795..39ffa5b54 100644 --- a/include/contractor/files.hpp +++ b/include/contractor/files.hpp @@ -52,8 +52,8 @@ inline void writeGraph(const boost::filesystem::path &path, serialization::write(writer, "/ch/metrics/" + pair.first, pair.second); } } -} -} -} +} // namespace files +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/query_edge.hpp b/include/contractor/query_edge.hpp index 74d38e79e..351ecee24 100644 --- a/include/contractor/query_edge.hpp +++ b/include/contractor/query_edge.hpp @@ -77,7 +77,7 @@ struct QueryEdge data.distance == right.data.distance); } }; -} -} +} // namespace contractor +} // namespace osrm #endif // QUERYEDGE_HPP diff --git a/include/contractor/query_graph.hpp b/include/contractor/query_graph.hpp index e5758dcfe..c0c4b6cf5 100644 --- a/include/contractor/query_graph.hpp +++ b/include/contractor/query_graph.hpp @@ -15,11 +15,11 @@ namespace detail { template using QueryGraph = util::StaticGraph; -} +} // namespace detail using QueryGraph = detail::QueryGraph; using QueryGraphView = detail::QueryGraph; -} -} +} // namespace contractor +} // namespace osrm #endif // QUERYEDGE_HPP diff --git a/include/contractor/serialization.hpp b/include/contractor/serialization.hpp index aa8659274..693216d6a 100644 --- a/include/contractor/serialization.hpp +++ b/include/contractor/serialization.hpp @@ -46,8 +46,8 @@ void read(storage::tar::FileReader &reader, metric.edge_filter[index]); } } -} -} -} +} // namespace serialization +} // namespace contractor +} // namespace osrm #endif diff --git a/include/customizer/cell_customizer.hpp b/include/customizer/cell_customizer.hpp index df5499579..9e27236d0 100644 --- a/include/customizer/cell_customizer.hpp +++ b/include/customizer/cell_customizer.hpp @@ -212,9 +212,8 @@ class CellCustomizer } const auto &data = graph.GetEdgeData(edge); - if (data.forward && - (first_level || - partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to))) + if (data.forward && (first_level || partition.GetCell(level - 1, node) != + partition.GetCell(level - 1, to))) { const EdgeWeight to_weight = weight + data.weight; const EdgeDuration to_duration = duration + data.duration; @@ -237,7 +236,7 @@ class CellCustomizer const partitioner::MultiLevelPartition &partition; }; -} -} +} // namespace customizer +} // namespace osrm #endif // OSRM_CELLS_CUSTOMIZER_HPP diff --git a/include/customizer/cell_metric.hpp b/include/customizer/cell_metric.hpp index 7674174fe..a522facc3 100644 --- a/include/customizer/cell_metric.hpp +++ b/include/customizer/cell_metric.hpp @@ -22,11 +22,11 @@ template struct CellMetricImpl Vector durations; Vector distances; }; -} +} // namespace detail using CellMetric = detail::CellMetricImpl; using CellMetricView = detail::CellMetricImpl; -} -} +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/customizer_config.hpp b/include/customizer/customizer_config.hpp index 35ab1a356..4df629de5 100644 --- a/include/customizer/customizer_config.hpp +++ b/include/customizer/customizer_config.hpp @@ -39,7 +39,7 @@ struct CustomizationConfig final : storage::IOConfig updater::UpdaterConfig updater_config; }; -} -} +} // namespace customizer +} // namespace osrm #endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP diff --git a/include/customizer/edge_based_graph.hpp b/include/customizer/edge_based_graph.hpp index 840a84299..5ef3277f9 100644 --- a/include/customizer/edge_based_graph.hpp +++ b/include/customizer/edge_based_graph.hpp @@ -34,7 +34,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const MultiLevelGraph &graph); -} +} // namespace serialization template class MultiLevelGraph : public partitioner::MultiLevelGraph @@ -126,7 +126,7 @@ using MultiLevelEdgeBasedGraph = MultiLevelGraph; using MultiLevelEdgeBasedGraphView = MultiLevelGraph; -} -} +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/files.hpp b/include/customizer/files.hpp index 364a2572d..335b77a30 100644 --- a/include/customizer/files.hpp +++ b/include/customizer/files.hpp @@ -106,8 +106,8 @@ inline void writeGraph(const boost::filesystem::path &path, writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum); serialization::write(writer, "/mld/multilevelgraph", graph); } -} -} -} +} // namespace files +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/serialization.hpp b/include/customizer/serialization.hpp index afe23cf9b..c242f8ba3 100644 --- a/include/customizer/serialization.hpp +++ b/include/customizer/serialization.hpp @@ -65,8 +65,8 @@ inline void write(storage::tar::FileWriter &writer, storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge); storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset); } -} -} -} +} // namespace serialization +} // namespace customizer +} // namespace osrm #endif diff --git a/include/engine/algorithm.hpp b/include/engine/algorithm.hpp index 760f78e80..1d65cac04 100644 --- a/include/engine/algorithm.hpp +++ b/include/engine/algorithm.hpp @@ -16,14 +16,14 @@ namespace ch struct Algorithm final { }; -} +} // namespace ch // Multi-Level Dijkstra namespace mld { struct Algorithm final { }; -} +} // namespace mld // Algorithm names template const char *name(); @@ -111,8 +111,8 @@ template <> struct HasGetTileTurns final : std::true_type template <> struct HasExcludeFlags final : std::true_type { }; -} -} -} +} // namespace routing_algorithms +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/base_api.hpp b/include/engine/api/base_api.hpp index 702a7f15f..3f27dcf51 100644 --- a/include/engine/api/base_api.hpp +++ b/include/engine/api/base_api.hpp @@ -56,8 +56,8 @@ class BaseAPI // TODO: check forward/reverse return json::makeWaypoint( phantom.location, - util::coordinate_calculation::fccApproximateDistance(phantom.location, - phantom.input_location), + util::coordinate_calculation::greatCircleDistance(phantom.location, + phantom.input_location), facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(), Hint{phantom, facade.GetCheckSum()}); } @@ -66,8 +66,8 @@ class BaseAPI // TODO: check forward/reverse return json::makeWaypoint( phantom.location, - util::coordinate_calculation::fccApproximateDistance(phantom.location, - phantom.input_location), + util::coordinate_calculation::greatCircleDistance(phantom.location, + phantom.input_location), facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)) .to_string()); } @@ -114,7 +114,7 @@ class BaseAPI auto waypoint = std::make_unique(*builder); waypoint->add_location(&location); - waypoint->add_distance(util::coordinate_calculation::fccApproximateDistance( + waypoint->add_distance(util::coordinate_calculation::greatCircleDistance( phantom.location, phantom.input_location)); waypoint->add_name(name_string); if (parameters.generate_hints) @@ -128,8 +128,8 @@ class BaseAPI const BaseParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/base_parameters.hpp b/include/engine/api/base_parameters.hpp index e7a49378d..e49f71157 100644 --- a/include/engine/api/base_parameters.hpp +++ b/include/engine/api/base_parameters.hpp @@ -92,21 +92,21 @@ struct BaseParameters SnappingType snapping = SnappingType::Default; - BaseParameters(const std::vector coordinates_ = {}, - const std::vector> hints_ = {}, + BaseParameters(std::vector coordinates_ = {}, + std::vector> hints_ = {}, std::vector> radiuses_ = {}, std::vector> bearings_ = {}, std::vector> approaches_ = {}, bool generate_hints_ = true, std::vector exclude = {}, const SnappingType snapping_ = SnappingType::Default) - : coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_), - approaches(approaches_), exclude(std::move(exclude)), generate_hints(generate_hints_), - snapping(snapping_) + : coordinates(std::move(coordinates_)), hints(std::move(hints_)), + radiuses(std::move(radiuses_)), bearings(std::move(bearings_)), + approaches(std::move(approaches_)), exclude(std::move(exclude)), + generate_hints(generate_hints_), snapping(snapping_) { } - // FIXME add validation for invalid bearing values bool IsValid() const { return (hints.empty() || hints.size() == coordinates.size()) && @@ -115,7 +115,7 @@ struct BaseParameters (approaches.empty() || approaches.size() == coordinates.size()) && std::all_of(bearings.begin(), bearings.end(), - [](const boost::optional bearing_and_range) { + [](const boost::optional &bearing_and_range) { if (bearing_and_range) { return bearing_and_range->IsValid(); @@ -124,8 +124,8 @@ struct BaseParameters }); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ROUTE_PARAMETERS_HPP diff --git a/include/engine/api/base_result.hpp b/include/engine/api/base_result.hpp index 65dd6aeeb..5dd63e7a9 100644 --- a/include/engine/api/base_result.hpp +++ b/include/engine/api/base_result.hpp @@ -16,8 +16,8 @@ namespace api { using ResultT = mapbox::util::variant; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/json_factory.hpp b/include/engine/api/json_factory.hpp index 0ec505703..f92dba16a 100644 --- a/include/engine/api/json_factory.hpp +++ b/include/engine/api/json_factory.hpp @@ -112,8 +112,8 @@ util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps) util::json::Array makeRouteLegs(std::vector legs, std::vector step_geometries, std::vector annotations); -} -} +} // namespace json +} // namespace api } // namespace engine } // namespace osrm diff --git a/include/engine/api/match_api.hpp b/include/engine/api/match_api.hpp index e1639794e..a93e49710 100644 --- a/include/engine/api/match_api.hpp +++ b/include/engine/api/match_api.hpp @@ -248,8 +248,8 @@ class MatchAPI final : public RouteAPI const tidy::Result &tidy_result; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/match_parameters.hpp b/include/engine/api/match_parameters.hpp index b54076582..774a2c09d 100644 --- a/include/engine/api/match_parameters.hpp +++ b/include/engine/api/match_parameters.hpp @@ -68,8 +68,11 @@ struct MatchParameters : public RouteParameters } template - MatchParameters(std::vector timestamps_, GapsType gaps_, bool tidy_, Args... args_) - : MatchParameters(std::move(timestamps_), gaps_, tidy_, {}, std::forward(args_)...) + MatchParameters(const std::vector ×tamps_, + GapsType gaps_, + bool tidy_, + Args &&... args_) + : MatchParameters(timestamps_, gaps_, tidy_, {}, std::forward(args_)...) { } @@ -77,10 +80,11 @@ struct MatchParameters : public RouteParameters MatchParameters(std::vector timestamps_, GapsType gaps_, bool tidy_, - std::vector waypoints_, - Args... args_) - : RouteParameters{std::forward(args_)..., waypoints_}, - timestamps{std::move(timestamps_)}, gaps(gaps_), tidy(tidy_) + const std::vector &waypoints_, + Args &&... args_) + : RouteParameters{std::forward(args_)..., waypoints_}, timestamps{std::move( + timestamps_)}, + gaps(gaps_), tidy(tidy_) { } @@ -94,8 +98,8 @@ struct MatchParameters : public RouteParameters (timestamps.empty() || timestamps.size() == coordinates.size()); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/match_parameters_tidy.hpp b/include/engine/api/match_parameters_tidy.hpp index ab4610c4f..694dd6885 100644 --- a/include/engine/api/match_parameters_tidy.hpp +++ b/include/engine/api/match_parameters_tidy.hpp @@ -122,7 +122,7 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5}) // Walk over adjacent (coord, ts)-pairs, with rhs being the candidate to discard or keep for (std::size_t current = 0, next = 1; next < params.coordinates.size() - 1; ++current, ++next) { - auto distance_delta = util::coordinate_calculation::haversineDistance( + auto distance_delta = util::coordinate_calculation::greatCircleDistance( params.coordinates[current], params.coordinates[next]); running.distance_in_meters += distance_delta; const auto over_distance = running.distance_in_meters >= cfg.distance_in_meters; @@ -200,9 +200,9 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5}) return result; } -} // ns tidy -} // ns api -} // ns engine -} // ns osrm +} // namespace tidy +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index 4cc01e41f..aff3c57dc 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -159,8 +159,8 @@ class NearestAPI final : public BaseAPI } }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/nearest_parameters.hpp b/include/engine/api/nearest_parameters.hpp index f24251b8c..576e75352 100644 --- a/include/engine/api/nearest_parameters.hpp +++ b/include/engine/api/nearest_parameters.hpp @@ -52,8 +52,8 @@ struct NearestParameters : public BaseParameters bool IsValid() const { return BaseParameters::IsValid() && number_of_results >= 1; } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ENGINE_API_NEAREST_PARAMETERS_HPP diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index 1c8283fae..72244c453 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -688,7 +688,7 @@ class RouteAPI : public BaseAPI intersection.classes.begin(), intersection.classes.end(), classes.begin(), - [&fb_result](const std::string cls) { return fb_result.CreateString(cls); }); + [&fb_result](const std::string &cls) { return fb_result.CreateString(cls); }); auto classes_vector = fb_result.CreateVector(classes); auto entry_vector = fb_result.CreateVector(intersection.entry); @@ -988,8 +988,8 @@ class RouteAPI : public BaseAPI } }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/route_parameters.hpp b/include/engine/api/route_parameters.hpp index ba200050d..8d5dd9ae4 100644 --- a/include/engine/api/route_parameters.hpp +++ b/include/engine/api/route_parameters.hpp @@ -87,19 +87,13 @@ struct RouteParameters : public BaseParameters const GeometriesType geometries_, const OverviewType overview_, const boost::optional continue_straight_, - Args... args_) + Args &&... args_) // Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one // below. - : BaseParameters{std::forward(args_)...}, - steps{steps_}, - alternatives{alternatives_}, - number_of_alternatives{alternatives_ ? 1u : 0u}, - annotations{false}, - annotations_type{AnnotationsType::None}, - geometries{geometries_}, - overview{overview_}, - continue_straight{continue_straight_}, - waypoints() + : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, + number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false}, + annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_}, + continue_straight{continue_straight_}, waypoints() { } @@ -111,7 +105,7 @@ struct RouteParameters : public BaseParameters const GeometriesType geometries_, const OverviewType overview_, const boost::optional continue_straight_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_}, annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None}, @@ -129,12 +123,12 @@ struct RouteParameters : public BaseParameters const GeometriesType geometries_, const OverviewType overview_, const boost::optional continue_straight_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, number_of_alternatives{alternatives_ ? 1u : 0u}, - annotations{annotations_ == AnnotationsType::None ? false : true}, - annotations_type{annotations_}, geometries{geometries_}, overview{overview_}, - continue_straight{continue_straight_}, waypoints() + annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_}, + geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}, + waypoints() { } @@ -147,12 +141,12 @@ struct RouteParameters : public BaseParameters const OverviewType overview_, const boost::optional continue_straight_, std::vector waypoints_, - const Args... args_) + const Args &&... args_) : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_}, annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None}, - geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}, - waypoints{waypoints_} + geometries{geometries_}, overview{overview_}, + continue_straight{continue_straight_}, waypoints{std::move(waypoints_)} { } @@ -165,12 +159,12 @@ struct RouteParameters : public BaseParameters const OverviewType overview_, const boost::optional continue_straight_, std::vector waypoints_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, - number_of_alternatives{alternatives_ ? 1u : 0u}, - annotations{annotations_ == AnnotationsType::None ? false : true}, + number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ != + AnnotationsType::None}, annotations_type{annotations_}, geometries{geometries_}, overview{overview_}, - continue_straight{continue_straight_}, waypoints{waypoints_} + continue_straight{continue_straight_}, waypoints{std::move(waypoints_)} { } @@ -217,8 +211,8 @@ inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsT { return lhs = lhs | rhs; } -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/table_api.hpp b/include/engine/api/table_api.hpp index d3efe15d9..72cdea4e6 100644 --- a/include/engine/api/table_api.hpp +++ b/include/engine/api/table_api.hpp @@ -407,8 +407,8 @@ class TableAPI final : public BaseAPI const TableParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/table_parameters.hpp b/include/engine/api/table_parameters.hpp index fbbf6831e..30e17900b 100644 --- a/include/engine/api/table_parameters.hpp +++ b/include/engine/api/table_parameters.hpp @@ -85,7 +85,7 @@ struct TableParameters : public BaseParameters template TableParameters(std::vector sources_, std::vector destinations_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, sources{std::move(sources_)}, destinations{std::move(destinations_)} { @@ -95,7 +95,7 @@ struct TableParameters : public BaseParameters TableParameters(std::vector sources_, std::vector destinations_, const AnnotationsType annotations_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, sources{std::move(sources_)}, destinations{std::move(destinations_)}, annotations{annotations_} { @@ -108,7 +108,7 @@ struct TableParameters : public BaseParameters double fallback_speed_, FallbackCoordinateType fallback_coordinate_type_, double scale_factor_, - Args... args_) + Args &&... args_) : BaseParameters{std::forward(args_)...}, sources{std::move(sources_)}, destinations{std::move(destinations_)}, fallback_speed{fallback_speed_}, fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_}, @@ -122,7 +122,7 @@ struct TableParameters : public BaseParameters if (!BaseParameters::IsValid()) return false; - // Distance Table makes only sense with 2+ coodinates + // Distance Table makes only sense with 2+ coordinates if (coordinates.size() < 2) return false; @@ -166,8 +166,8 @@ inline TableParameters::AnnotationsType &operator|=(TableParameters::Annotations { return lhs = lhs | rhs; } -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ENGINE_API_TABLE_PARAMETERS_HPP diff --git a/include/engine/api/tile_parameters.hpp b/include/engine/api/tile_parameters.hpp index 137c4dac3..e5328e7c7 100644 --- a/include/engine/api/tile_parameters.hpp +++ b/include/engine/api/tile_parameters.hpp @@ -70,8 +70,8 @@ struct TileParameters final return valid_x && valid_y && valid_z; } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/trip_api.hpp b/include/engine/api/trip_api.hpp index 65f9381fc..90e5e1391 100644 --- a/include/engine/api/trip_api.hpp +++ b/include/engine/api/trip_api.hpp @@ -175,8 +175,8 @@ class TripAPI final : public RouteAPI const TripParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/trip_parameters.hpp b/include/engine/api/trip_parameters.hpp index 0df38d6c9..84d6b861a 100644 --- a/include/engine/api/trip_parameters.hpp +++ b/include/engine/api/trip_parameters.hpp @@ -65,8 +65,8 @@ struct TripParameters : public RouteParameters DestinationType destination_, bool roundtrip_, Args &&... args_) - : RouteParameters{std::forward(args_)...}, source{source_}, destination{destination_}, - roundtrip{roundtrip_} + : RouteParameters{std::forward(args_)...}, source{source_}, + destination{destination_}, roundtrip{roundtrip_} { } @@ -76,8 +76,8 @@ struct TripParameters : public RouteParameters bool IsValid() const { return RouteParameters::IsValid(); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/approach.hpp b/include/engine/approach.hpp index 5c6787f27..f7d671a9c 100644 --- a/include/engine/approach.hpp +++ b/include/engine/approach.hpp @@ -42,5 +42,5 @@ enum class Approach : std::uint8_t }; } -} +} // namespace osrm #endif diff --git a/include/engine/base64.hpp b/include/engine/base64.hpp index 024d04b29..d1fa8753c 100644 --- a/include/engine/base64.hpp +++ b/include/engine/base64.hpp @@ -38,7 +38,7 @@ using BinaryFromBase64 = boost::archive::iterators::transform_width< 8, // get a view of 8 bit 6 // from a sequence of 6 bit >; -} // ns detail +} // namespace detail namespace engine { @@ -135,7 +135,7 @@ template T decodeBase64Bytewise(const std::string &encoded) return x; } -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm #endif /* OSRM_BASE64_HPP */ diff --git a/include/engine/bearing.hpp b/include/engine/bearing.hpp index eaabae781..54e24f57f 100644 --- a/include/engine/bearing.hpp +++ b/include/engine/bearing.hpp @@ -46,7 +46,7 @@ inline bool operator==(const Bearing lhs, const Bearing rhs) return lhs.bearing == rhs.bearing && lhs.range == rhs.range; } inline bool operator!=(const Bearing lhs, const Bearing rhs) { return !(lhs == rhs); } -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/data_watchdog.hpp b/include/engine/data_watchdog.hpp index 416f1df76..29fb93443 100644 --- a/include/engine/data_watchdog.hpp +++ b/include/engine/data_watchdog.hpp @@ -142,14 +142,14 @@ class DataWatchdogImpl facade_factory; }; -} +} // namespace detail // This class monitors the shared memory region that contains the pointers to // the data and layout regions that should be used. This region is updated // once a new dataset arrives. template class FacadeT> using DataWatchdog = detail::DataWatchdogImpl>; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade.hpp b/include/engine/datafacade.hpp index 76068a472..f0f8e9e5b 100644 --- a/include/engine/datafacade.hpp +++ b/include/engine/datafacade.hpp @@ -11,7 +11,7 @@ namespace engine using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase; template using DataFacade = datafacade::ContiguousInternalMemoryDataFacade; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade/algorithm_datafacade.hpp b/include/engine/datafacade/algorithm_datafacade.hpp index a83a5340c..38030511c 100644 --- a/include/engine/datafacade/algorithm_datafacade.hpp +++ b/include/engine/datafacade/algorithm_datafacade.hpp @@ -99,8 +99,8 @@ template <> class AlgorithmDataFacade // searches for a specific edge virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0; }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 63d4dbc3a..e448a8f57 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -609,7 +609,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade auto found_range = std::equal_range( m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{}); - std::for_each(found_range.first, found_range.second, [&](const auto & override) { + std::for_each(found_range.first, found_range.second, [&](const auto &override) { std::vector sequence( m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_begin, m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_end); @@ -630,7 +630,7 @@ class ContiguousInternalMemoryDataFacade public ContiguousInternalMemoryAlgorithmDataFacade { public: - ContiguousInternalMemoryDataFacade(std::shared_ptr allocator, + ContiguousInternalMemoryDataFacade(const std::shared_ptr &allocator, const std::string &metric_name, const std::size_t exclude_index) : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index), @@ -752,7 +752,7 @@ class ContiguousInternalMemoryDataFacade final { private: public: - ContiguousInternalMemoryDataFacade(std::shared_ptr allocator, + ContiguousInternalMemoryDataFacade(const std::shared_ptr &allocator, const std::string &metric_name, const std::size_t exclude_index) : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index), @@ -760,8 +760,8 @@ class ContiguousInternalMemoryDataFacade final { } }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP diff --git a/include/engine/datafacade/datafacade_base.hpp b/include/engine/datafacade/datafacade_base.hpp index 77dab643f..b80c93b18 100644 --- a/include/engine/datafacade/datafacade_base.hpp +++ b/include/engine/datafacade/datafacade_base.hpp @@ -223,8 +223,8 @@ class BaseDataFacade virtual std::vector GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0; }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif // DATAFACADE_BASE_HPP diff --git a/include/engine/datafacade/mmap_memory_allocator.hpp b/include/engine/datafacade/mmap_memory_allocator.hpp index fc4b4e24a..817fcf9db 100644 --- a/include/engine/datafacade/mmap_memory_allocator.hpp +++ b/include/engine/datafacade/mmap_memory_allocator.hpp @@ -22,7 +22,7 @@ namespace datafacade /** * This allocator uses file backed mmap memory block as the data location. */ -class MMapMemoryAllocator : public ContiguousBlockAllocator +class MMapMemoryAllocator final : public ContiguousBlockAllocator { public: explicit MMapMemoryAllocator(const storage::StorageConfig &config); diff --git a/include/engine/datafacade/process_memory_allocator.hpp b/include/engine/datafacade/process_memory_allocator.hpp index 0dd555e26..742f20e36 100644 --- a/include/engine/datafacade/process_memory_allocator.hpp +++ b/include/engine/datafacade/process_memory_allocator.hpp @@ -20,7 +20,7 @@ namespace datafacade * This class holds a unique_ptr to the memory block, so it * is auto-freed upon destruction. */ -class ProcessMemoryAllocator : public ContiguousBlockAllocator +class ProcessMemoryAllocator final : public ContiguousBlockAllocator { public: explicit ProcessMemoryAllocator(const storage::StorageConfig &config); diff --git a/include/engine/datafacade/shared_memory_allocator.hpp b/include/engine/datafacade/shared_memory_allocator.hpp index 00b37ac7f..5b0a0989a 100644 --- a/include/engine/datafacade/shared_memory_allocator.hpp +++ b/include/engine/datafacade/shared_memory_allocator.hpp @@ -20,7 +20,7 @@ namespace datafacade * Many SharedMemoryDataFacade objects can be created that point to the same shared * memory block. */ -class SharedMemoryAllocator : public ContiguousBlockAllocator +class SharedMemoryAllocator final : public ContiguousBlockAllocator { public: explicit SharedMemoryAllocator( diff --git a/include/engine/datafacade_factory.hpp b/include/engine/datafacade_factory.hpp index a4ff57f38..e01c70f72 100644 --- a/include/engine/datafacade_factory.hpp +++ b/include/engine/datafacade_factory.hpp @@ -65,12 +65,12 @@ template