diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5643bb9b790..a9f0a816063 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,7 +12,7 @@ If your PR is still work in progress please attach the relevant label. - [ ] 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 + ## Requirements / Relations diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index fe4ee32482c..3bb71641de5 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -23,7 +23,7 @@ concurrency: cancel-in-progress: true jobs: - windows-release-node: + conan-windows-release-node: needs: format-taginfo-docs runs-on: windows-2022 continue-on-error: false @@ -31,8 +31,6 @@ jobs: BUILD_TYPE: Release steps: - uses: actions/checkout@v4 - - run: pip install "conan<2.0.0" - - run: conan --version - run: cmake --version - uses: actions/setup-node@v4 with: @@ -51,6 +49,12 @@ jobs: run: | mkdir build cd build + + python3 -m venv .venv + source .venv/Scripts/Activate + python3 -m pip install conan==2.7.1 + conan profile detect --force + cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON .. cmake --build . --config Release @@ -161,7 +165,7 @@ jobs: 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: + build-matrix: needs: format-taginfo-docs strategy: matrix: @@ -170,7 +174,6 @@ jobs: continue-on-error: false node: 20 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Debug CCOMPILER: gcc-13 CUCUMBER_TIMEOUT: 20000 @@ -181,7 +184,6 @@ jobs: continue-on-error: false node: 20 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Debug CCOMPILER: clang-18 CUCUMBER_TIMEOUT: 20000 @@ -193,9 +195,8 @@ jobs: - name: clang-18-release continue-on-error: false - node: 18 + node: 20 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: clang-18 CXXCOMPILER: clang++-18 @@ -206,7 +207,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Debug CCOMPILER: clang-18 CXXCOMPILER: clang++-18 @@ -217,7 +217,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Debug CCOMPILER: clang-18 CXXCOMPILER: clang++-18 @@ -229,7 +228,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: clang-17 CXXCOMPILER: clang++-17 @@ -240,7 +238,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: clang-16 CXXCOMPILER: clang++-16 @@ -251,7 +248,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: clang-18 CXXCOMPILER: clang++-18 @@ -263,7 +259,6 @@ jobs: continue-on-error: false node: 18 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: clang-18 CXXCOMPILER: clang++-18 @@ -274,7 +269,6 @@ jobs: continue-on-error: false node: 20 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: gcc-14 CXXCOMPILER: g++-14 @@ -284,7 +278,6 @@ jobs: continue-on-error: false node: 20 runs-on: ubuntu-24.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: gcc-13 CXXCOMPILER: g++-13 @@ -294,7 +287,6 @@ jobs: continue-on-error: false node: 20 runs-on: ubuntu-22.04 - BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: gcc-12 CXXCOMPILER: g++-12 @@ -338,7 +330,7 @@ jobs: build_node_package: true continue-on-error: true node: 20 - runs-on: macos-14 # arm64 + runs-on: macos-15 # arm64 BUILD_TYPE: Release CCOMPILER: clang CXXCOMPILER: clang++ @@ -350,7 +342,6 @@ jobs: 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 }} @@ -393,10 +384,10 @@ jobs: - name: Enable Conan cache uses: actions/cache@v4 with: - path: ~/.conan - key: v9-conan-${{ matrix.name }}-${{ github.sha }} + path: ~/.conan2 + key: v10-conan-${{ matrix.name }}-${{ github.sha }} restore-keys: | - v9-conan-${{ matrix.name }}- + v10-conan-${{ matrix.name }}- - name: Enable test cache uses: actions/cache@v4 with: @@ -430,35 +421,16 @@ jobs: - name: Give tar root ownership if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON' run: sudo chown root /bin/tar && sudo chmod u+s /bin/tar - - name: Cache Boost - if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON' - id: cache-boost - uses: actions/cache@v4 - with: - path: | - /usr/local/include/boost - /usr/local/lib/libboost* - key: v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }} - restore-keys: | - v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }} - - name: Install Boost - if: steps.cache-boost.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON' - run: | - BOOST_VERSION="1.85.0" - BOOST_VERSION_UNDERSCORE="${BOOST_VERSION//./_}" - wget -q https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDERSCORE}.tar.gz - tar xzf boost_${BOOST_VERSION_UNDERSCORE}.tar.gz - cd boost_${BOOST_VERSION_UNDERSCORE} - sudo ./bootstrap.sh - sudo ./b2 install - cd .. - sudo rm -rf boost_${BOOST_VERSION_UNDERSCORE}* + - name: Install boost + if: ${{ matrix.ENABLE_CONAN != 'ON' }} + uses: MarkusJx/install-boost@v2 + id: install-boost + with: + boost_version: 1.85.0 - name: Install dev dependencies run: | - python3 -m pip install "conan<2.0.0" || python3 -m pip install "conan<2.0.0" --break-system-packages - # workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499 # and that's why CI cannot find conan executable installed above if [[ "${RUNNER_OS}" == "macOS" ]]; then @@ -495,13 +467,6 @@ jobs: tar zxvf onetbb.tgz sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/ sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/ - - name: Add Clang 18 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Clang 18 - if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.CCOMPILER == 'clang-18' }} - run: | - sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq - - conan config init - yq eval '.compiler.clang.version += ["18"]' -i "$HOME/.conan/settings.yml" - name: Prepare build run: | mkdir ${OSRM_BUILD_DIR} @@ -523,7 +488,14 @@ jobs: run: | echo "Using ${JOBS} jobs" pushd ${OSRM_BUILD_DIR} - + + if [[ "${ENABLE_CONAN}" == "ON" ]]; then + python3 -m venv .venv + source .venv/bin/activate + python3 -m pip install conan==2.7.1 + conan profile detect --force + fi + ccache --zero-stats cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DENABLE_CONAN=${ENABLE_CONAN:-OFF} \ @@ -533,10 +505,10 @@ jobs: -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 \ -DENABLE_LTO=${ENABLE_LTO:-ON} \ -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} + make --jobs=${JOBS} if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then @@ -550,13 +522,8 @@ jobs: 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 + env: + Boost_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - name: Run all tests if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }} run: | @@ -564,7 +531,6 @@ jobs: # 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} @@ -650,130 +616,9 @@ jobs: ccache -p ccache -s - benchmarks: - if: github.event_name == 'pull_request' - needs: [format-taginfo-docs] - runs-on: self-hosted - env: - CCOMPILER: clang-16 - CXXCOMPILER: clang++-16 - CC: clang-16 - CXX: clang++-16 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - GITHUB_REPOSITORY: ${{ github.repository }} - RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }} - steps: - - name: Checkout PR Branch - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - path: pr - - name: Activate virtualenv - run: | - python3 -m venv .venv - source .venv/bin/activate - echo PATH=$PATH >> $GITHUB_ENV - pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4" - - name: Prepare data - run: | - if [ "$RUN_BIG_BENCHMARK" = "true" ]; then - rm -rf ~/data.osm.pbf - wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet - gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv - else - if [ ! -f "~/data.osm.pbf" ]; then - wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf - else - echo "Using cached data.osm.pbf" - fi - gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv - fi - - name: Prepare environment - run: | - echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV - mkdir -p $HOME/.ccache - ccache --zero-stats - ccache --max-size=256M - - name: Checkout Base Branch - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.base.ref }} - path: base - - name: Build Base Branch - run: | - cd base - npm ci --ignore-scripts - cd .. - mkdir base/build - cd base/build - cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. - make -j$(nproc) - make -j$(nproc) benchmarks - cd .. - make -C test/data - - name: Build PR Branch - run: | - cd pr - npm ci --ignore-scripts - cd .. - mkdir -p pr/build - cd pr/build - cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. - make -j$(nproc) - make -j$(nproc) benchmarks - cd .. - make -C test/data - # we run benchmarks in tmpfs to avoid impact of disk IO - - name: Create folder for tmpfs - run: | - # if by any chance it was mounted before(e.g. due to previous job failed), unmount it - sudo umount ~/benchmarks | true - rm -rf ~/benchmarks - mkdir -p ~/benchmarks - # see https://llvm.org/docs/Benchmarking.html - - name: Run PR Benchmarks - run: | - sudo cset shield -c 2-3 -k on - sudo mount -t tmpfs -o size=4g none ~/benchmarks - cp -rf pr/build ~/benchmarks/build - cp -rf pr/lib ~/benchmarks/lib - mkdir -p ~/benchmarks/test - cp -rf pr/test/data ~/benchmarks/test/data - cp -rf pr/profiles ~/benchmarks/profiles - - sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv - sudo umount ~/benchmarks - sudo cset shield --reset - - name: Run Base Benchmarks - run: | - sudo cset shield -c 2-3 -k on - sudo mount -t tmpfs -o size=4g none ~/benchmarks - cp -rf base/build ~/benchmarks/build - cp -rf base/lib ~/benchmarks/lib - mkdir -p ~/benchmarks/test - cp -rf base/test/data ~/benchmarks/test/data - cp -rf base/profiles ~/benchmarks/profiles - - # TODO: remove it when base branch will have this file at needed location - if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then - cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json - fi - # we intentionally use scripts from PR branch to be able to update them and see results in the same PR - sudo cset shield --exec -- cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv - sudo umount ~/benchmarks - sudo cset shield --reset - - name: Post Benchmark Results - run: | - python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results - - name: Show CCache statistics - run: | - ccache -p - ccache -s - ci-complete: - runs-on: ubuntu-22.04 - needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks] + runs-on: ubuntu-latest + needs: [build-matrix, conan-windows-release-node, docker-image-matrix] steps: - run: echo "CI complete" diff --git a/.gitignore b/.gitignore index 2e777a498a0..a98ae2b44c3 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,6 @@ Thumbs.db ####################### /_build* /build/ -/example/build/ /test/data/monaco.osrm* /test/data/ch /test/data/mld diff --git a/CHANGELOG.md b/CHANGELOG.md index ff5dc6d9885..db9f8ce6d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842) - ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658) - Build: + - CHANGED: Fix compilation with upcoming Boost 1.87.0 [#7073](https://github.com/Project-OSRM/osrm-backend/pull/7073) - CHANGED: Upgrade clang-format to version 15. [#6919](https://github.com/Project-OSRM/osrm-backend/pull/6919) - CHANGED: Use Debian Bookworm as base Docker image [#6904](https://github.com/Project-OSRM/osrm-backend/pull/6904) - CHANGED: Upgrade CI actions to latest versions [#6893](https://github.com/Project-OSRM/osrm-backend/pull/6893) @@ -25,6 +26,8 @@ - NodeJS: - CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452) - Misc: + - CHANGED: Migrate to Conan 2.x. [#7042](https://github.com/Project-OSRM/osrm-backend/pull/7042) + - CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062) - CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991) - CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988) - CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983) @@ -77,10 +80,13 @@ - FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655) - FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655) - ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839) + - FIXED: Segfault in `UnresolvedManeuverOverride::Turns()` on Australia extracts [#7112](https://github.com/Project-OSRM/osrm-backend/pull/7112) + - CHANGED: Replaced PL:trunk with PL:expressway to match the latest changes in Polish tagging [#7079](https://github.com/Project-OSRM/osrm-backend/pull/7079) + - FIXED: Remove unused C++ headers [#7105](https://github.com/Project-OSRM/osrm-backend/pull/7105) - Profiles: - FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615) - FIXED: edge maxspeed now doesn't overwrite a vehicle maxspeed [#7036](https://github.com/Project-OSRM/osrm-backend/pull/7036) - + - ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044) - Routing: - FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419) - FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08e0a64fa89..4cebf17ebde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,20 +22,40 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR}) set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif() -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_CCACHE "Speed up incremental rebuilds via ccache" ON) +option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF) +option(ENABLE_CONAN "Use conan for dependencies" OFF) option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF) -option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF) -option(ENABLE_LTO "Use Link Time Optimisation" ON) +option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF) option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF) +option(ENABLE_LTO "Use Link Time Optimisation" ON) option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF) -option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF) +option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF) + +if (ENABLE_CONAN) + message(STATUS "Installing Conan packages. It may take a while...") + find_program(CONAN_EXECUTABLE NAMES conan) + if (NOT CONAN_EXECUTABLE) + message(FATAL_ERROR "Conan not found! Please install Conan 2.x and try again.") + else() + set(CMAKE_TOOLCHAIN_FILE "./conan_toolchain.cmake") + + execute_process( + COMMAND ${CONAN_EXECUTABLE} install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=${CMAKE_BUILD_TYPE} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT_VARIABLE conan_stdout + ERROR_VARIABLE conan_stderr + RESULT_VARIABLE conan_install_result + ) + + if (NOT conan_install_result EQUAL 0) + message(FATAL_ERROR "Conan install failed: ${conan_install_result}. Stderr: ${conan_stderr}. Stdout: ${conan_stdout}") + endif() + endif() +endif() if (ENABLE_CLANG_TIDY) find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) @@ -49,16 +69,8 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -# be compatible with version handling before cmake 3.x -if (POLICY CMP0057) - cmake_policy(SET CMP0057 NEW) -endif() -if (POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() project(OSRM C CXX) - if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)) include(CheckIPOSupported) check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error) @@ -86,14 +98,14 @@ sbeParseJson(packagejson packagejsonraw) # This regex is not strict enough, but the correct one is too complicated for cmake matching. # https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)([-+][0-9a-zA-Z.-]+)?$") - set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1}) - set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2}) - set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3}) - set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4}) + set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1}) + set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2}) + set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3}) + set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4}) - set(OSRM_VERSION packagejson.version) + set(OSRM_VERSION packagejson.version) else() - message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}") + message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}") endif() if (MSVC) @@ -125,12 +137,6 @@ include(CheckCXXCompilerFlag) include(FindPackageHandleStandardArgs) include(GNUInstallDirs) -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - message(STATUS "Building on a 64 bit system") -else() - message(FATAL_ERROR "Building on a 32 bit system is not supported") -endif() - include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/) include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/generated/include/) @@ -152,7 +158,6 @@ file(GLOB UpdaterGlob src/updater/*.cpp) file(GLOB StorageGlob src/storage/*.cpp) file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp) file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp) -file(GLOB ErrorcodesGlob src/osrm/errorcodes.cpp) add_library(UTIL OBJECT ${UtilGlob}) add_library(EXTRACTOR OBJECT ${ExtractorGlob}) @@ -163,14 +168,11 @@ add_library(CONTRACTOR OBJECT ${ContractorGlob}) add_library(UPDATER OBJECT ${UpdaterGlob}) add_library(STORAGE OBJECT ${StorageGlob}) add_library(ENGINE OBJECT ${EngineGlob}) - -if (BUILD_ROUTED) - add_library(SERVER OBJECT ${ServerGlob}) - add_executable(osrm-routed src/tools/routed.cpp $ $) -endif() +add_library(SERVER OBJECT ${ServerGlob}) set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX) +add_executable(osrm-routed src/tools/routed.cpp $ $) add_executable(osrm-extract src/tools/extract.cpp) add_executable(osrm-partition src/tools/partition.cpp) add_executable(osrm-customize src/tools/customize.cpp) @@ -321,116 +323,74 @@ 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) - - conan_check(REQUIRED) - - set(CONAN_BOOST_VERSION "1.85.0@#14265ec82b25d91305bbb3b30d3357f8") - set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897") - set(CONAN_EXPAT_VERSION "2.6.2@#2d385d0d50eb5561006a7ff9e356656b") - set(CONAN_LUA_VERSION "5.4.6@#658d6089093cf01992c2737ab2e96763") - set(CONAN_TBB_VERSION "2021.12.0@#e56e5b44be8d690530585dd3634c0106") - - set(CONAN_SYSTEM_INCLUDES ON) - - - set(CONAN_ARGS - REQUIRES - "boost/${CONAN_BOOST_VERSION}" - "bzip2/${CONAN_BZIP2_VERSION}" - "expat/${CONAN_EXPAT_VERSION}" - "lua/${CONAN_LUA_VERSION}" - "onetbb/${CONAN_TBB_VERSION}" - BASIC_SETUP - GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies - KEEP_RPATHS - NO_OUTPUT_DIRS - OPTIONS boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it - BUILD missing - ) - - # Enable revisions in the conan config - execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE) - if(NOT "${RET_CODE}" STREQUAL "0") - message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'") - endif() - - # explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141) - if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - conan_cmake_run("${CONAN_ARGS};ARCH;x86") - # cross-compilation for Apple Silicon - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") - conan_cmake_run("${CONAN_ARGS};ARCH;armv8") - else() - conan_cmake_run("${CONAN_ARGS}") - endif() - - 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}) +if (ENABLE_CONAN) set(Boost_USE_STATIC_LIBS ON) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) - set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}") - set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}") - set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}") - set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}") - set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}") - set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}") + find_package(TBB REQUIRED) + find_package(EXPAT REQUIRED) + find_package(BZip2 REQUIRED) + find_package(Lua 5.2 REQUIRED) + add_dependency_includes(${Boost_INCLUDE_DIRS}) - find_package(BZip2 REQUIRED) - find_package(EXPAT REQUIRED) - find_package(lua REQUIRED) - set(LUA_LIBRARIES ${lua_LIBRARIES}) + set(BOOST_BASE_LIBRARIES ${Boost_LIBRARIES}) + set(BOOST_ENGINE_LIBRARIES ${Boost_LIBRARIES}) - find_package(TBB REQUIRED) + add_dependency_includes(${TBB_INCLUDE_DIR}) + set(TBB_LIBRARIES ${TBB_LIBRARIES}) + + add_dependency_includes(${expat_INCLUDE_DIRS}) + set(EXPAT_LIBRARIES ${expat_LIBRARIES}) + set(EXPAT_INCLUDE_DIRS ${expat_INCLUDE_DIRS}) + add_dependency_includes(${BZIP2_INCLUDE_DIR}) + + set(LUA_LIBRARIES lua::lua) + if (LUA_FOUND) + message(STATUS "Using Lua ${LUA_VERSION_STRING}") + endif() + + add_dependency_includes(${lua_INCLUDE_DIRS}) # note: we avoid calling find_package(Osmium ...) here to ensure that the # 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.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) - add_dependency_includes(${Boost_INCLUDE_DIRS}) - + find_package(Boost REQUIRED CONFIG COMPONENTS ${BOOST_COMPONENTS}) find_package(TBB REQUIRED) - add_dependency_includes(${TBB_INCLUDE_DIR}) - set(TBB_LIBRARIES TBB::tbb) - find_package(EXPAT REQUIRED) - add_dependency_includes(${EXPAT_INCLUDE_DIRS}) - find_package(BZip2 REQUIRED) - add_dependency_includes(${BZIP2_INCLUDE_DIR}) - find_package(Lua 5.2 REQUIRED) - if (LUA_FOUND) - message(STATUS "Using Lua ${LUA_VERSION_STRING}") - endif() + add_dependency_includes(${Boost_INCLUDE_DIRS}) + add_dependency_includes(${TBB_INCLUDE_DIR}) + add_dependency_includes(${EXPAT_INCLUDE_DIRS}) + add_dependency_includes(${BZIP2_INCLUDE_DIR}) add_dependency_includes(${LUA_INCLUDE_DIR}) + set(TBB_LIBRARIES TBB::tbb) + + set(BOOST_BASE_LIBRARIES + ${Boost_DATE_TIME_LIBRARY} + ${Boost_IOSTREAMS_LIBRARY} + ${Boost_THREAD_LIBRARY}) + + set(BOOST_ENGINE_LIBRARIES + ${Boost_ZLIB_LIBRARY} + ${Boost_REGEX_LIBRARY} + ${BOOST_BASE_LIBRARIES}) + # add a target to generate API documentation with Doxygen find_package(Doxygen) if(DOXYGEN_FOUND) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" VERBATIM - ) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" VERBATIM + ) endif() - # note libosmium depends on expat and bzip2 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake") if(NOT OSMIUM_INCLUDE_DIR) @@ -440,6 +400,8 @@ else() include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR}) endif() + + # prefix compilation with ccache by default if available and on clang or gcc if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")) find_program(CCACHE_FOUND ccache) @@ -454,6 +416,7 @@ endif() # to ensure that osrm binaries play well with other binaries like nodejs find_package(ZLIB REQUIRED) add_dependency_includes(${ZLIB_INCLUDE_DIRS}) +set(ZLIB_LIBRARY ${ZLIB_LIBRARIES}) add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3) add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE) @@ -464,15 +427,6 @@ add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_) add_definitions(${OSRM_DEFINES}) include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS}) -set(BOOST_BASE_LIBRARIES - ${Boost_DATE_TIME_LIBRARY} - ${Boost_IOSTREAMS_LIBRARY} - ${Boost_THREAD_LIBRARY}) - -set(BOOST_ENGINE_LIBRARIES - ${Boost_ZLIB_LIBRARY} - ${Boost_REGEX_LIBRARY} - ${BOOST_BASE_LIBRARIES}) # Binaries target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY}) @@ -480,9 +434,7 @@ 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}) -if (BUILD_ROUTED) - target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) -endif() +target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) set(EXTRACTOR_LIBRARIES ${BZIP2_LIBRARIES} @@ -505,10 +457,10 @@ set(PARTITIONER_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${TBB_LIBRARIES} ${MAYBE_RT_LIBRARY} - ${MAYBE_COVERAGE_LIBRARIES} - ${ZLIB_LIBRARY}) + ${MAYBE_COVERAGE_LIBRARIES}) set(CUSTOMIZER_LIBRARIES ${BOOST_ENGINE_LIBRARIES} + ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${TBB_LIBRARIES} ${MAYBE_RT_LIBRARY} @@ -556,18 +508,13 @@ target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES}) target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store) target_link_libraries(osrm_store ${STORAGE_LIBRARIES}) -# BUILD_COMPONENTS add_executable(osrm-components src/tools/components.cpp $ $) target_link_libraries(osrm-components ${TBB_LIBRARIES} ${BOOST_BASE_LIBRARIES} ${UTIL_LIBRARIES}) 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} ${TBB_LIBRARIES}) - - install(TARGETS osrm-io-benchmark DESTINATION bin) -endif() +add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $) +target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES}) +install(TARGETS osrm-io-benchmark DESTINATION bin) if (ENABLE_ASSERTIONS) message(STATUS "Enabling assertions") @@ -586,47 +533,14 @@ 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) -if (BUILD_ROUTED) - set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) -endif() +set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) -file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h) -file(GLOB LibraryGlob include/osrm/*.hpp) -file(GLOB ParametersGlob include/engine/api/*_parameters.hpp) -set(ApiHeader include/engine/api/base_result.hpp) -set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp) -set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/bearing.hpp) -set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp) -set(PartitionerHeader include/partitioner/partitioner.hpp include/partitioner/partitioner_config.hpp) -set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp) -set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp) -install(FILES ${EngineHeader} DESTINATION include/osrm/engine) -install(FILES ${UtilHeader} DESTINATION include/osrm/util) -install(FILES ${StorageHeader} DESTINATION include/osrm/storage) -install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor) -install(FILES ${PartitionerHeader} DESTINATION include/osrm/partitioner) -install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor) -install(FILES ${LibraryGlob} DESTINATION include/osrm) -install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api) -install(FILES ${ApiHeader} DESTINATION include/osrm/engine/api) -install(FILES ${FlatbuffersGlob} DESTINATION include/flatbuffers) install(TARGETS osrm-extract DESTINATION bin) install(TARGETS osrm-partition DESTINATION bin) install(TARGETS osrm-customize DESTINATION bin) install(TARGETS osrm-contract DESTINATION bin) install(TARGETS osrm-datastore 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) -install(TARGETS osrm_customize DESTINATION lib) -install(TARGETS osrm_update DESTINATION lib) -install(TARGETS osrm_contract DESTINATION lib) -install(TARGETS osrm_store DESTINATION lib) -install(TARGETS osrm_guidance DESTINATION lib) - +install(TARGETS osrm-routed DESTINATION bin) # Install profiles and support library to /usr/local/share/osrm/profiles by default set(DefaultProfilesDir profiles) @@ -636,9 +550,6 @@ install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm) set(DefaultProfilesDir data) install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm) -# Setup exporting variables for pkgconfig and subproject -# - if(BUILD_PACKAGE) include(CPackConfig) include(CPack) @@ -676,16 +587,17 @@ 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) -# 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 & TBB define 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.*" OR "${engine_lib}" MATCHES "^TBB.*") - list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$") - else() - list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}") - endif() -endforeach(engine_lib) + +if (NOT ENABLE_CONAN) + foreach(engine_lib ${ENGINE_LIBRARIES}) + if("${engine_lib}" MATCHES "^boost.*" OR "${engine_lib}" MATCHES "^TBB.*") + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$") + else() + list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}") + endif() + endforeach(engine_lib) +endif() + JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY) @@ -715,7 +627,6 @@ if (ENABLE_NODE_BINDINGS) add_subdirectory(src/nodejs) endif() - if (ENABLE_FUZZING) # Requires libosrm being built with sanitizers; make configurable and default to ubsan set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing") @@ -749,4 +660,3 @@ foreach(header ${headers_to_check}) endforeach() add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources}) set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir}) - diff --git a/README.md b/README.md index 671af2478d7..c691542b734 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Pre-process the extract with the car profile and start a routing engine HTTP ser docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed" -The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host. +The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host. Noting that this process can take a long time to complete with little changes on the terminal output, for example, a Mexico's OSM file of 550.7MB took around 30 minutes to finish extraction and generate edge-expanded graph representation. docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed" docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-customize /data/berlin-latest.osrm || echo "osrm-customize failed" diff --git a/cmake/conan.cmake b/cmake/conan.cmake deleted file mode 100644 index 7c78f74154e..00000000000 --- a/cmake/conan.cmake +++ /dev/null @@ -1,1026 +0,0 @@ -# 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 1950) - 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/conanfile.py b/conanfile.py new file mode 100644 index 00000000000..8f0011705b9 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps + +class OsrmConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + + def requirements(self): + self.requires("boost/1.85.0") + self.requires("bzip2/1.0.8") + self.requires("expat/2.6.2") + self.requires("lua/5.4.6") + self.requires("onetbb/2021.12.0") + self.requires("xz_utils/5.4.5") + self.requires("zlib/1.3.1") + + def configure(self): + self.options["boost"].without_python = True + self.options["boost"].without_coroutine = True + self.options["boost"].without_stacktrace = True + self.options["boost"].without_cobalt = True + self.options["bzip2"].shared = True + self.options["xz-utils"].shared = True + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CXX_STANDARD"] = "20" + tc.variables["Bzip2_ROOT"] = "${CMAKE_BINARY_DIR}" + tc.variables["LZMA_ROOT"] = "${CMAKE_BINARY_DIR}" + tc.variables["TBB_ROOT"] = "${CONAN_ONETBB_ROOT}" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() diff --git a/docker/Dockerfile-alpine b/docker/Dockerfile-alpine index fe22173f9ac..497c71514f7 100644 --- a/docker/Dockerfile-alpine +++ b/docker/Dockerfile-alpine @@ -1,20 +1,34 @@ -FROM alpine:3.20.0 as alpine-mimalloc +FROM alpine:3.21.2 AS alpine-mimalloc -RUN apk add --no-cache mimalloc +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + boost-iostreams \ + boost-program_options \ + boost-thread \ + mimalloc ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2 ENV MIMALLOC_LARGE_OS_PAGES=1 -FROM alpine-mimalloc as builder +FROM alpine-mimalloc AS builder ARG DOCKER_TAG ARG BUILD_CONCURRENCY -RUN mkdir -p /src && mkdir -p /opt -RUN apk add --no-cache \ - cmake make git clang libbz2 libxml2 \ - boost-dev boost-program_options boost-filesystem boost-iostreams boost-thread \ - lua5.4-dev onetbb-dev expat-dev +RUN mkdir -p /src /opt && \ + apk add --no-cache \ + boost-dev \ + boost-filesystem \ + clang \ + cmake \ + expat-dev \ + git \ + libbz2 \ + libxml2 \ + lua5.4-dev \ + make \ + onetbb-dev COPY . /src WORKDIR /src @@ -27,11 +41,10 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ cd build && \ BUILD_TYPE="Release" && \ ENABLE_ASSERTIONS="Off" && \ - BUILD_TOOLS="Off" && \ case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \ - case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \ - echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \ - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=OFF && \ + case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On";; esac && \ + echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS}" && \ + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DENABLE_LTO=OFF && \ make -j${NPROC} install && \ cd ../profiles && \ cp -r * /opt && \ @@ -39,16 +52,18 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ rm -rf /src -# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds +# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds # Only the content below ends up in the image, this helps remove /src from the image (which is large) -FROM alpine-mimalloc as runstage +FROM alpine-mimalloc AS runstage COPY --from=builder /usr/local /usr/local COPY --from=builder /opt /opt RUN apk add --no-cache \ - boost-program_options boost-date_time boost-iostreams boost-thread \ - expat lua5.4 onetbb && \ + boost-date_time \ + expat \ + lua5.4 \ + onetbb && \ ldconfig /usr/local/lib RUN /usr/local/bin/osrm-extract --help && \ diff --git a/docker/Dockerfile-debian b/docker/Dockerfile-debian index 8b51c516855..43500e5115a 100644 --- a/docker/Dockerfile-debian +++ b/docker/Dockerfile-debian @@ -1,21 +1,24 @@ -FROM debian:bookworm-slim as builder +FROM debian:bookworm-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 ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \ - libzip-dev libboost1.81-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 - -RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ - ldconfig /usr/local/lib && \ - git clone --branch v2021.12.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \ - cd oneTBB && \ - mkdir build && \ - cd build && \ - cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \ - cmake --build . && \ - cmake --install . +RUN mkdir -p /src /opt && \ + apt-get update && \ + apt-get -y --no-install-recommends --no-install-suggests install \ + ca-certificates \ + cmake \ + g++ \ + gcc \ + git \ + libboost1.81-all-dev \ + libbz2-dev \ + liblua5.4-dev \ + libtbb-dev \ + libxml2-dev \ + libzip-dev \ + lua5.4 \ + make \ + pkg-config COPY . /src WORKDIR /src @@ -29,11 +32,10 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ cd build && \ BUILD_TYPE="Release" && \ ENABLE_ASSERTIONS="Off" && \ - BUILD_TOOLS="Off" && \ case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \ - case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \ - echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \ - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \ + case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On";; esac && \ + echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS}" && \ + cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DENABLE_LTO=On && \ make -j${NPROC} install && \ cd ../profiles && \ cp -r * /opt && \ @@ -41,19 +43,24 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \ rm -rf /src -# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds +# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#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:bookworm-slim as runstage +FROM debian:bookworm-slim AS runstage COPY --from=builder /usr/local /usr/local COPY --from=builder /opt /opt RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - libboost-program-options1.81.0 libboost-date-time1.81.0 libboost-iostreams1.81.0 libboost-thread1.81.0 \ - expat liblua5.4-0 && \ + apt-get install -y --no-install-recommends --no-install-suggests \ + expat \ + libboost-date-time1.81.0 \ + libboost-iostreams1.81.0 \ + libboost-program-options1.81.0 \ + libboost-thread1.81.0 \ + liblua5.4-0 \ + libtbb12 && \ rm -rf /var/lib/apt/lists/* && \ -# add /usr/local/lib to ldconfig to allow loading libraries from there +# Add /usr/local/lib to ldconfig to allow loading libraries from there ldconfig /usr/local/lib RUN /usr/local/bin/osrm-extract --help && \ @@ -64,4 +71,4 @@ RUN /usr/local/bin/osrm-extract --help && \ WORKDIR /opt -EXPOSE 5000 +EXPOSE 5000 \ No newline at end of file diff --git a/docs/libosrm.md b/docs/libosrm.md deleted file mode 100644 index 9b84180f1f3..00000000000 --- a/docs/libosrm.md +++ /dev/null @@ -1,33 +0,0 @@ -## Introduction - -OSRM can be used as a library (libosrm) via C++ instead of using it through the HTTP interface and `osrm-routed`. This allows for fine-tuning OSRM and has much less overhead. Here is a quick introduction into how to use `libosrm` in the upcoming v5 release. - -Take a look at the example code that lives in the [example directory](https://github.com/Project-OSRM/osrm-backend/tree/master/example). Here is all you ever wanted to know about `libosrm`, that is a short description of what the types do and where to find documentation on it: - -## Important interface objects - -- [`EngineConfig`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/engine_config.hpp) - for initializing an OSRM instance we can configure certain properties and constraints. E.g. the storage config is the base path such as `france.osm.osrm` from which we derive and load `france.osm.osrm.*` auxiliary files. This also lets you set constraints such as the maximum number of locations allowed for specific services. - -- [`OSRM`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/osrm/osrm.hpp) - this is the main Routing Machine type with functions such as `Route` and `Table`. You initialize it with a `EngineConfig`. It does all the heavy lifting for you. Each function takes its own parameters, e.g. the `Route` function takes `RouteParameters`, and a out-reference to a JSON result that gets filled. The return value is a `Status`, indicating error or success. - -- [`Status`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/status.hpp) - this is a type wrapping `Error` or `Ok` for indicating error or success, respectively. - -- [`TableParameters`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/table_parameters.hpp) - this is an example of parameter types the Routing Machine functions expect. In this case `Table` expects its own parameters as `TableParameters`. You can see it wrapping two vectors, sources and destinations --- these are indices into your coordinates for the table service to construct a matrix from (empty sources or destinations means: use all of them). If you ask yourself where coordinates come from, you can see `TableParameters` inheriting from `BaseParameters`. - -- [`BaseParameter`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/base_parameters.hpp) - this most importantly holds coordinates (and a few other optional properties that you don't need for basic usage); the specific parameter types inherit from `BaseParameters` to get these member attributes. That means your `TableParameters` type has `coordinates`, `sources` and `destination` member attributes (and a few other that we ignore for now). - -- [`Coordinate`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp) - this is a wrapper around a (longitude, latitude) pair. We really don't care about (lon,lat) vs (lat, lon) but we don't want you to accidentally mix them up, so both latitude and longitude are strictly typed wrappers around integers (fixed notation such as `13423240`) and floating points (floating notation such as `13.42324`). - -- [Parameters for other services](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api) - here are all other `*Parameters` you need for other Routing Machine services. - -- [JSON](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/json_container.hpp) - this is a sum type resembling JSON. The Routing Machine service functions take a out-ref to a JSON result and fill it accordingly. It is currently implemented using [mapbox/variant](https://github.com/mapbox/variant) which is similar to [Boost.Variant](http://www.boost.org/doc/libs/1_55_0/doc/html/variant.html). There are two ways to work with this sum type: either provide a visitor that acts on each type on visitation or use the `get` function in case you're sure about the structure. The JSON structure is written down in the [HTTP API](#http-api). - -## Example - -See [the example folder](https://github.com/Project-OSRM/osrm-backend/tree/master/example) in the OSRM repository. - -## Workflow - - - Create an `OSRM` instance initialized with a `EngineConfig` - - Call the service function on the `OSRM` object providing service specific `*Parameters` - - Check the return code and use the JSON result diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 1ec0ff9cc74..907734b45c9 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -12,7 +12,7 @@ endif() project(osrm-example C CXX) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -24,6 +24,8 @@ else() message(STATUS "Building on a 32 bit system") endif() +find_package(Boost REQUIRED CONFIG COMPONENTS date_time iostreams thread) + link_directories(${LibOSRM_LIBRARY_DIRS}) add_executable(osrm-example example.cpp) diff --git a/example/cmake/FindLibOSRM.cmake b/example/cmake/FindLibOSRM.cmake deleted file mode 100644 index 50a5641a192..00000000000 --- a/example/cmake/FindLibOSRM.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# - Try to find LibOSRM -# Once done this will define -# LibOSRM_FOUND - System has LibOSRM -# LibOSRM_LIBRARIES - The libraries and ldflags needed to use LibOSRM -# LibOSRM_DEPENDENT_LIBRARIES - The libraries and ldflags need to link LibOSRM dependencies -# LibOSRM_LIBRARY_DIRS - The libraries paths needed to find LibOSRM -# LibOSRM_CXXFLAGS - Compiler switches required for using LibOSRM - -find_package(PkgConfig) -pkg_search_module(PC_LibOSRM QUIET libosrm) - -function(JOIN VALUES GLUE OUTPUT) - string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}") - set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE) -endfunction() - -list(REMOVE_ITEM PC_LibOSRM_CFLAGS " ") -JOIN("${PC_LibOSRM_CFLAGS}" " " output) - -set(LibOSRM_CXXFLAGS ${output}) -set(LibOSRM_LIBRARY_DIRS ${PC_LibOSRM_LIBRARY_DIRS}) - -find_path(LibOSRM_INCLUDE_DIR osrm/osrm.hpp - PATH_SUFFIXES osrm include/osrm include - HINTS ${PC_LibOSRM_INCLUDEDIR} ${PC_LibOSRM_INCLUDE_DIRS} - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /opt/local - /opt) - -find_library(TEST_LibOSRM_STATIC_LIBRARY Names osrm.lib libosrm.a - PATH_SUFFIXES osrm lib/osrm lib - HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS} - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /opt/local - /opt) -find_library(TEST_LibOSRM_DYNAMIC_LIBRARY Names libosrm.dylib libosrm.so - PATH_SUFFIXES osrm lib/osrm lib - HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS} - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /opt/local - /opt) - -set(LibOSRM_DEPENDENT_LIBRARIES ${PC_LibOSRM_STATIC_LDFLAGS}) -set(LibOSRM_LIBRARIES ${PC_LibOSRM_LDFLAGS}) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LIBOSRM_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(LibOSRM DEFAULT_MSG - LibOSRM_LIBRARY_DIRS - LibOSRM_CXXFLAGS - LibOSRM_LIBRARIES - LibOSRM_DEPENDENT_LIBRARIES - LibOSRM_INCLUDE_DIR) diff --git a/example/cmake/FindTBB.cmake b/example/cmake/FindTBB.cmake deleted file mode 120000 index f51bdf7429c..00000000000 --- a/example/cmake/FindTBB.cmake +++ /dev/null @@ -1 +0,0 @@ -../../cmake/FindTBB.cmake \ No newline at end of file diff --git a/example/example.cpp b/example/example.cpp deleted file mode 100644 index 1d08eb9fce4..00000000000 --- a/example/example.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "osrm/match_parameters.hpp" -#include "osrm/nearest_parameters.hpp" -#include "osrm/route_parameters.hpp" -#include "osrm/table_parameters.hpp" -#include "osrm/trip_parameters.hpp" - -#include "osrm/coordinate.hpp" -#include "osrm/engine_config.hpp" -#include "osrm/json_container.hpp" - -#include "osrm/osrm.hpp" -#include "osrm/status.hpp" - -#include -#include -#include -#include - -#include - -int main(int argc, const char *argv[]) -{ - if (argc < 2) - { - std::cerr << "Usage: " << argv[0] << " data.osrm\n"; - return EXIT_FAILURE; - } - - using namespace osrm; - - // Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore - EngineConfig config; - - config.storage_config = {argv[1]}; - config.use_shared_memory = false; - - // We support two routing speed up techniques: - // - Contraction Hierarchies (CH): requires extract+contract pre-processing - // - Multi-Level Dijkstra (MLD): requires extract+partition+customize pre-processing - // - // config.algorithm = EngineConfig::Algorithm::CH; - config.algorithm = EngineConfig::Algorithm::MLD; - - // Routing machine with several services (such as Route, Table, Nearest, Trip, Match) - const OSRM osrm{config}; - - // The following shows how to use the Route service; configure this service - RouteParameters params; - - // Route in monaco - params.coordinates.push_back({util::FloatLongitude{7.419758}, util::FloatLatitude{43.731142}}); - params.coordinates.push_back({util::FloatLongitude{7.419505}, util::FloatLatitude{43.736825}}); - - // Response is in JSON format - engine::api::ResultT result = json::Object(); - - // Execute routing request, this does the heavy lifting - const auto status = osrm.Route(params, result); - - auto &json_result = std::get(result); - if (status == Status::Ok) - { - auto &routes = std::get(json_result.values["routes"]); - - // Let's just use the first route - auto &route = std::get(routes.values.at(0)); - const auto distance = std::get(route.values["distance"]).value; - const auto duration = std::get(route.values["duration"]).value; - - // Warn users if extract does not contain the default coordinates from above - if (distance == 0 || duration == 0) - { - std::cout << "Note: distance or duration is zero. "; - std::cout << "You are probably doing a query outside of the OSM extract.\n\n"; - } - - std::cout << "Distance: " << distance << " meter\n"; - std::cout << "Duration: " << duration << " seconds\n"; - return EXIT_SUCCESS; - } - else if (status == Status::Error) - { - const auto code = std::get(json_result.values["code"]).value; - const auto message = std::get(json_result.values["message"]).value; - - std::cout << "Code: " << code << "\n"; - std::cout << "Message: " << code << "\n"; - return EXIT_FAILURE; - } -} diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index 30889e21825..d431ec5617e 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "updater/updater_config.hpp" #include -#include namespace osrm::contractor { diff --git a/include/contractor/graph_contractor.hpp b/include/contractor/graph_contractor.hpp index 8592d75b17c..0cf490c61ab 100644 --- a/include/contractor/graph_contractor.hpp +++ b/include/contractor/graph_contractor.hpp @@ -5,7 +5,6 @@ #include "util/filtered_graph.hpp" -#include #include namespace osrm::contractor diff --git a/include/customizer/cell_customizer.hpp b/include/customizer/cell_customizer.hpp index 00d03163a7d..69f9017e815 100644 --- a/include/customizer/cell_customizer.hpp +++ b/include/customizer/cell_customizer.hpp @@ -100,9 +100,9 @@ class CellCustomizer distances.front() = inserted ? heap.GetData(destination).distance : INVALID_EDGE_DISTANCE; - weights.advance_begin(1); - durations.advance_begin(1); - distances.advance_begin(1); + weights.advance(1); + durations.advance(1); + distances.advance(1); } BOOST_ASSERT(weights.empty()); BOOST_ASSERT(durations.empty()); diff --git a/include/customizer/customizer_config.hpp b/include/customizer/customizer_config.hpp index 11f786c468a..8068d5c47dc 100644 --- a/include/customizer/customizer_config.hpp +++ b/include/customizer/customizer_config.hpp @@ -1,9 +1,7 @@ #ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP #define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP -#include #include -#include #include "storage/io_config.hpp" #include "updater/updater_config.hpp" diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index 0e2a9edbfdf..e402e46f435 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -136,7 +136,7 @@ class NearestAPI final : public BaseAPI forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id); auto osm_node_id = - facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position)); + facade.GetOSMNodeIDOfNode(forward_geometry[phantom_node.fwd_segment_position]); to_node = static_cast(osm_node_id); } @@ -146,14 +146,14 @@ class NearestAPI final : public BaseAPI const auto geometry_id = facade.GetGeometryIndex(segment_id).id; const auto geometry = facade.GetUncompressedForwardGeometry(geometry_id); auto osm_node_id = - facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1)); + facade.GetOSMNodeIDOfNode(geometry[phantom_node.fwd_segment_position + 1]); from_node = static_cast(osm_node_id); } else if (phantom_node.forward_segment_id.enabled && phantom_node.fwd_segment_position > 0) { // In the case of one way, rely on forward segment only auto osm_node_id = - facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position - 1)); + facade.GetOSMNodeIDOfNode(forward_geometry[phantom_node.fwd_segment_position - 1]); from_node = static_cast(osm_node_id); } diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index fb1830ce361..08431a2cf5d 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -27,6 +27,7 @@ #include "util/integer_range.hpp" #include "util/json_util.hpp" +#include #include #include #include diff --git a/include/engine/api/trip_parameters.hpp b/include/engine/api/trip_parameters.hpp index cc3f4d938a2..8d28e880f12 100644 --- a/include/engine/api/trip_parameters.hpp +++ b/include/engine/api/trip_parameters.hpp @@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "engine/api/route_parameters.hpp" #include -#include namespace osrm::engine::api { diff --git a/include/engine/base64.hpp b/include/engine/base64.hpp index 042aa6d59cd..8af51b73973 100644 --- a/include/engine/base64.hpp +++ b/include/engine/base64.hpp @@ -3,17 +3,13 @@ #include #include -#include -#include #include #include -#include #include #include #include -#include namespace osrm { diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 466c566942d..ca380ecefea 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -603,6 +602,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade auto found_range = std::equal_range( m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{}); + results.reserve(std::distance(found_range.first, found_range.second)); + std::for_each(found_range.first, found_range.second, [&](const auto &override) diff --git a/include/engine/datafacade/datafacade_base.hpp b/include/engine/datafacade/datafacade_base.hpp index ecf25577a33..b42584b3b4f 100644 --- a/include/engine/datafacade/datafacade_base.hpp +++ b/include/engine/datafacade/datafacade_base.hpp @@ -29,16 +29,13 @@ #include "util/typedefs.hpp" #include "osrm/coordinate.hpp" - -#include -#include #include #include #include +#include #include #include -#include #include namespace osrm::engine::datafacade @@ -50,20 +47,21 @@ class BaseDataFacade using RTreeLeaf = extractor::EdgeBasedNodeSegment; using NodeForwardRange = - boost::iterator_range; - using NodeReverseRange = boost::reversed_range; + std::ranges::subrange; + using NodeReverseRange = std::ranges::reverse_view; using WeightForwardRange = - boost::iterator_range; - using WeightReverseRange = boost::reversed_range; + std::ranges::subrange; + + using WeightReverseRange = std::ranges::reverse_view; using DurationForwardRange = - boost::iterator_range; - using DurationReverseRange = boost::reversed_range; + std::ranges::subrange; + using DurationReverseRange = std::ranges::reverse_view; using DatasourceForwardRange = - boost::iterator_range; - using DatasourceReverseRange = boost::reversed_range; + std::ranges::subrange; + using DatasourceReverseRange = std::ranges::reverse_view; BaseDataFacade() {} virtual ~BaseDataFacade() {} diff --git a/include/engine/datafacade/mmap_memory_allocator.hpp b/include/engine/datafacade/mmap_memory_allocator.hpp index 3acb5caa4d6..6d7a99a16ae 100644 --- a/include/engine/datafacade/mmap_memory_allocator.hpp +++ b/include/engine/datafacade/mmap_memory_allocator.hpp @@ -9,7 +9,6 @@ #include -#include #include namespace osrm::engine::datafacade diff --git a/include/engine/datafacade_factory.hpp b/include/engine/datafacade_factory.hpp index d255b394dcf..10a7e35cc47 100644 --- a/include/engine/datafacade_factory.hpp +++ b/include/engine/datafacade_factory.hpp @@ -12,7 +12,6 @@ #include "storage/shared_datatype.hpp" -#include #include #include diff --git a/include/engine/engine.hpp b/include/engine/engine.hpp index 3e479e5cd7d..9c21aa04d35 100644 --- a/include/engine/engine.hpp +++ b/include/engine/engine.hpp @@ -21,7 +21,6 @@ #include "util/json_container.hpp" #include -#include namespace osrm::engine { diff --git a/include/engine/engine_config.hpp b/include/engine/engine_config.hpp index e46f2c5e2ba..7467a014d87 100644 --- a/include/engine/engine_config.hpp +++ b/include/engine/engine_config.hpp @@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "osrm/datasets.hpp" #include -#include #include namespace osrm::engine diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index 915dfec3e63..db71c4bdf13 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include namespace osrm::engine @@ -394,7 +393,7 @@ template class GeospatialQuery alias_cast(forward_durations[data.fwd_segment_position]); EdgeDistance forward_distance = to_alias(util::coordinate_calculation::greatCircleDistance( - datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position)), + datafacade.GetCoordinateOfNode(forward_geometry[data.fwd_segment_position]), point_on_segment)); const auto reverse_weight_offset = alias_cast( @@ -426,7 +425,7 @@ template class GeospatialQuery EdgeDistance reverse_distance = to_alias(util::coordinate_calculation::greatCircleDistance( point_on_segment, - datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position + 1)))); + datafacade.GetCoordinateOfNode(forward_geometry[data.fwd_segment_position + 1]))); ratio = std::min(1.0, std::max(0.0, ratio)); if (data.forward_segment_id.id != SPECIAL_SEGMENTID) diff --git a/include/engine/guidance/assemble_geometry.hpp b/include/engine/guidance/assemble_geometry.hpp index e6925c51f69..8783a8b8beb 100644 --- a/include/engine/guidance/assemble_geometry.hpp +++ b/include/engine/guidance/assemble_geometry.hpp @@ -13,7 +13,6 @@ #include #include -#include #include namespace osrm::engine::guidance @@ -61,7 +60,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade, const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id; const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id); - geometry.node_ids.push_back(source_geometry(source_segment_start_coordinate)); + geometry.node_ids.push_back(source_geometry[source_segment_start_coordinate]); auto cumulative_distance = 0.; auto current_distance = 0.; @@ -142,7 +141,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade, LegGeometry::Annotation{current_distance, duration, weight, - forward_datasources(target_node.fwd_segment_position)}); + forward_datasources[target_node.fwd_segment_position]}); } else { @@ -154,7 +153,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade, from_alias(reversed_target ? target_node.reverse_weight : target_node.forward_weight) / facade.GetWeightMultiplier(), - forward_datasources(target_node.fwd_segment_position)}); + forward_datasources[target_node.fwd_segment_position]}); } geometry.segment_offsets.push_back(geometry.locations.size()); @@ -168,7 +167,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade, const auto target_segment_end_coordinate = target_node.fwd_segment_position + (reversed_target ? 0 : 1); const auto target_geometry = facade.GetUncompressedForwardGeometry(target_geometry_id); - geometry.node_ids.push_back(target_geometry(target_segment_end_coordinate)); + geometry.node_ids.push_back(target_geometry[target_segment_end_coordinate]); BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1); BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size()); diff --git a/include/engine/guidance/assemble_leg.hpp b/include/engine/guidance/assemble_leg.hpp index 1906ae50f70..2ff532e7a6c 100644 --- a/include/engine/guidance/assemble_leg.hpp +++ b/include/engine/guidance/assemble_leg.hpp @@ -20,7 +20,6 @@ #include #include #include -#include #include namespace osrm::engine::guidance diff --git a/include/engine/guidance/route_step.hpp b/include/engine/guidance/route_step.hpp index 87037381710..89e2ab14313 100644 --- a/include/engine/guidance/route_step.hpp +++ b/include/engine/guidance/route_step.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include namespace osrm::engine::guidance { @@ -220,14 +220,14 @@ inline auto RouteStep::LanesToTheLeft() const { const auto &description = intersections.front().lane_description; LaneID num_lanes_left = NumLanesToTheLeft(); - return boost::make_iterator_range(description.begin(), description.begin() + num_lanes_left); + return std::ranges::subrange(description.begin(), description.begin() + num_lanes_left); } inline auto RouteStep::LanesToTheRight() const { const auto &description = intersections.front().lane_description; LaneID num_lanes_right = NumLanesToTheRight(); - return boost::make_iterator_range(description.end() - num_lanes_right, description.end()); + return std::ranges::subrange(description.end() - num_lanes_right, description.end()); } } // namespace osrm::engine::guidance diff --git a/include/engine/guidance/step_maneuver.hpp b/include/engine/guidance/step_maneuver.hpp index 91131be3dc3..9a8d6754bbb 100644 --- a/include/engine/guidance/step_maneuver.hpp +++ b/include/engine/guidance/step_maneuver.hpp @@ -5,8 +5,6 @@ #include "util/coordinate.hpp" #include -#include -#include namespace osrm::engine::guidance { diff --git a/include/engine/map_matching/bayes_classifier.hpp b/include/engine/map_matching/bayes_classifier.hpp index 7d89e3d645e..96cb86523bf 100644 --- a/include/engine/map_matching/bayes_classifier.hpp +++ b/include/engine/map_matching/bayes_classifier.hpp @@ -4,7 +4,6 @@ #include #include -#include #include diff --git a/include/engine/plugins/match.hpp b/include/engine/plugins/match.hpp index bfad1b7787d..4df5a7e576a 100644 --- a/include/engine/plugins/match.hpp +++ b/include/engine/plugins/match.hpp @@ -7,8 +7,6 @@ #include "util/json_util.hpp" -#include - namespace osrm::engine::plugins { diff --git a/include/engine/plugins/tile.hpp b/include/engine/plugins/tile.hpp index c5a85f6155c..223f6d1e309 100644 --- a/include/engine/plugins/tile.hpp +++ b/include/engine/plugins/tile.hpp @@ -5,9 +5,6 @@ #include "engine/plugins/plugin_base.hpp" #include "engine/routing_algorithms.hpp" -#include -#include - /* * This plugin generates Mapbox Vector tiles that show the internal * routing geometry and speed values on all road segments. diff --git a/include/engine/plugins/trip.hpp b/include/engine/plugins/trip.hpp index a08eaeed0d7..6a5a54d6725 100644 --- a/include/engine/plugins/trip.hpp +++ b/include/engine/plugins/trip.hpp @@ -8,14 +8,9 @@ #include "util/json_container.hpp" -#include - #include #include #include -#include -#include -#include #include namespace osrm::engine::plugins diff --git a/include/engine/plugins/viaroute.hpp b/include/engine/plugins/viaroute.hpp index 56040a58fe9..2d1d61c9481 100644 --- a/include/engine/plugins/viaroute.hpp +++ b/include/engine/plugins/viaroute.hpp @@ -11,9 +11,6 @@ #include #include -#include -#include -#include namespace osrm::engine::plugins { diff --git a/include/engine/polyline_compressor.hpp b/include/engine/polyline_compressor.hpp index af58b04223d..87d434b5aba 100644 --- a/include/engine/polyline_compressor.hpp +++ b/include/engine/polyline_compressor.hpp @@ -3,8 +3,6 @@ #include "util/coordinate.hpp" -#include -#include #include #include diff --git a/include/engine/routing_algorithms/routing_base.hpp b/include/engine/routing_algorithms/routing_base.hpp index d4dcdac5867..20821e6c97a 100644 --- a/include/engine/routing_algorithms/routing_base.hpp +++ b/include/engine/routing_algorithms/routing_base.hpp @@ -16,15 +16,11 @@ #include #include -#include #include -#include #include -#include #include #include -#include #include namespace osrm::engine::routing_algorithms diff --git a/include/engine/trip/trip_brute_force.hpp b/include/engine/trip/trip_brute_force.hpp index a55e41ee5d4..ab7f4ceb417 100644 --- a/include/engine/trip/trip_brute_force.hpp +++ b/include/engine/trip/trip_brute_force.hpp @@ -10,9 +10,7 @@ #include #include #include -#include #include -#include #include namespace osrm::engine::trip diff --git a/include/engine/trip/trip_farthest_insertion.hpp b/include/engine/trip/trip_farthest_insertion.hpp index 46ace93e3b5..a912585f5c2 100644 --- a/include/engine/trip/trip_farthest_insertion.hpp +++ b/include/engine/trip/trip_farthest_insertion.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include namespace osrm::engine::trip diff --git a/include/engine/trip/trip_nearest_neighbour.hpp b/include/engine/trip/trip_nearest_neighbour.hpp index 6f798270fb0..099b72dfbd9 100644 --- a/include/engine/trip/trip_nearest_neighbour.hpp +++ b/include/engine/trip/trip_nearest_neighbour.hpp @@ -9,8 +9,6 @@ #include #include -#include -#include #include namespace osrm::engine::trip diff --git a/include/extractor/class_data.hpp b/include/extractor/class_data.hpp index 87945a0b0b0..83aa9669fcb 100644 --- a/include/extractor/class_data.hpp +++ b/include/extractor/class_data.hpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include namespace osrm::extractor { diff --git a/include/extractor/compressed_edge_container.hpp b/include/extractor/compressed_edge_container.hpp index 2bc3cd15715..176be1b7513 100644 --- a/include/extractor/compressed_edge_container.hpp +++ b/include/extractor/compressed_edge_container.hpp @@ -7,7 +7,6 @@ #include -#include #include namespace osrm::extractor diff --git a/include/extractor/edge_based_graph_factory.hpp b/include/extractor/edge_based_graph_factory.hpp index 9c66c35ca08..56aec7392c7 100644 --- a/include/extractor/edge_based_graph_factory.hpp +++ b/include/extractor/edge_based_graph_factory.hpp @@ -25,14 +25,8 @@ #include "storage/io.hpp" #include "traffic_signals.hpp" -#include -#include #include -#include -#include -#include #include -#include #include #include diff --git a/include/extractor/extraction_turn.hpp b/include/extractor/extraction_turn.hpp index f1bb16a0f2d..4dafd823cb9 100644 --- a/include/extractor/extraction_turn.hpp +++ b/include/extractor/extraction_turn.hpp @@ -6,7 +6,6 @@ #include -#include #include namespace osrm::extractor diff --git a/include/extractor/extraction_way.hpp b/include/extractor/extraction_way.hpp index 5f6fe960021..2f24bd0420b 100644 --- a/include/extractor/extraction_way.hpp +++ b/include/extractor/extraction_way.hpp @@ -7,7 +7,6 @@ #include "util/typedefs.hpp" #include -#include namespace osrm::extractor { diff --git a/include/extractor/extractor_config.hpp b/include/extractor/extractor_config.hpp index 15df396dc13..5e733ed2011 100644 --- a/include/extractor/extractor_config.hpp +++ b/include/extractor/extractor_config.hpp @@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "storage/io_config.hpp" -#include #include #include diff --git a/include/extractor/files.hpp b/include/extractor/files.hpp index 2c90d3a046d..600f028d556 100644 --- a/include/extractor/files.hpp +++ b/include/extractor/files.hpp @@ -16,8 +16,6 @@ #include "util/range_table.hpp" #include "util/serialization.hpp" -#include - namespace osrm::extractor::files { diff --git a/include/extractor/graph_compressor.hpp b/include/extractor/graph_compressor.hpp index 960bd64ff22..0e9a1070570 100644 --- a/include/extractor/graph_compressor.hpp +++ b/include/extractor/graph_compressor.hpp @@ -7,7 +7,6 @@ #include "traffic_signals.hpp" #include "util/node_based_graph.hpp" -#include #include #include diff --git a/include/extractor/internal_extractor_edge.hpp b/include/extractor/internal_extractor_edge.hpp index c9e072d60da..655d888c132 100644 --- a/include/extractor/internal_extractor_edge.hpp +++ b/include/extractor/internal_extractor_edge.hpp @@ -7,8 +7,6 @@ #include "util/typedefs.hpp" #include -#include -#include namespace osrm::extractor { diff --git a/include/extractor/intersection/intersection_edge.hpp b/include/extractor/intersection/intersection_edge.hpp index 9121e1b0eda..7cb95fac739 100644 --- a/include/extractor/intersection/intersection_edge.hpp +++ b/include/extractor/intersection/intersection_edge.hpp @@ -3,6 +3,7 @@ #include "util/typedefs.hpp" +#include #include namespace osrm::extractor::intersection diff --git a/include/extractor/intersection/intersection_view.hpp b/include/extractor/intersection/intersection_view.hpp index c1517c65f73..4eb60585602 100644 --- a/include/extractor/intersection/intersection_view.hpp +++ b/include/extractor/intersection/intersection_view.hpp @@ -15,9 +15,7 @@ #include #include -#include #include -#include #include #include diff --git a/include/extractor/intersection/mergable_road_detector.hpp b/include/extractor/intersection/mergable_road_detector.hpp index 4871ad8292e..1f02afb5675 100644 --- a/include/extractor/intersection/mergable_road_detector.hpp +++ b/include/extractor/intersection/mergable_road_detector.hpp @@ -14,9 +14,6 @@ #include "util/node_based_graph.hpp" #include "util/typedefs.hpp" -#include -#include -#include #include #include diff --git a/include/extractor/maneuver_override.hpp b/include/extractor/maneuver_override.hpp index 78eb31021b3..1688dcb1a48 100644 --- a/include/extractor/maneuver_override.hpp +++ b/include/extractor/maneuver_override.hpp @@ -11,8 +11,6 @@ #include "util/std_hash.hpp" #include "util/vector_view.hpp" -#include - #include namespace osrm::extractor diff --git a/include/extractor/maneuver_override_relation_parser.hpp b/include/extractor/maneuver_override_relation_parser.hpp index c6084ad70ec..168e37a1073 100644 --- a/include/extractor/maneuver_override_relation_parser.hpp +++ b/include/extractor/maneuver_override_relation_parser.hpp @@ -4,8 +4,6 @@ #include "maneuver_override.hpp" #include -#include -#include namespace osmium { diff --git a/include/extractor/node_based_graph_factory.hpp b/include/extractor/node_based_graph_factory.hpp index e3a5072857c..79b4b45cd34 100644 --- a/include/extractor/node_based_graph_factory.hpp +++ b/include/extractor/node_based_graph_factory.hpp @@ -12,9 +12,6 @@ #include "util/coordinate.hpp" #include "util/node_based_graph.hpp" -#include -#include -#include #include #include diff --git a/include/extractor/node_restriction_map.hpp b/include/extractor/node_restriction_map.hpp index 6c65a6592cb..4c812b2ca54 100644 --- a/include/extractor/node_restriction_map.hpp +++ b/include/extractor/node_restriction_map.hpp @@ -5,12 +5,6 @@ #include "restriction_graph.hpp" #include "util/typedefs.hpp" -#include - -#include -#include -#include - namespace osrm::extractor { @@ -26,7 +20,7 @@ template class NodeRestrictionMap // Find all restrictions applicable to (from,via,*) turns auto Restrictions(NodeID from, NodeID via) const { - return getRange(from, via) | boost::adaptors::filtered(index_filter); + return getRange(from, via) | std::views::filter(index_filter); }; // Find all restrictions applicable to (from,via,to) turns @@ -34,7 +28,7 @@ template class NodeRestrictionMap { const auto turnFilter = [this, to](const auto &restriction) { return index_filter(restriction) && restriction->IsTurnRestricted(to); }; - return getRange(from, via) | boost::adaptors::filtered(turnFilter); + return getRange(from, via) | std::views::filter(turnFilter); }; private: diff --git a/include/extractor/nodes_of_way.hpp b/include/extractor/nodes_of_way.hpp index 774d3fb7759..2853068d946 100644 --- a/include/extractor/nodes_of_way.hpp +++ b/include/extractor/nodes_of_way.hpp @@ -3,8 +3,6 @@ #include "util/typedefs.hpp" -#include -#include #include namespace osrm::extractor diff --git a/include/extractor/raster_source.hpp b/include/extractor/raster_source.hpp index 89d4381834e..3b6725016be 100644 --- a/include/extractor/raster_source.hpp +++ b/include/extractor/raster_source.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include diff --git a/include/extractor/restriction.hpp b/include/extractor/restriction.hpp index cfd3e17594e..40843d5c758 100644 --- a/include/extractor/restriction.hpp +++ b/include/extractor/restriction.hpp @@ -5,7 +5,6 @@ #include "util/coordinate.hpp" #include "util/opening_hours.hpp" #include "util/typedefs.hpp" -#include namespace osrm::extractor { diff --git a/include/extractor/restriction_graph.hpp b/include/extractor/restriction_graph.hpp index 4a4d61bf8ea..b9d5123fb85 100644 --- a/include/extractor/restriction_graph.hpp +++ b/include/extractor/restriction_graph.hpp @@ -1,12 +1,10 @@ #ifndef OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ #define OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ -#include - #include "util/node_based_graph.hpp" #include "util/std_hash.hpp" #include "util/typedefs.hpp" - +#include #include namespace osrm::extractor @@ -102,9 +100,9 @@ struct RestrictionGraph friend restriction_graph_details::transferBuilder; friend RestrictionGraph constructRestrictionGraph(const std::vector &); - using EdgeRange = boost::iterator_range::const_iterator>; + using EdgeRange = std::ranges::subrange::const_iterator>; using RestrictionRange = - boost::iterator_range::const_iterator>; + std::ranges::subrange::const_iterator>; using EdgeKey = std::pair; // Helper functions for iterating over node restrictions and edges diff --git a/include/extractor/road_classification.hpp b/include/extractor/road_classification.hpp index fad836557e9..679e1d1f6ca 100644 --- a/include/extractor/road_classification.hpp +++ b/include/extractor/road_classification.hpp @@ -2,7 +2,7 @@ #define OSRM_EXTRACTOR_CLASSIFICATION_DATA_HPP_ #include "extractor/intersection/constants.hpp" -#include + #include #include #include diff --git a/include/extractor/segment_data_container.hpp b/include/extractor/segment_data_container.hpp index abc5b7a170b..d012e5b9f61 100644 --- a/include/extractor/segment_data_container.hpp +++ b/include/extractor/segment_data_container.hpp @@ -8,13 +8,8 @@ #include "storage/shared_memory_ownership.hpp" #include "storage/tar_fwd.hpp" -#include -#include - -#include +#include #include -#include -#include namespace osrm::extractor { @@ -79,12 +74,12 @@ template class SegmentDataContainerImpl const auto begin = nodes.begin() + index[id]; const auto end = nodes.begin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseGeometry(const DirectionalGeometryID id) { - return boost::adaptors::reverse(GetForwardGeometry(id)); + return GetForwardGeometry(id) | std::views::reverse; } auto GetForwardDurations(const DirectionalGeometryID id) @@ -92,7 +87,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_durations.begin() + index[id] + 1; const auto end = fwd_durations.begin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseDurations(const DirectionalGeometryID id) @@ -100,7 +95,7 @@ template class SegmentDataContainerImpl const auto begin = rev_durations.begin() + index[id]; const auto end = rev_durations.begin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetForwardWeights(const DirectionalGeometryID id) @@ -108,7 +103,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_weights.begin() + index[id] + 1; const auto end = fwd_weights.begin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseWeights(const DirectionalGeometryID id) @@ -116,7 +111,7 @@ template class SegmentDataContainerImpl const auto begin = rev_weights.begin() + index[id]; const auto end = rev_weights.begin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetForwardDatasources(const DirectionalGeometryID id) @@ -124,7 +119,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_datasources.begin() + index[id] + 1; const auto end = fwd_datasources.begin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseDatasources(const DirectionalGeometryID id) @@ -132,7 +127,7 @@ template class SegmentDataContainerImpl const auto begin = rev_datasources.begin() + index[id]; const auto end = rev_datasources.begin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetForwardGeometry(const DirectionalGeometryID id) const @@ -140,12 +135,12 @@ template class SegmentDataContainerImpl const auto begin = nodes.cbegin() + index[id]; const auto end = nodes.cbegin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseGeometry(const DirectionalGeometryID id) const { - return boost::adaptors::reverse(GetForwardGeometry(id)); + return GetForwardGeometry(id) | std::views::reverse; } auto GetForwardDurations(const DirectionalGeometryID id) const @@ -153,7 +148,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_durations.cbegin() + index[id] + 1; const auto end = fwd_durations.cbegin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseDurations(const DirectionalGeometryID id) const @@ -161,7 +156,7 @@ template class SegmentDataContainerImpl const auto begin = rev_durations.cbegin() + index[id]; const auto end = rev_durations.cbegin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetForwardWeights(const DirectionalGeometryID id) const @@ -169,7 +164,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_weights.cbegin() + index[id] + 1; const auto end = fwd_weights.cbegin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseWeights(const DirectionalGeometryID id) const @@ -177,7 +172,7 @@ template class SegmentDataContainerImpl const auto begin = rev_weights.cbegin() + index[id]; const auto end = rev_weights.cbegin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetForwardDatasources(const DirectionalGeometryID id) const @@ -185,7 +180,7 @@ template class SegmentDataContainerImpl const auto begin = fwd_datasources.cbegin() + index[id] + 1; const auto end = fwd_datasources.cbegin() + index[id + 1]; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } auto GetReverseDatasources(const DirectionalGeometryID id) const @@ -193,7 +188,7 @@ template class SegmentDataContainerImpl const auto begin = rev_datasources.cbegin() + index[id]; const auto end = rev_datasources.cbegin() + index[id + 1] - 1; - return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); + return std::ranges::subrange(begin, end) | std::views::reverse; } auto GetNumberOfGeometries() const { return index.size() - 1; } diff --git a/include/extractor/serialization.hpp b/include/extractor/serialization.hpp index 98ebc7713ce..51f9a34f9c0 100644 --- a/include/extractor/serialization.hpp +++ b/include/extractor/serialization.hpp @@ -15,8 +15,6 @@ #include "storage/io.hpp" #include "storage/serialization.hpp" -#include - namespace osrm::extractor::serialization { diff --git a/include/extractor/turn_lane_types.hpp b/include/extractor/turn_lane_types.hpp index 88a124f54be..bfe5bed7f15 100644 --- a/include/extractor/turn_lane_types.hpp +++ b/include/extractor/turn_lane_types.hpp @@ -6,7 +6,6 @@ #include "util/std_hash.hpp" #include "util/typedefs.hpp" -#include #include #include #include //partial_sum diff --git a/include/extractor/turn_path.hpp b/include/extractor/turn_path.hpp index 5747f620cfe..4bd751ed454 100644 --- a/include/extractor/turn_path.hpp +++ b/include/extractor/turn_path.hpp @@ -4,6 +4,7 @@ #include "util/typedefs.hpp" #include +#include #include #include diff --git a/include/extractor/way_restriction_map.hpp b/include/extractor/way_restriction_map.hpp index 8c8cca4a511..3b4b2cc6cba 100644 --- a/include/extractor/way_restriction_map.hpp +++ b/include/extractor/way_restriction_map.hpp @@ -7,8 +7,6 @@ #include "util/typedefs.hpp" // to access the turn restrictions -#include -#include #include namespace osrm::extractor diff --git a/include/guidance/files.hpp b/include/guidance/files.hpp index e72a9f62284..8ca0bcbd002 100644 --- a/include/guidance/files.hpp +++ b/include/guidance/files.hpp @@ -8,8 +8,6 @@ #include "util/range_table.hpp" #include "util/serialization.hpp" -#include - #include #include #include diff --git a/include/guidance/intersection_handler.hpp b/include/guidance/intersection_handler.hpp index 5a7068e40a9..2f657ee05ed 100644 --- a/include/guidance/intersection_handler.hpp +++ b/include/guidance/intersection_handler.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include namespace osrm::guidance diff --git a/include/guidance/serialization.hpp b/include/guidance/serialization.hpp index 98e3032226e..45b4a19f11b 100644 --- a/include/guidance/serialization.hpp +++ b/include/guidance/serialization.hpp @@ -6,8 +6,6 @@ #include "storage/serialization.hpp" #include "storage/tar.hpp" -#include - namespace osrm::guidance::serialization { diff --git a/include/guidance/turn_analysis.hpp b/include/guidance/turn_analysis.hpp index d17ea0c03d3..56a3e5804bc 100644 --- a/include/guidance/turn_analysis.hpp +++ b/include/guidance/turn_analysis.hpp @@ -19,13 +19,7 @@ #include "util/node_based_graph.hpp" -#include - -#include -#include -#include #include -#include #include namespace osrm::guidance diff --git a/include/guidance/turn_handler.hpp b/include/guidance/turn_handler.hpp index 88b9daae04c..5d4348cab4a 100644 --- a/include/guidance/turn_handler.hpp +++ b/include/guidance/turn_handler.hpp @@ -12,7 +12,6 @@ #include #include -#include #include namespace osrm::guidance diff --git a/include/guidance/turn_lane_handler.hpp b/include/guidance/turn_lane_handler.hpp index 9994867a3eb..b7c9e1a042b 100644 --- a/include/guidance/turn_lane_handler.hpp +++ b/include/guidance/turn_lane_handler.hpp @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include #include diff --git a/include/nodejs/json_v8_renderer.hpp b/include/nodejs/json_v8_renderer.hpp index 9572744c2a0..75c6871981c 100644 --- a/include/nodejs/json_v8_renderer.hpp +++ b/include/nodejs/json_v8_renderer.hpp @@ -4,8 +4,6 @@ #include "osrm/json_container.hpp" #include -#include - namespace node_osrm { @@ -30,7 +28,7 @@ struct V8Renderer { Napi::Value child; std::visit(V8Renderer(env, child), keyValue.second); - obj.Set(keyValue.first, child); + obj.Set(keyValue.first.data(), child); } out = obj; } diff --git a/include/nodejs/node_osrm_support.hpp b/include/nodejs/node_osrm_support.hpp index f428308e50c..328a9985460 100644 --- a/include/nodejs/node_osrm_support.hpp +++ b/include/nodejs/node_osrm_support.hpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/include/osrm/error_codes.hpp b/include/osrm/error_codes.hpp index 476b9830958..55043159585 100644 --- a/include/osrm/error_codes.hpp +++ b/include/osrm/error_codes.hpp @@ -1,8 +1,6 @@ #ifndef OSRM_ERRORCODES_HPP #define OSRM_ERRORCODES_HPP -#include - namespace osrm { diff --git a/include/partitioner/bisection_graph_view.hpp b/include/partitioner/bisection_graph_view.hpp index e3a62aaf1c8..ff547fca35b 100644 --- a/include/partitioner/bisection_graph_view.hpp +++ b/include/partitioner/bisection_graph_view.hpp @@ -5,10 +5,9 @@ #include #include -#include +#include #include -#include namespace osrm::partitioner { @@ -40,7 +39,7 @@ class BisectionGraphView // Iteration over all nodes (direct access into the node) ConstNodeIterator Begin() const; ConstNodeIterator End() const; - auto Nodes() const { return boost::make_iterator_range(begin, end); } + auto Nodes() const { return std::ranges::subrange(begin, end); } // Re-Construct the ID of a node from a reference NodeID GetID(const NodeT &node) const; diff --git a/include/partitioner/cell_storage.hpp b/include/partitioner/cell_storage.hpp index e0d315b6aa2..268fc9115f7 100644 --- a/include/partitioner/cell_storage.hpp +++ b/include/partitioner/cell_storage.hpp @@ -14,9 +14,7 @@ #include "customizer/cell_metric.hpp" -#include -#include - +#include #include #include @@ -128,19 +126,19 @@ template class CellStorageImpl friend class ::boost::iterator_core_access; ValuePtrT current; - const std::size_t stride; + std::size_t stride; }; template auto GetOutRange(const ValuePtr ptr, const NodeID node) const { auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node); if (iter == source_boundary + num_source_nodes) - return boost::make_iterator_range(ptr, ptr); + return std::ranges::subrange(ptr, ptr); auto row = std::distance(source_boundary, iter); auto begin = ptr + num_destination_nodes * row; auto end = begin + num_destination_nodes; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } template auto GetInRange(const ValuePtr ptr, const NodeID node) const @@ -148,14 +146,14 @@ template class CellStorageImpl auto iter = std::find(destination_boundary, destination_boundary + num_destination_nodes, node); if (iter == destination_boundary + num_destination_nodes) - return boost::make_iterator_range(ColumnIterator{}, - ColumnIterator{}); + return std::ranges::subrange(ColumnIterator{}, + ColumnIterator{}); auto column = std::distance(destination_boundary, iter); auto begin = ColumnIterator{ptr + column, num_destination_nodes}; auto end = ColumnIterator{ ptr + column + num_source_nodes * num_destination_nodes, num_destination_nodes}; - return boost::make_iterator_range(begin, end); + return std::ranges::subrange(begin, end); } public: @@ -173,13 +171,13 @@ template class CellStorageImpl auto GetSourceNodes() const { - return boost::make_iterator_range(source_boundary, source_boundary + num_source_nodes); + return std::ranges::subrange(source_boundary, source_boundary + num_source_nodes); } auto GetDestinationNodes() const { - return boost::make_iterator_range(destination_boundary, - destination_boundary + num_destination_nodes); + return std::ranges::subrange(destination_boundary, + destination_boundary + num_destination_nodes); } CellImpl(const CellData &data, diff --git a/include/partitioner/dinic_max_flow.hpp b/include/partitioner/dinic_max_flow.hpp index 5f742ac78d8..abe889f5b0f 100644 --- a/include/partitioner/dinic_max_flow.hpp +++ b/include/partitioner/dinic_max_flow.hpp @@ -4,10 +4,8 @@ #include "partitioner/bisection_graph_view.hpp" #include -#include #include #include -#include #include namespace osrm::partitioner diff --git a/include/partitioner/edge_based_graph.hpp b/include/partitioner/edge_based_graph.hpp index 0b09aea17aa..0d2af246d0f 100644 --- a/include/partitioner/edge_based_graph.hpp +++ b/include/partitioner/edge_based_graph.hpp @@ -11,8 +11,6 @@ #include #include -#include -#include namespace osrm::partitioner { diff --git a/include/partitioner/edge_based_graph_reader.hpp b/include/partitioner/edge_based_graph_reader.hpp index 99f111435a6..0a928a03362 100644 --- a/include/partitioner/edge_based_graph_reader.hpp +++ b/include/partitioner/edge_based_graph_reader.hpp @@ -18,7 +18,6 @@ #include #include -#include #include namespace osrm::partitioner diff --git a/include/partitioner/multi_level_partition.hpp b/include/partitioner/multi_level_partition.hpp index 2373ec30e47..25f417fc078 100644 --- a/include/partitioner/multi_level_partition.hpp +++ b/include/partitioner/multi_level_partition.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include namespace osrm::partitioner { @@ -281,7 +281,7 @@ template class MultiLevelPartitionImpl final // top down assign new cell ids LevelID level = partitions.size(); - for (const auto &partition : boost::adaptors::reverse(partitions)) + for (const auto &partition : std::ranges::reverse_view(partitions)) { BOOST_ASSERT(permutation.size() > 0); CellID last_cell_id = partition[permutation.front()]; diff --git a/include/partitioner/partition_graph.hpp b/include/partitioner/partition_graph.hpp index 86b3a546d3a..61b798a3744 100644 --- a/include/partitioner/partition_graph.hpp +++ b/include/partitioner/partition_graph.hpp @@ -3,13 +3,11 @@ #include #include -#include #include #include #include "util/typedefs.hpp" -#include - +#include namespace osrm::partitioner { @@ -84,26 +82,26 @@ template class RemappableGraph auto Edges(const NodeID nid) { - return boost::make_iterator_range(edges.begin() + nodes[nid].edges_begin, - edges.begin() + nodes[nid].edges_end); + return std::ranges::subrange(edges.begin() + nodes[nid].edges_begin, + edges.begin() + nodes[nid].edges_end); } auto Edges(const NodeID nid) const { - return boost::make_iterator_range(edges.begin() + nodes[nid].edges_begin, - edges.begin() + nodes[nid].edges_end); + return std::ranges::subrange(edges.begin() + nodes[nid].edges_begin, + edges.begin() + nodes[nid].edges_end); } auto Edges(const NodeT &node) { - return boost::make_iterator_range(edges.begin() + node.edges_begin, - edges.begin() + node.edges_end); + return std::ranges::subrange(edges.begin() + node.edges_begin, + edges.begin() + node.edges_end); } auto Edges(const NodeT &node) const { - return boost::make_iterator_range(edges.begin() + node.edges_begin, - edges.begin() + node.edges_end); + return std::ranges::subrange(edges.begin() + node.edges_begin, + edges.begin() + node.edges_end); } auto BeginEdges(const NodeID nid) const { return edges.begin() + nodes[nid].edges_begin; } @@ -118,8 +116,8 @@ template class RemappableGraph EdgeID EndEdgeID(const NodeID nid) const { return nodes[nid].edges_end; } // iterate over all nodes - auto Nodes() { return boost::make_iterator_range(nodes.begin(), nodes.end()); } - auto Nodes() const { return boost::make_iterator_range(nodes.begin(), nodes.end()); } + auto Nodes() { return std::ranges::subrange(nodes.begin(), nodes.end()); } + auto Nodes() const { return std::ranges::subrange(nodes.begin(), nodes.end()); } NodeID GetID(const NodeT &node) const { diff --git a/include/partitioner/partitioner_config.hpp b/include/partitioner/partitioner_config.hpp index 3bffdd515bc..326b6e6b80b 100644 --- a/include/partitioner/partitioner_config.hpp +++ b/include/partitioner/partitioner_config.hpp @@ -1,9 +1,7 @@ #ifndef OSRM_PARTITIONER_CONFIG_HPP #define OSRM_PARTITIONER_CONFIG_HPP -#include #include -#include #include "storage/io_config.hpp" diff --git a/include/server/api/parsed_url.hpp b/include/server/api/parsed_url.hpp index ee1cf221809..bfdc46ef887 100644 --- a/include/server/api/parsed_url.hpp +++ b/include/server/api/parsed_url.hpp @@ -4,7 +4,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::api { diff --git a/include/server/connection.hpp b/include/server/connection.hpp index ad8e49d98a3..8ded1310d6d 100644 --- a/include/server/connection.hpp +++ b/include/server/connection.hpp @@ -11,7 +11,6 @@ #include #include -#include #include namespace osrm::server diff --git a/include/server/request_handler.hpp b/include/server/request_handler.hpp index 4841d2ec2b6..b05343bf823 100644 --- a/include/server/request_handler.hpp +++ b/include/server/request_handler.hpp @@ -3,8 +3,6 @@ #include "server/service_handler.hpp" -#include - namespace osrm::server { diff --git a/include/server/server.hpp b/include/server/server.hpp index 34b8982e67a..e7966a91a8c 100644 --- a/include/server/server.hpp +++ b/include/server/server.hpp @@ -18,7 +18,6 @@ #include #endif -#include #include #include #include @@ -53,8 +52,7 @@ class Server const auto port_string = std::to_string(port); boost::asio::ip::tcp::resolver resolver(io_context); - boost::asio::ip::tcp::resolver::query query(address, port_string); - boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query); + boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port_string).begin(); acceptor.open(endpoint.protocol()); #ifdef SO_REUSEPORT diff --git a/include/server/service/base_service.hpp b/include/server/service/base_service.hpp index 5e52a2e0933..a3e5eb403c6 100644 --- a/include/server/service/base_service.hpp +++ b/include/server/service/base_service.hpp @@ -8,7 +8,6 @@ #include #include -#include namespace osrm::server::service { diff --git a/include/server/service/match_service.hpp b/include/server/service/match_service.hpp index 4294a1f4175..d8e5345e308 100644 --- a/include/server/service/match_service.hpp +++ b/include/server/service/match_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/server/service/nearest_service.hpp b/include/server/service/nearest_service.hpp index c4895ecfb95..b64fe4d412a 100644 --- a/include/server/service/nearest_service.hpp +++ b/include/server/service/nearest_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/server/service/route_service.hpp b/include/server/service/route_service.hpp index 19b52d38063..b03b3d65974 100644 --- a/include/server/service/route_service.hpp +++ b/include/server/service/route_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/server/service/table_service.hpp b/include/server/service/table_service.hpp index f4ce955b242..3b6b30410e6 100644 --- a/include/server/service/table_service.hpp +++ b/include/server/service/table_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/server/service/tile_service.hpp b/include/server/service/tile_service.hpp index 5cc62e6ca78..4bf4f21606d 100644 --- a/include/server/service/tile_service.hpp +++ b/include/server/service/tile_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/server/service/trip_service.hpp b/include/server/service/trip_service.hpp index 3f820b747f6..c1b4c2c0e80 100644 --- a/include/server/service/trip_service.hpp +++ b/include/server/service/trip_service.hpp @@ -8,7 +8,6 @@ #include "util/coordinate.hpp" #include -#include namespace osrm::server::service { diff --git a/include/storage/io.hpp b/include/storage/io.hpp index cebb180cdb3..10ffcb58399 100644 --- a/include/storage/io.hpp +++ b/include/storage/io.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include namespace osrm::storage::io diff --git a/include/storage/serialization.hpp b/include/storage/serialization.hpp index 16965638eb7..b94aa7be94b 100644 --- a/include/storage/serialization.hpp +++ b/include/storage/serialization.hpp @@ -15,7 +15,6 @@ #include #include -#include namespace osrm::storage::serialization { diff --git a/include/storage/shared_datatype.hpp b/include/storage/shared_datatype.hpp index fae3989a2e1..d9c6670d958 100644 --- a/include/storage/shared_datatype.hpp +++ b/include/storage/shared_datatype.hpp @@ -7,8 +7,6 @@ #include "util/exception.hpp" #include "util/exception_utils.hpp" -#include - #include #include #include diff --git a/include/storage/shared_memory.hpp b/include/storage/shared_memory.hpp index 1b33d4ebe10..3acec0f3d8a 100644 --- a/include/storage/shared_memory.hpp +++ b/include/storage/shared_memory.hpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/include/updater/csv_file_parser.hpp b/include/updater/csv_file_parser.hpp index bac8d9bfc2c..037f5b4ec91 100644 --- a/include/updater/csv_file_parser.hpp +++ b/include/updater/csv_file_parser.hpp @@ -16,9 +16,7 @@ #include #include -#include #include -#include #include namespace osrm::updater diff --git a/include/updater/source.hpp b/include/updater/source.hpp index 852b21216ea..6a5b56dcb52 100644 --- a/include/updater/source.hpp +++ b/include/updater/source.hpp @@ -4,6 +4,7 @@ #include "util/typedefs.hpp" #include +#include #include namespace osrm::updater diff --git a/include/updater/updater.hpp b/include/updater/updater.hpp index b9e291c995d..3ebd52f3ede 100644 --- a/include/updater/updater.hpp +++ b/include/updater/updater.hpp @@ -5,7 +5,6 @@ #include "extractor/edge_based_edge.hpp" -#include #include namespace osrm::updater diff --git a/include/updater/updater_config.hpp b/include/updater/updater_config.hpp index d1dab9f3c49..221371b0507 100644 --- a/include/updater/updater_config.hpp +++ b/include/updater/updater_config.hpp @@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "storage/io_config.hpp" #include "storage/storage_config.hpp" -#include #include #include diff --git a/include/util/alias.hpp b/include/util/alias.hpp index da6ab0e17d5..caf30751040 100644 --- a/include/util/alias.hpp +++ b/include/util/alias.hpp @@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define OSRM_UTIL_ALIAS_HPP #include -#include #include #include diff --git a/include/util/assert.hpp b/include/util/assert.hpp index 31127f29cf2..bf611241849 100644 --- a/include/util/assert.hpp +++ b/include/util/assert.hpp @@ -2,7 +2,6 @@ #define OSRM_UTIL_ASSERT_HPP #include -#include #include "util/to_osm_link.hpp" diff --git a/include/util/bearing.hpp b/include/util/bearing.hpp index cc2cdfda495..13f78684d7f 100644 --- a/include/util/bearing.hpp +++ b/include/util/bearing.hpp @@ -2,55 +2,13 @@ #define BEARING_HPP #include -#include #include -#include namespace osrm::util { namespace bearing { -inline std::string get(const double heading) -{ - BOOST_ASSERT(heading >= 0); - BOOST_ASSERT(heading <= 360); - - if (heading <= 22.5) - { - return "N"; - } - if (heading <= 67.5) - { - return "NE"; - } - if (heading <= 112.5) - { - return "E"; - } - if (heading <= 157.5) - { - return "SE"; - } - if (heading <= 202.5) - { - return "S"; - } - if (heading <= 247.5) - { - return "SW"; - } - if (heading <= 292.5) - { - return "W"; - } - if (heading <= 337.5) - { - return "NW"; - } - return "N"; -} - // Checks whether A is between B-range and B+range, all modulo 360 // e.g. A = 5, B = 5, range = 10 == true // A = -6, B = 5, range = 10 == false diff --git a/include/util/bit_range.hpp b/include/util/bit_range.hpp index 52a74ac9528..27515f50743 100644 --- a/include/util/bit_range.hpp +++ b/include/util/bit_range.hpp @@ -2,43 +2,13 @@ #define OSRM_UTIL_BIT_RANGE_HPP #include "util/msb.hpp" - +#include #include -#include +#include namespace osrm::util { -namespace detail -{ -template std::size_t countOnes(T value) -{ - static_assert(std::is_unsigned::value, "Only unsigned types allowed"); - std::size_t number_of_ones = 0; - while (value > 0) - { - auto index = msb(value); - value = value & ~(T{1} << index); - number_of_ones++; - } - return number_of_ones; -} - -#if (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)) -inline std::size_t countOnes(std::uint8_t value) -{ - return __builtin_popcount(std::uint32_t{value}); -} -inline std::size_t countOnes(std::uint16_t value) -{ - return __builtin_popcount(std::uint32_t{value}); -} -inline std::size_t countOnes(unsigned int value) { return __builtin_popcount(value); } -inline std::size_t countOnes(unsigned long value) { return __builtin_popcountl(value); } -inline std::size_t countOnes(unsigned long long value) { return __builtin_popcountll(value); } -#endif -} // namespace detail - // Investigate if we can replace this with // http://www.boost.org/doc/libs/1_64_0/libs/dynamic_bitset/dynamic_bitset.html template @@ -70,7 +40,7 @@ class BitIterator : public boost::iterator_facade, difference_type distance_to(const BitIterator &other) const { - return detail::countOnes(m_value) - detail::countOnes(other.m_value); + return std::popcount(m_value) - std::popcount(other.m_value); } bool equal(const BitIterator &other) const { return m_value == other.m_value; } @@ -88,7 +58,7 @@ class BitIterator : public boost::iterator_facade, // Returns range over all 1 bits of value template auto makeBitRange(const T value) { - return boost::make_iterator_range(BitIterator{value}, BitIterator{}); + return std::ranges::subrange(BitIterator{value}, BitIterator{}); } } // namespace osrm::util diff --git a/include/util/cheap_ruler.hpp b/include/util/cheap_ruler.hpp index 386a1785dd4..7be93e842ac 100644 --- a/include/util/cheap_ruler.hpp +++ b/include/util/cheap_ruler.hpp @@ -2,11 +2,7 @@ #include #include -#include -#include #include -#include -#include namespace mapbox { diff --git a/include/util/coordinate.hpp b/include/util/coordinate.hpp index e19a1bc5ec5..df8843ecc0d 100644 --- a/include/util/coordinate.hpp +++ b/include/util/coordinate.hpp @@ -32,11 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include #include -#include //for std::ostream -#include -#include #include namespace osrm diff --git a/include/util/d_ary_heap.hpp b/include/util/d_ary_heap.hpp new file mode 100644 index 00000000000..ad7dbf82452 --- /dev/null +++ b/include/util/d_ary_heap.hpp @@ -0,0 +1,113 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace osrm::util +{ +template > class DAryHeap +{ + public: + using HeapHandle = size_t; + + static constexpr HeapHandle INVALID_HANDLE = std::numeric_limits::max(); + + public: + const HeapData &top() const { return heap[0]; } + + size_t size() const { return heap.size(); } + + bool empty() const { return heap.empty(); } + + const HeapData &operator[](HeapHandle handle) const { return heap[handle]; } + + template + void emplace(HeapData &&data, ReorderHandler &&reorderHandler) + { + heap.emplace_back(std::forward(data)); + heapifyUp(heap.size() - 1, std::forward(reorderHandler)); + } + + template + void decrease(HeapHandle handle, HeapData &&data, ReorderHandler &&reorderHandler) + { + BOOST_ASSERT(handle < heap.size()); + + heap[handle] = std::forward(data); + heapifyUp(handle, std::forward(reorderHandler)); + } + + void clear() { heap.clear(); } + + template void pop(ReorderHandler &&reorderHandler) + { + BOOST_ASSERT(!heap.empty()); + heap[0] = std::move(heap.back()); + heap.pop_back(); + if (!heap.empty()) + { + heapifyDown(0, std::forward(reorderHandler)); + } + } + + private: + size_t parent(size_t index) { return (index - 1) / Arity; } + + size_t kthChild(size_t index, size_t k) { return Arity * index + k + 1; } + + template void heapifyUp(size_t index, ReorderHandler &&reorderHandler) + { + HeapData temp = std::move(heap[index]); + while (index > 0 && comp(temp, heap[parent(index)])) + { + size_t parentIndex = parent(index); + heap[index] = std::move(heap[parentIndex]); + reorderHandler(heap[index], index); + index = parentIndex; + } + heap[index] = std::move(temp); + reorderHandler(heap[index], index); + } + + template + void heapifyDown(size_t index, ReorderHandler &&reorderHandler) + { + HeapData temp = std::move(heap[index]); + size_t child; + while (kthChild(index, 0) < heap.size()) + { + child = minChild(index); + if (!comp(heap[child], temp)) + { + break; + } + heap[index] = std::move(heap[child]); + reorderHandler(heap[index], index); + index = child; + } + heap[index] = std::move(temp); + reorderHandler(heap[index], index); + } + + size_t minChild(size_t index) + { + size_t bestChild = kthChild(index, 0); + for (size_t k = 1; k < Arity; ++k) + { + size_t pos = kthChild(index, k); + if (pos < heap.size() && comp(heap[pos], heap[bestChild])) + { + bestChild = pos; + } + } + return bestChild; + } + + private: + Comparator comp; + std::vector heap; +}; +} // namespace osrm::util diff --git a/include/util/debug.hpp b/include/util/debug.hpp index 2f60c369b2b..41a15dfc81f 100644 --- a/include/util/debug.hpp +++ b/include/util/debug.hpp @@ -11,10 +11,9 @@ #include "util/node_based_graph.hpp" #include "util/typedefs.hpp" +#include #include #include -#include -#include #include namespace osrm diff --git a/include/util/exception.hpp b/include/util/exception.hpp index 660bae69a75..8d3a8762d7a 100644 --- a/include/util/exception.hpp +++ b/include/util/exception.hpp @@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define OSRM_EXCEPTION_HPP #include -#include #include #include diff --git a/include/util/filtered_integer_range.hpp b/include/util/filtered_integer_range.hpp index eb86573a3fe..ff4ceb90c91 100644 --- a/include/util/filtered_integer_range.hpp +++ b/include/util/filtered_integer_range.hpp @@ -1,13 +1,10 @@ #ifndef FILTERED_INTEGER_RANGE_HPP #define FILTERED_INTEGER_RANGE_HPP -#include #include #include -#include - namespace osrm::util { diff --git a/include/util/for_each_indexed.hpp b/include/util/for_each_indexed.hpp index 2ca86bfdf96..a5daa354106 100644 --- a/include/util/for_each_indexed.hpp +++ b/include/util/for_each_indexed.hpp @@ -2,8 +2,6 @@ #define FOR_EACH_INDEXED_HPP #include -#include -#include namespace osrm::util { diff --git a/include/util/for_each_pair.hpp b/include/util/for_each_pair.hpp index b1fb5b1bb8d..8b47b01476f 100644 --- a/include/util/for_each_pair.hpp +++ b/include/util/for_each_pair.hpp @@ -2,7 +2,6 @@ #define FOR_EACH_PAIR_HPP #include -#include #include namespace osrm::util diff --git a/include/util/guidance/bearing_class.hpp b/include/util/guidance/bearing_class.hpp index 1e5fce1ebd3..6b13b8749f1 100644 --- a/include/util/guidance/bearing_class.hpp +++ b/include/util/guidance/bearing_class.hpp @@ -5,8 +5,6 @@ #include "util/typedefs.hpp" #include -#include -#include #include namespace osrm::util::guidance diff --git a/include/util/guidance/entry_class.hpp b/include/util/guidance/entry_class.hpp index 884ae6cdb74..676b9b9eb8f 100644 --- a/include/util/guidance/entry_class.hpp +++ b/include/util/guidance/entry_class.hpp @@ -4,9 +4,6 @@ #include #include #include -#include - -#include namespace osrm::util::guidance { diff --git a/include/util/guidance/turn_lanes.hpp b/include/util/guidance/turn_lanes.hpp index 21126ee16db..226772cdd63 100644 --- a/include/util/guidance/turn_lanes.hpp +++ b/include/util/guidance/turn_lanes.hpp @@ -6,10 +6,6 @@ #include "util/typedefs.hpp" #include -#include -#include -#include -#include namespace osrm::util::guidance { diff --git a/include/util/integer_range.hpp b/include/util/integer_range.hpp index 973197b7ff6..18472bfac61 100644 --- a/include/util/integer_range.hpp +++ b/include/util/integer_range.hpp @@ -1,13 +1,10 @@ #ifndef INTEGER_RANGE_HPP #define INTEGER_RANGE_HPP -#include #include #include -#include - namespace osrm::util { diff --git a/include/util/json_container.hpp b/include/util/json_container.hpp index 14ca9d52f99..728b6e3e986 100644 --- a/include/util/json_container.hpp +++ b/include/util/json_container.hpp @@ -104,7 +104,7 @@ using Value = std::variant; */ struct Object { - std::unordered_map values; + std::unordered_map values; }; /** diff --git a/include/util/json_deep_compare.hpp b/include/util/json_deep_compare.hpp index 24b226ca7f8..6c7ddd86a5e 100644 --- a/include/util/json_deep_compare.hpp +++ b/include/util/json_deep_compare.hpp @@ -6,8 +6,6 @@ #include -#include -#include #include namespace osrm::util::json @@ -44,13 +42,13 @@ struct Comparator bool operator()(const Object &lhs, const Object &rhs) const { - std::set lhs_keys; + std::set lhs_keys; for (const auto &key_value : lhs.values) { lhs_keys.insert(key_value.first); } - std::set rhs_keys; + std::set rhs_keys; for (const auto &key_value : rhs.values) { rhs_keys.insert(key_value.first); @@ -60,7 +58,7 @@ struct Comparator { if (rhs_keys.find(key) == rhs_keys.end()) { - reason = rhs_path + " doesn't have key \"" + key + "\""; + reason = rhs_path + " doesn't have key \"" + std::string(key) + "\""; return false; } } @@ -69,7 +67,7 @@ struct Comparator { if (lhs_keys.find(key) == lhs_keys.end()) { - reason = lhs_path + " doesn't have key \"" + key + "\""; + reason = lhs_path + " doesn't have key \"" + std::string(key) + "\""; return false; } } @@ -81,10 +79,11 @@ struct Comparator const auto &rhs_child = rhs.values.find(key)->second; const auto &lhs_child = lhs.values.find(key)->second; - auto is_same = - std::visit(Comparator(reason, lhs_path + "." + key, rhs_path + "." + key), - lhs_child, - rhs_child); + auto is_same = std::visit(Comparator(reason, + lhs_path + "." + std::string(key), + rhs_path + "." + std::string(key)), + lhs_child, + rhs_child); if (!is_same) { return false; diff --git a/include/util/json_renderer.hpp b/include/util/json_renderer.hpp index d1adfcce6cc..2a6b9a90ff6 100644 --- a/include/util/json_renderer.hpp +++ b/include/util/json_renderer.hpp @@ -8,7 +8,6 @@ #include "osrm/json_container.hpp" -#include #include #include #include @@ -97,7 +96,7 @@ template struct Renderer void operator()(const Null &) { write<>("null"); } private: - void write(const std::string &str); + void write(std::string_view str); void write(const char *str, size_t size); void write(char ch); @@ -110,7 +109,7 @@ template struct Renderer Out &out; }; -template <> void Renderer>::write(const std::string &str) +template <> void Renderer>::write(std::string_view str) { out.insert(out.end(), str.begin(), str.end()); } @@ -122,7 +121,7 @@ template <> void Renderer>::write(const char *str, size_t size template <> void Renderer>::write(char ch) { out.push_back(ch); } -template <> void Renderer::write(const std::string &str) { out << str; } +template <> void Renderer::write(std::string_view str) { out << str; } template <> void Renderer::write(const char *str, size_t size) { @@ -131,7 +130,7 @@ template <> void Renderer::write(const char *str, size_t size) template <> void Renderer::write(char ch) { out << ch; } -template <> void Renderer::write(const std::string &str) { out += str; } +template <> void Renderer::write(std::string_view str) { out += str; } template <> void Renderer::write(const char *str, size_t size) { diff --git a/include/util/mmap_tar.hpp b/include/util/mmap_tar.hpp index a70d5fba802..73e973d47b1 100644 --- a/include/util/mmap_tar.hpp +++ b/include/util/mmap_tar.hpp @@ -7,7 +7,6 @@ #include -#include #include namespace osrm::util diff --git a/include/util/msb.hpp b/include/util/msb.hpp index 8b09399f4e1..9a2a3b39eb4 100644 --- a/include/util/msb.hpp +++ b/include/util/msb.hpp @@ -1,50 +1,23 @@ #ifndef OSRM_UTIL_MSB_HPP #define OSRM_UTIL_MSB_HPP +#include #include - -#include -#include -#include +#include namespace osrm::util { -// get the msb of an integer -// return 0 for integers without msb template std::size_t msb(T value) { + BOOST_ASSERT(value > 0); + static_assert(std::is_integral::value && !std::is_signed::value, "Integer required."); - std::size_t msb = 0; - while (value > 0) - { - value >>= 1u; - msb++; - } - BOOST_ASSERT(msb > 0); - return msb - 1; -} + constexpr auto MSB_INDEX = std::numeric_limits::digits * sizeof(T) - 1; -#if (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)) -inline std::size_t msb(unsigned long long v) -{ - BOOST_ASSERT(v > 0); - constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned long long) - 1; - return MSB_INDEX - __builtin_clzll(v); -} -inline std::size_t msb(unsigned long v) -{ - BOOST_ASSERT(v > 0); - constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned long) - 1; - return MSB_INDEX - __builtin_clzl(v); -} -inline std::size_t msb(unsigned int v) -{ - BOOST_ASSERT(v > 0); - constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned int) - 1; - return MSB_INDEX - __builtin_clz(v); + return MSB_INDEX - std::countl_zero(value); } -#endif + } // namespace osrm::util #endif diff --git a/include/util/node_based_graph.hpp b/include/util/node_based_graph.hpp index cb17b5a223c..6f8786844f2 100644 --- a/include/util/node_based_graph.hpp +++ b/include/util/node_based_graph.hpp @@ -9,9 +9,6 @@ #include -#include -#include - namespace osrm::util { diff --git a/include/util/packed_vector.hpp b/include/util/packed_vector.hpp index 6e03421ee31..22a234419fe 100644 --- a/include/util/packed_vector.hpp +++ b/include/util/packed_vector.hpp @@ -13,7 +13,6 @@ #include #include -#include #if defined(_MSC_VER) // for `InterlockedCompareExchange64` @@ -340,6 +339,8 @@ template class Pack { } + ReferenceT operator[](difference_type n) const { return container->operator[](index + n); } + private: void increment() { ++index; } void decrement() { --index; } diff --git a/include/util/percent.hpp b/include/util/percent.hpp index 0285f40dfb4..173e3b657bf 100644 --- a/include/util/percent.hpp +++ b/include/util/percent.hpp @@ -2,7 +2,6 @@ #define PERCENT_HPP #include -#include #include "util/isatty.hpp" #include "util/log.hpp" diff --git a/include/util/permutation.hpp b/include/util/permutation.hpp index 34520389ad2..ac9cf127bea 100644 --- a/include/util/permutation.hpp +++ b/include/util/permutation.hpp @@ -3,6 +3,8 @@ #include "util/integer_range.hpp" +#include + #include namespace osrm::util diff --git a/include/util/query_heap.hpp b/include/util/query_heap.hpp index e2678f2c080..72b9e4b8860 100644 --- a/include/util/query_heap.hpp +++ b/include/util/query_heap.hpp @@ -4,10 +4,9 @@ #include #include +#include "d_ary_heap.hpp" #include -#include #include -#include #include #include #include @@ -133,20 +132,17 @@ class QueryHeap Weight weight; Key index; - bool operator>(const HeapData &other) const + bool operator<(const HeapData &other) const { if (weight == other.weight) { - return index > other.index; + return index < other.index; } - return weight > other.weight; + return weight < other.weight; } }; - using HeapContainer = boost::heap::d_ary_heap, - boost::heap::mutable_, - boost::heap::compare>>; - using HeapHandle = typename HeapContainer::handle_type; + using HeapContainer = DAryHeap; + using HeapHandle = typename HeapContainer::HeapHandle; public: using WeightType = Weight; @@ -178,11 +174,31 @@ class QueryHeap void Insert(NodeID node, Weight weight, const Data &data) { + checkInvariants(); + BOOST_ASSERT(node < std::numeric_limits::max()); const auto index = static_cast(inserted_nodes.size()); - const auto handle = heap.emplace(HeapData{weight, index}); - inserted_nodes.emplace_back(HeapNode{handle, node, weight, data}); + inserted_nodes.emplace_back(HeapNode{heap.size(), node, weight, data}); + + heap.emplace(HeapData{weight, index}, + [this](const auto &heapData, auto new_handle) + { inserted_nodes[heapData.index].handle = new_handle; }); node_index[node] = index; + + checkInvariants(); + } + + void checkInvariants() + { +#ifndef NDEBUG + for (size_t handle = 0; handle < heap.size(); ++handle) + { + auto &in_heap = heap[handle]; + auto &inserted = inserted_nodes[in_heap.index]; + BOOST_ASSERT(in_heap.weight == inserted.weight); + BOOST_ASSERT(inserted.handle == handle); + } +#endif // !NDEBUG } Data &GetData(NodeID node) @@ -216,16 +232,7 @@ class QueryHeap { BOOST_ASSERT(WasInserted(node)); const Key index = node_index.peek_index(node); - - // Use end iterator as a reliable "non-existent" handle. - // Default-constructed handles are singular and - // can only be checked-compared to another singular instance. - // Behaviour investigated at https://lists.boost.org/boost-users/2017/08/87787.php, - // eventually confirmation at https://stackoverflow.com/a/45622940/151641. - // Corrected in https://github.com/Project-OSRM/osrm-backend/pull/4396 - auto const end_it = const_cast(heap).end(); // non-const iterator - auto const none_handle = heap.s_handle_from_iterator(end_it); // from non-const iterator - return inserted_nodes[index].handle == none_handle; + return inserted_nodes[index].handle == HeapContainer::INVALID_HANDLE; } bool WasInserted(const NodeID node) const @@ -276,26 +283,30 @@ class QueryHeap { BOOST_ASSERT(!heap.empty()); const Key removedIndex = heap.top().index; - heap.pop(); - inserted_nodes[removedIndex].handle = heap.s_handle_from_iterator(heap.end()); + inserted_nodes[removedIndex].handle = HeapContainer::INVALID_HANDLE; + + heap.pop([this](const auto &heapData, auto new_handle) + { inserted_nodes[heapData.index].handle = new_handle; }); return inserted_nodes[removedIndex].node; } HeapNode &DeleteMinGetHeapNode() { BOOST_ASSERT(!heap.empty()); + checkInvariants(); const Key removedIndex = heap.top().index; - heap.pop(); - inserted_nodes[removedIndex].handle = heap.s_handle_from_iterator(heap.end()); + inserted_nodes[removedIndex].handle = HeapContainer::INVALID_HANDLE; + heap.pop([this](const auto &heapData, auto new_handle) + { inserted_nodes[heapData.index].handle = new_handle; }); + checkInvariants(); return inserted_nodes[removedIndex]; } void DeleteAll() { - auto const none_handle = heap.s_handle_from_iterator(heap.end()); std::for_each(inserted_nodes.begin(), inserted_nodes.end(), - [&none_handle](auto &node) { node.handle = none_handle; }); + [&](auto &node) { node.handle = HeapContainer::INVALID_HANDLE; }); heap.clear(); } @@ -305,13 +316,19 @@ class QueryHeap const auto index = node_index.peek_index(node); auto &reference = inserted_nodes[index]; reference.weight = weight; - heap.increase(reference.handle, HeapData{weight, static_cast(index)}); + heap.decrease(reference.handle, + HeapData{weight, static_cast(index)}, + [this](const auto &heapData, auto new_handle) + { inserted_nodes[heapData.index].handle = new_handle; }); } void DecreaseKey(const HeapNode &heapNode) { BOOST_ASSERT(!WasRemoved(heapNode.node)); - heap.increase(heapNode.handle, HeapData{heapNode.weight, (*heapNode.handle).index}); + heap.decrease(heapNode.handle, + HeapData{heapNode.weight, heap[heapNode.handle].index}, + [this](const auto &heapData, auto new_handle) + { inserted_nodes[heapData.index].handle = new_handle; }); } private: @@ -319,6 +336,7 @@ class QueryHeap HeapContainer heap; IndexStorage node_index; }; + } // namespace osrm::util #endif // OSRM_UTIL_QUERY_HEAP_HPP diff --git a/include/util/range_table.hpp b/include/util/range_table.hpp index 2808f6c1854..2c4c3d59c50 100644 --- a/include/util/range_table.hpp +++ b/include/util/range_table.hpp @@ -7,7 +7,6 @@ #include "util/vector_view.hpp" #include -#include #include namespace osrm::util diff --git a/include/util/rectangle.hpp b/include/util/rectangle.hpp index aca19244651..5ab3912b2af 100644 --- a/include/util/rectangle.hpp +++ b/include/util/rectangle.hpp @@ -6,7 +6,6 @@ #include #include -#include #include diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index c010471ea37..524f5dc983e 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index bbb12efa561..2678d1dd7b7 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -20,7 +20,6 @@ #include "storage/shared_memory_ownership.hpp" #include -#include #include #include @@ -28,10 +27,8 @@ #include #include -#include #include #include -#include #include #include #include diff --git a/include/util/std_hash.hpp b/include/util/std_hash.hpp index 4f64f940d7b..6bb4d5cd4a5 100644 --- a/include/util/std_hash.hpp +++ b/include/util/std_hash.hpp @@ -2,7 +2,6 @@ #define STD_HASH_HPP #include -#include #include #include #include diff --git a/include/util/string_util.hpp b/include/util/string_util.hpp index 4e63511378c..45cb9885e62 100644 --- a/include/util/string_util.hpp +++ b/include/util/string_util.hpp @@ -4,9 +4,8 @@ #include #include #include -#include +#include #include -#include namespace osrm::util { diff --git a/include/util/tarjan_scc.hpp b/include/util/tarjan_scc.hpp index eb617026477..df1e89c73a5 100644 --- a/include/util/tarjan_scc.hpp +++ b/include/util/tarjan_scc.hpp @@ -14,11 +14,9 @@ #include "osrm/coordinate.hpp" #include -#include #include #include -#include #include #include diff --git a/include/util/timed_histogram.hpp b/include/util/timed_histogram.hpp index 9338154463c..e952d02b014 100644 --- a/include/util/timed_histogram.hpp +++ b/include/util/timed_histogram.hpp @@ -3,6 +3,8 @@ #include "util/integer_range.hpp" +#include + #include #include #include diff --git a/include/util/timezones.hpp b/include/util/timezones.hpp index e144662de7f..a7429f9d70c 100644 --- a/include/util/timezones.hpp +++ b/include/util/timezones.hpp @@ -8,7 +8,6 @@ #include -#include #include #include diff --git a/include/util/timing_util.hpp b/include/util/timing_util.hpp index fe074d70875..b54392d78f4 100644 --- a/include/util/timing_util.hpp +++ b/include/util/timing_util.hpp @@ -2,7 +2,6 @@ #define TIMING_UTIL_HPP #include -#include namespace osrm::util { diff --git a/include/util/vector_tile.hpp b/include/util/vector_tile.hpp index 749d8550537..4d4fea6f39a 100644 --- a/include/util/vector_tile.hpp +++ b/include/util/vector_tile.hpp @@ -1,8 +1,6 @@ #ifndef OSRM_UTIL_VECTOR_TILE_HPP #define OSRM_UTIL_VECTOR_TILE_HPP -#include - namespace osrm::util::vector_tile { // Vector tiles are 4096 virtual pixels on each side diff --git a/include/util/vector_view.hpp b/include/util/vector_view.hpp index e2d7d038df3..3f63f5d6020 100644 --- a/include/util/vector_view.hpp +++ b/include/util/vector_view.hpp @@ -42,6 +42,8 @@ class VectorViewIterator : public boost::iterator_facade - #include -#include // Port of https://github.com/mapbox/geo-viewport diff --git a/include/util/xor_fast_hash.hpp b/include/util/xor_fast_hash.hpp index c90d2e7d635..a7fbf477ca7 100644 --- a/include/util/xor_fast_hash.hpp +++ b/include/util/xor_fast_hash.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #include diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 19202768ec2..2c701e218b3 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -35,6 +35,10 @@ function setup() turn_bias = 1.4, use_public_transport = true, + -- Exclude narrow ways, in particular to route with cargo bike + width = nil, -- Cargo bike could 0.5 width, in meters + exclude_cargo_bike = false, + allowed_start_modes = Set { mode.cycling, mode.pushing_bike @@ -243,6 +247,27 @@ function process_node(profile, node, result) end end + if profile.exclude_cargo_bike then + local cargo_bike = node:get_value_by_key("cargo_bike") + if cargo_bike and cargo_bike == "no" then + result.barrier = true + end + end + + -- width + if profile.width then + -- From barrier=cycle_barrier or other barriers + local maxwidth_physical = node:get_value_by_key("maxwidth:physical") + local maxwidth_physical_meter = maxwidth_physical and Measure.parse_value_meters(maxwidth_physical) or 99 + local opening = node:get_value_by_key("opening") + local opening_meter = opening and Measure.parse_value_meters(opening) or 99 + local width_meter = math.min(maxwidth_physical_meter, opening_meter) + + if width_meter and width_meter < profile.width then + result.barrier = true + end + end + -- check if node is a traffic light result.traffic_lights = TrafficSignal.get_value(node) end @@ -299,6 +324,8 @@ function handle_bicycle_tags(profile,way,result,data) bike_push_handler(profile,way,result,data) + -- width should be after bike_push + width_handler(profile,way,result,data) -- maxspeed limit( result, data.maxspeed, data.maxspeed_forward, data.maxspeed_backward ) @@ -453,6 +480,27 @@ function cycleway_handler(profile,way,result,data) end end +function width_handler(profile,way,result,data) + if profile.exclude_cargo_bike then + local cargo_bike = way:get_value_by_key("cargo_bike") + if cargo_bike and cargo_bike == "no" then + result.forward_mode = mode.inaccessible + result.backward_mode = mode.inaccessible + end + end + + if profile.width then + local width = way:get_value_by_key("width") + if width then + local width_meter = Measure.parse_value_meters(width) + if width_meter and width_meter < profile.width then + result.forward_mode = mode.inaccessible + result.backward_mode = mode.inaccessible + end + end + end +end + function bike_push_handler(profile,way,result,data) -- pushing bikes - if no other mode found if result.forward_mode == mode.inaccessible or result.backward_mode == mode.inaccessible or diff --git a/profiles/car.lua b/profiles/car.lua index 076a93ee1df..24079bfaae0 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -300,7 +300,7 @@ function setup() ['ph:rural'] = 80, ['ph:motorway'] = 100, ['pl:rural'] = 100, - ['pl:trunk'] = 120, + ['pl:expressway'] = 120, ['pl:motorway'] = 140, ["ro:trunk"] = 100, ["ru:living_street"] = 20, diff --git a/profiles/examples/postgis.lua b/profiles/examples/postgis.lua index cfdbb283130..36071c919b7 100644 --- a/profiles/examples/postgis.lua +++ b/profiles/examples/postgis.lua @@ -58,7 +58,7 @@ function way_function (way, result) "SELECT SUM(SQRT(area.area)) AS val " .. "FROM osm_ways way " .. "LEFT JOIN osm_landusages area ON ST_DWithin(way.geometry, area.geometry, 100) " .. - "WHERE area.type IN ('industrial') AND way.osm_id=" .. way.id .. " " .. + "WHERE area.type IN ('industrial') AND way.osm_id=" .. way:id() .. " " .. "GROUP BY way.id" local cursor = assert( sql_con:execute(sql_query) ) -- execute querty diff --git a/scripts/ci/run_benchmarks.sh b/scripts/ci/run_benchmarks.sh index 5b092471d33..b763b83d61e 100755 --- a/scripts/ci/run_benchmarks.sh +++ b/scripts/ci/run_benchmarks.sh @@ -93,7 +93,7 @@ function run_benchmarks_for_folder { echo "Took: ${DIFF}s" done done - + for ALGORITHM in ch mld; do for BENCH in nearest table trip route match; do echo "Running random $BENCH $ALGORITHM" diff --git a/scripts/update_dependencies.sh b/scripts/update_dependencies.sh index d9cebbe4b81..8a9137dc62d 100755 --- a/scripts/update_dependencies.sh +++ b/scripts/update_dependencies.sh @@ -10,7 +10,7 @@ set -o nounset # http://git.661346.n2.nabble.com/subtree-merges-lose-prefix-after-rebase-td7332850.html OSMIUM_PATH="osmcode/libosmium" -OSMIUM_TAG=v2.14.0 +OSMIUM_TAG=v2.20.0 SOL_PATH="ThePhD/sol2" SOL_TAG=v3.3.0 @@ -22,7 +22,7 @@ MICROTAR_PATH="rxi/microtar" MICROTAR_TAG=v0.1.0 PROTOZERO_PATH="mapbox/protozero" -PROTOZERO_TAG=v1.6.2 +PROTOZERO_TAG=v1.7.1 VTZERO_PATH="mapbox/vtzero" VTZERO_TAG=v1.1.0 diff --git a/src/benchmarks/alias.cpp b/src/benchmarks/alias.cpp index e847d3e0e5d..f8881f1b068 100644 --- a/src/benchmarks/alias.cpp +++ b/src/benchmarks/alias.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include using namespace osrm; diff --git a/src/benchmarks/bench.cpp b/src/benchmarks/bench.cpp index 86b263a6beb..4d7df06ba8c 100644 --- a/src/benchmarks/bench.cpp +++ b/src/benchmarks/bench.cpp @@ -17,7 +17,6 @@ #include "osrm/status.hpp" #include "util/meminfo.hpp" -#include #include #include #include diff --git a/src/benchmarks/json_render.cpp b/src/benchmarks/json_render.cpp index d2c00b51f07..47dea88ca4f 100644 --- a/src/benchmarks/json_render.cpp +++ b/src/benchmarks/json_render.cpp @@ -9,12 +9,17 @@ #include #include #include +#include using namespace osrm; namespace { +// we use std::string_view as a key in the object, so since here we have dynamic keys we have to +// "hold" them somewhere okay for tests... +static std::unordered_set gKeysHolder; + void convert(const rapidjson::Value &value, json::Value &result) { if (value.IsString()) @@ -32,7 +37,8 @@ void convert(const rapidjson::Value &value, json::Value &result) { json::Value member; convert(itr->value, member); - object.values.emplace(itr->name.GetString(), std::move(member)); + auto keyItr = gKeysHolder.emplace(itr->name.GetString()).first; + object.values.emplace(*keyItr, std::move(member)); } result = std::move(object); } @@ -122,6 +128,7 @@ int main(int argc, char **argv) if (std::string{out_vec.begin(), out_vec.end()} != out_str || out_str != out_ss_str) { + std::cerr << "Vector/string results are not equal\n"; throw std::logic_error("Vector/stringstream/string results are not equal"); } return EXIT_SUCCESS; diff --git a/src/benchmarks/match.cpp b/src/benchmarks/match.cpp index 2e917c7a99d..161e0905a7e 100644 --- a/src/benchmarks/match.cpp +++ b/src/benchmarks/match.cpp @@ -10,8 +10,6 @@ #include "osrm/osrm.hpp" #include "osrm/status.hpp" -#include - #include #include #include diff --git a/src/benchmarks/packed_vector.cpp b/src/benchmarks/packed_vector.cpp index 7049c185233..5f6747bb792 100644 --- a/src/benchmarks/packed_vector.cpp +++ b/src/benchmarks/packed_vector.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include using namespace osrm; diff --git a/src/benchmarks/route.cpp b/src/benchmarks/route.cpp index ada7a1d5e18..4e969fca10f 100644 --- a/src/benchmarks/route.cpp +++ b/src/benchmarks/route.cpp @@ -11,8 +11,6 @@ #include "osrm/osrm.hpp" #include "osrm/status.hpp" -#include - #include #include #include diff --git a/src/benchmarks/static_rtree.cpp b/src/benchmarks/static_rtree.cpp index 8346b2e9b94..0001b485e3a 100644 --- a/src/benchmarks/static_rtree.cpp +++ b/src/benchmarks/static_rtree.cpp @@ -11,7 +11,6 @@ #include "util/serialization.hpp" #include "util/timing_util.hpp" -#include #include #include diff --git a/src/contractor/contractor.cpp b/src/contractor/contractor.cpp index a0b430aa8c2..a88576f4958 100644 --- a/src/contractor/contractor.cpp +++ b/src/contractor/contractor.cpp @@ -26,14 +26,10 @@ #include "util/typedefs.hpp" #include -#include #include -#include #include -#include #include -#include #include namespace osrm::contractor diff --git a/src/engine/api/json_factory.cpp b/src/engine/api/json_factory.cpp index a17ea77994a..e362e584beb 100644 --- a/src/engine/api/json_factory.cpp +++ b/src/engine/api/json_factory.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include diff --git a/src/engine/datafacade/mmap_memory_allocator.cpp b/src/engine/datafacade/mmap_memory_allocator.cpp index 75482637b81..18096d28ace 100644 --- a/src/engine/datafacade/mmap_memory_allocator.cpp +++ b/src/engine/datafacade/mmap_memory_allocator.cpp @@ -8,8 +8,6 @@ #include "util/log.hpp" #include "util/mmap_file.hpp" -#include - namespace osrm::engine::datafacade { diff --git a/src/engine/guidance/assemble_overview.cpp b/src/engine/guidance/assemble_overview.cpp index 9ee7688656b..b87b1481bdf 100644 --- a/src/engine/guidance/assemble_overview.cpp +++ b/src/engine/guidance/assemble_overview.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include namespace osrm::engine::guidance diff --git a/src/engine/guidance/post_processing.cpp b/src/engine/guidance/post_processing.cpp index 1e1abcf650e..d02de08eaef 100644 --- a/src/engine/guidance/post_processing.cpp +++ b/src/engine/guidance/post_processing.cpp @@ -13,12 +13,10 @@ #include #include -#include #include #include #include -#include #include namespace osrm::engine::guidance diff --git a/src/engine/plugins/match.cpp b/src/engine/plugins/match.cpp index 6fe8f669996..414032d1d26 100644 --- a/src/engine/plugins/match.cpp +++ b/src/engine/plugins/match.cpp @@ -11,8 +11,6 @@ #include #include -#include -#include #include #include diff --git a/src/engine/plugins/tile.cpp b/src/engine/plugins/tile.cpp index ae6a8ec7827..a0614782ab6 100644 --- a/src/engine/plugins/tile.cpp +++ b/src/engine/plugins/tile.cpp @@ -482,9 +482,10 @@ void encodeVectorTile(const DataFacadeBase &facade, reverse_duration_range[reverse_duration_range.size() - edge.fwd_segment_position - 1]; const auto forward_datasource_idx = - forward_datasource_range(edge.fwd_segment_position); - const auto reverse_datasource_idx = reverse_datasource_range( - reverse_datasource_range.size() - edge.fwd_segment_position - 1); + forward_datasource_range[edge.fwd_segment_position]; + const auto reverse_datasource_idx = + reverse_datasource_range[reverse_datasource_range.size() - + edge.fwd_segment_position - 1]; const auto is_startpoint = edge.is_startpoint; diff --git a/src/engine/plugins/trip.cpp b/src/engine/plugins/trip.cpp index 64b1be8bf84..2683760afd2 100644 --- a/src/engine/plugins/trip.cpp +++ b/src/engine/plugins/trip.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include diff --git a/src/engine/polyline_compressor.cpp b/src/engine/polyline_compressor.cpp index 7435fed3fc5..9c015e4c3b2 100644 --- a/src/engine/polyline_compressor.cpp +++ b/src/engine/polyline_compressor.cpp @@ -1,7 +1,6 @@ #include "engine/polyline_compressor.hpp" #include -#include #include #include #include diff --git a/src/engine/routing_algorithms/alternative_path_ch.cpp b/src/engine/routing_algorithms/alternative_path_ch.cpp index 4110eb714c5..a5ee6b3bc9c 100644 --- a/src/engine/routing_algorithms/alternative_path_ch.cpp +++ b/src/engine/routing_algorithms/alternative_path_ch.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include diff --git a/src/engine/routing_algorithms/alternative_path_mld.cpp b/src/engine/routing_algorithms/alternative_path_mld.cpp index 9c0a579f527..696dc506d9e 100644 --- a/src/engine/routing_algorithms/alternative_path_mld.cpp +++ b/src/engine/routing_algorithms/alternative_path_mld.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include diff --git a/src/engine/routing_algorithms/many_to_many_ch.cpp b/src/engine/routing_algorithms/many_to_many_ch.cpp index d021a52e784..8076f3d8acf 100644 --- a/src/engine/routing_algorithms/many_to_many_ch.cpp +++ b/src/engine/routing_algorithms/many_to_many_ch.cpp @@ -2,10 +2,8 @@ #include "engine/routing_algorithms/routing_base_ch.hpp" #include -#include +#include -#include -#include #include namespace osrm::engine::routing_algorithms @@ -106,7 +104,7 @@ void forwardRoutingStep(const DataFacade &facade, search_space_with_buckets.end(), heapNode.node, NodeBucket::Compare()); - for (const auto ¤t_bucket : boost::make_iterator_range(bucket_list)) + for (const auto ¤t_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second)) { // Get target id from bucket entry const auto column_index = current_bucket.column_index; diff --git a/src/engine/routing_algorithms/many_to_many_mld.cpp b/src/engine/routing_algorithms/many_to_many_mld.cpp index b9168508b1d..5291ca14ff1 100644 --- a/src/engine/routing_algorithms/many_to_many_mld.cpp +++ b/src/engine/routing_algorithms/many_to_many_mld.cpp @@ -2,11 +2,8 @@ #include "engine/routing_algorithms/routing_base_mld.hpp" #include -#include +#include -#include -#include -#include #include namespace osrm::engine::routing_algorithms @@ -148,8 +145,8 @@ void relaxOutgoingEdges( } } ++destination; - shortcut_durations.advance_begin(1); - shortcut_distances.advance_begin(1); + shortcut_durations.advance(1); + shortcut_distances.advance(1); } BOOST_ASSERT(shortcut_durations.empty()); BOOST_ASSERT(shortcut_distances.empty()); @@ -169,8 +166,8 @@ void relaxOutgoingEdges( if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to) { const auto to_weight = heapNode.weight + shortcut_weight; - const auto to_duration = heapNode.data.duration + shortcut_durations.front(); - const auto to_distance = heapNode.data.distance + shortcut_distances.front(); + const auto to_duration = heapNode.data.duration + *shortcut_durations.begin(); + const auto to_distance = heapNode.data.distance + *shortcut_distances.begin(); const auto toHeapNode = query_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) { @@ -189,8 +186,8 @@ void relaxOutgoingEdges( } } ++source; - shortcut_durations.advance_begin(1); - shortcut_distances.advance_begin(1); + shortcut_durations.advance(1); + shortcut_distances.advance(1); } BOOST_ASSERT(shortcut_durations.empty()); BOOST_ASSERT(shortcut_distances.empty()); @@ -426,7 +423,7 @@ void forwardRoutingStep(const DataFacade &facade, search_space_with_buckets.end(), heapNode.node, NodeBucket::Compare()); - for (const auto ¤t_bucket : boost::make_iterator_range(bucket_list)) + for (const auto ¤t_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second)) { // Get target id from bucket entry const auto column_idx = current_bucket.column_index; diff --git a/src/engine/routing_algorithms/map_matching.cpp b/src/engine/routing_algorithms/map_matching.cpp index 45133551ef7..4f40c24c367 100644 --- a/src/engine/routing_algorithms/map_matching.cpp +++ b/src/engine/routing_algorithms/map_matching.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/src/extractor/compressed_edge_container.cpp b/src/extractor/compressed_edge_container.cpp index ddfafcef4ba..c695bbf7843 100644 --- a/src/extractor/compressed_edge_container.cpp +++ b/src/extractor/compressed_edge_container.cpp @@ -5,10 +5,6 @@ #include #include -#include -#include -#include -#include namespace osrm::extractor { diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index ae46d58afa1..b5ab53e25c7 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -23,11 +23,9 @@ #include #include -#include #include #include #include -#include #include #include @@ -968,11 +966,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( buffer->continuous_data.push_back(edge_with_data); // get conditional restrictions that apply to this turn - const auto &restrictions = - conditional_node_restriction_map.Restrictions( - incoming_edge.node, - outgoing_edge.node, - outgoing_edge_target); + auto restrictions = conditional_node_restriction_map.Restrictions( + incoming_edge.node, outgoing_edge.node, outgoing_edge_target); for (const auto &restriction : restrictions) { buffer->conditionals.push_back( diff --git a/src/extractor/extraction_containers.cpp b/src/extractor/extraction_containers.cpp index eed6a3c43d6..9445c7c252b 100644 --- a/src/extractor/extraction_containers.cpp +++ b/src/extractor/extraction_containers.cpp @@ -22,10 +22,7 @@ #include -#include #include -#include -#include namespace { diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index c4394dbaa08..80b327e7179 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -47,14 +47,10 @@ #include #include -#include -#include -#include #include #include #include #include -#include #include namespace osrm::extractor diff --git a/src/extractor/extractor_callbacks.cpp b/src/extractor/extractor_callbacks.cpp index ea4744f0eab..5e47f15e3c6 100644 --- a/src/extractor/extractor_callbacks.cpp +++ b/src/extractor/extractor_callbacks.cpp @@ -20,7 +20,6 @@ #include #include -#include #ifdef _MSC_VER namespace osrm diff --git a/src/extractor/intersection/intersection.cpp b/src/extractor/intersection/intersection.cpp index f48668aea89..a9f7add43ef 100644 --- a/src/extractor/intersection/intersection.cpp +++ b/src/extractor/intersection/intersection.cpp @@ -1,6 +1,5 @@ #include "guidance/intersection.hpp" -#include #include #include diff --git a/src/extractor/intersection/intersection_analysis.cpp b/src/extractor/intersection/intersection_analysis.cpp index 7ee296f1133..2850e06235a 100644 --- a/src/extractor/intersection/intersection_analysis.cpp +++ b/src/extractor/intersection/intersection_analysis.cpp @@ -424,13 +424,11 @@ double findEdgeLength(const IntersectionEdgeGeometries &geometries, const EdgeID } template -bool isTurnRestricted(const RestrictionsRange &restrictions, const NodeID to) +bool isTurnRestricted(RestrictionsRange restrictions, const NodeID to) { // Check if any of the restrictions would prevent a turn to 'to' - return std::any_of(restrictions.begin(), - restrictions.end(), - [&to](const auto &restriction) - { return restriction->IsTurnRestricted(to); }); + return std::ranges::any_of( + restrictions, [&to](const auto &restriction) { return restriction->IsTurnRestricted(to); }); } bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph, diff --git a/src/extractor/restriction_graph.cpp b/src/extractor/restriction_graph.cpp index 6b931f78ca8..1a2b6ab898d 100644 --- a/src/extractor/restriction_graph.cpp +++ b/src/extractor/restriction_graph.cpp @@ -5,7 +5,7 @@ #include "util/timing_util.hpp" #include -#include +#include namespace osrm::extractor { @@ -276,16 +276,16 @@ RestrictionGraph constructRestrictionGraph(const std::vector &t RestrictionGraph::RestrictionRange RestrictionGraph::GetRestrictions(RestrictionID id) const { const auto &node = nodes[id]; - return boost::make_iterator_range(restrictions.begin() + node.restrictions_begin_idx, - restrictions.begin() + node.restrictions_begin_idx + - node.num_restrictions); + return std::ranges::subrange(restrictions.begin() + node.restrictions_begin_idx, + restrictions.begin() + node.restrictions_begin_idx + + node.num_restrictions); } RestrictionGraph::EdgeRange RestrictionGraph::GetEdges(RestrictionID id) const { const auto &node = nodes[id]; - return boost::make_iterator_range(edges.begin() + node.edges_begin_idx, - edges.begin() + node.edges_begin_idx + node.num_edges); + return std::ranges::subrange(edges.begin() + node.edges_begin_idx, + edges.begin() + node.edges_begin_idx + node.num_edges); } } // namespace osrm::extractor diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index 8232f04768f..9aaf7977812 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -23,9 +23,6 @@ #include -#include -#include - namespace sol { template <> struct is_container : std::false_type diff --git a/src/extractor/turn_path_filter.cpp b/src/extractor/turn_path_filter.cpp index 6285656de58..b341b33f0c4 100644 --- a/src/extractor/turn_path_filter.cpp +++ b/src/extractor/turn_path_filter.cpp @@ -5,7 +5,6 @@ #include "util/typedefs.hpp" #include -#include namespace osrm::extractor { @@ -42,8 +41,11 @@ std::vector removeInvalidTurnPaths(std::vector turn_relations, is_valid_edge(via_node_path.via, via_node_path.to); }; - const auto is_valid_way = [is_valid_edge](const auto &via_way_path) + const auto is_valid_way = [is_valid_edge](const ViaWayPath &via_way_path) { + if (!via_way_path.Valid()) + return false; + if (!is_valid_edge(via_way_path.from, via_way_path.via.front())) return false; @@ -59,13 +61,16 @@ std::vector removeInvalidTurnPaths(std::vector turn_relations, const auto is_invalid = [is_valid_way, is_valid_node](const auto &turn_relation) { - if (turn_relation.turn_path.Type() == TurnPathType::VIA_NODE_TURN_PATH) + switch (turn_relation.turn_path.Type()) { + case TurnPathType::VIA_NODE_TURN_PATH: return !is_valid_node(turn_relation.turn_path.AsViaNodePath()); + case TurnPathType::VIA_WAY_TURN_PATH: + return !is_valid_way(turn_relation.turn_path.AsViaWayPath()); + default: + break; } - - BOOST_ASSERT(turn_relation.turn_path.Type() == TurnPathType::VIA_WAY_TURN_PATH); - return !is_valid_way(turn_relation.turn_path.AsViaWayPath()); + return true; }; const auto end_valid_relations = diff --git a/src/extractor/way_restriction_map.cpp b/src/extractor/way_restriction_map.cpp index 890d580317c..b7d257526d9 100644 --- a/src/extractor/way_restriction_map.cpp +++ b/src/extractor/way_restriction_map.cpp @@ -1,8 +1,5 @@ #include "extractor/way_restriction_map.hpp" -#include -#include - namespace osrm::extractor { diff --git a/src/guidance/turn_analysis.cpp b/src/guidance/turn_analysis.cpp index 414b6fdd3a5..5e51a5cbe27 100644 --- a/src/guidance/turn_analysis.cpp +++ b/src/guidance/turn_analysis.cpp @@ -6,7 +6,6 @@ #include "util/coordinate_calculation.hpp" #include -#include #include #include diff --git a/src/guidance/turn_classification.cpp b/src/guidance/turn_classification.cpp index f6d26cfef10..15a4e3209f0 100644 --- a/src/guidance/turn_classification.cpp +++ b/src/guidance/turn_classification.cpp @@ -4,7 +4,6 @@ #include #include -#include namespace osrm::guidance { diff --git a/src/guidance/turn_lane_handler.cpp b/src/guidance/turn_lane_handler.cpp index 9b9bcbace54..19d246bc24e 100644 --- a/src/guidance/turn_lane_handler.cpp +++ b/src/guidance/turn_lane_handler.cpp @@ -9,7 +9,6 @@ #include "util/typedefs.hpp" #include -#include #include diff --git a/src/guidance/turn_lane_matcher.cpp b/src/guidance/turn_lane_matcher.cpp index 31bc1df57dc..e47086ae6da 100644 --- a/src/guidance/turn_lane_matcher.cpp +++ b/src/guidance/turn_lane_matcher.cpp @@ -4,8 +4,6 @@ #include #include -#include - using osrm::util::angularDeviation; namespace osrm::guidance::lanes diff --git a/src/nodejs/node_osrm.cpp b/src/nodejs/node_osrm.cpp index 5971fec1c3b..f8cd7e4756f 100644 --- a/src/nodejs/node_osrm.cpp +++ b/src/nodejs/node_osrm.cpp @@ -1,5 +1,3 @@ - - #include "osrm/engine_config.hpp" #include "osrm/osrm.hpp" @@ -10,10 +8,7 @@ #include "osrm/tile_parameters.hpp" #include "osrm/trip_parameters.hpp" -#include #include -#include -#include #include #include diff --git a/src/osrm/osrm.cpp b/src/osrm/osrm.cpp index 7f0ab103445..3596c06cb48 100644 --- a/src/osrm/osrm.cpp +++ b/src/osrm/osrm.cpp @@ -12,8 +12,6 @@ #include -#include - namespace osrm { diff --git a/src/partitioner/bisection_to_partition.cpp b/src/partitioner/bisection_to_partition.cpp index 9cf5276cf76..10a97fba165 100644 --- a/src/partitioner/bisection_to_partition.cpp +++ b/src/partitioner/bisection_to_partition.cpp @@ -124,7 +124,7 @@ bisectionToPartition(const std::vector &node_to_bisection_id, std::vector num_cells(max_cell_sizes.size()); int level_idx = max_cell_sizes.size() - 1; - for (auto max_cell_size : boost::adaptors::reverse(max_cell_sizes)) + for (auto max_cell_size : std::ranges::reverse_view(max_cell_sizes)) { BOOST_ASSERT(level_idx >= 0); partitionLevel(node_to_bisection_id, max_cell_size, permutation, cells); diff --git a/src/partitioner/dinic_max_flow.cpp b/src/partitioner/dinic_max_flow.cpp index 4038e4b252c..974478f999c 100644 --- a/src/partitioner/dinic_max_flow.cpp +++ b/src/partitioner/dinic_max_flow.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include namespace osrm::partitioner diff --git a/src/partitioner/inertial_flow.cpp b/src/partitioner/inertial_flow.cpp index 04805faaa54..407d767b52f 100644 --- a/src/partitioner/inertial_flow.cpp +++ b/src/partitioner/inertial_flow.cpp @@ -8,8 +8,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/partitioner/recursive_bisection.cpp b/src/partitioner/recursive_bisection.cpp index 63b3a39fdb5..5de66b263a8 100644 --- a/src/partitioner/recursive_bisection.cpp +++ b/src/partitioner/recursive_bisection.cpp @@ -13,7 +13,6 @@ #include // for CHAR_BIT #include #include -#include #include #include diff --git a/src/server/request_parser.cpp b/src/server/request_parser.cpp index fa953febf7c..5d544062866 100644 --- a/src/server/request_parser.cpp +++ b/src/server/request_parser.cpp @@ -6,8 +6,6 @@ #include -#include - namespace osrm::server { diff --git a/src/server/service/match_service.cpp b/src/server/service/match_service.cpp index 22b48245462..7b16853f43e 100644 --- a/src/server/service/match_service.cpp +++ b/src/server/service/match_service.cpp @@ -6,8 +6,6 @@ #include "util/json_container.hpp" -#include - namespace osrm::server::service { namespace diff --git a/src/server/service/nearest_service.cpp b/src/server/service/nearest_service.cpp index 8eb0d1ea037..6ab85c75d8a 100644 --- a/src/server/service/nearest_service.cpp +++ b/src/server/service/nearest_service.cpp @@ -6,8 +6,6 @@ #include "util/json_container.hpp" -#include - namespace osrm::server::service { diff --git a/src/server/service/tile_service.cpp b/src/server/service/tile_service.cpp index ba256cdc668..64512754ea2 100644 --- a/src/server/service/tile_service.cpp +++ b/src/server/service/tile_service.cpp @@ -6,8 +6,6 @@ #include "util/json_container.hpp" -#include - namespace osrm::server::service { diff --git a/src/server/service/trip_service.cpp b/src/server/service/trip_service.cpp index 633a8b606f3..b7ff952a0b8 100644 --- a/src/server/service/trip_service.cpp +++ b/src/server/service/trip_service.cpp @@ -6,8 +6,6 @@ #include "util/json_container.hpp" -#include - namespace osrm::server::service { namespace diff --git a/src/server/service_handler.cpp b/src/server/service_handler.cpp index d7ee9112692..1dd6894ab09 100644 --- a/src/server/service_handler.cpp +++ b/src/server/service_handler.cpp @@ -10,8 +10,6 @@ #include "server/api/parsed_url.hpp" #include "util/json_util.hpp" -#include - namespace osrm::server { ServiceHandler::ServiceHandler(osrm::EngineConfig &config) : routing_machine(config) diff --git a/src/tools/components.cpp b/src/tools/components.cpp index 1f55a3afa14..ae1004b17d9 100644 --- a/src/tools/components.cpp +++ b/src/tools/components.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index e0b0a830b91..f8abdcaedaa 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -10,10 +10,8 @@ #include #include -#include #include #include -#include #include #include "util/meminfo.hpp" diff --git a/src/tools/extract.cpp b/src/tools/extract.cpp index c39ecdc2a8c..1377c77da1f 100644 --- a/src/tools/extract.cpp +++ b/src/tools/extract.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include diff --git a/src/tools/io-benchmark.cpp b/src/tools/io-benchmark.cpp index 966ab9879aa..507d64dc2c6 100644 --- a/src/tools/io-benchmark.cpp +++ b/src/tools/io-benchmark.cpp @@ -11,7 +11,6 @@ #endif #include -#include #include #include #include diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 165d2387d89..3a08db577e3 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -35,9 +35,7 @@ #include #include -#include #include -#include #include #include #include @@ -252,11 +250,11 @@ updateSegmentData(const UpdaterConfig &config, // In this case we want it oriented from in forward directions auto rev_weights_range = - boost::adaptors::reverse(segment_data.GetReverseWeights(geometry_id)); + segment_data.GetReverseWeights(geometry_id) | std::views::reverse; auto rev_durations_range = - boost::adaptors::reverse(segment_data.GetReverseDurations(geometry_id)); + segment_data.GetReverseDurations(geometry_id) | std::views::reverse; auto rev_datasources_range = - boost::adaptors::reverse(segment_data.GetReverseDatasources(geometry_id)); + segment_data.GetReverseDatasources(geometry_id) | std::views::reverse; bool rev_was_updated = false; for (const auto segment_offset : @@ -337,11 +335,11 @@ updateSegmentData(const UpdaterConfig &config, auto new_fwd_durations_range = segment_data.GetForwardDurations(geometry_id); auto new_fwd_datasources_range = segment_data.GetForwardDatasources(geometry_id); auto new_rev_durations_range = - boost::adaptors::reverse(segment_data.GetReverseDurations(geometry_id)); + segment_data.GetReverseDurations(geometry_id) | std::views::reverse; auto new_rev_datasources_range = segment_data.GetReverseDatasources(geometry_id); auto old_fwd_durations_range = segment_data_backup->GetForwardDurations(geometry_id); auto old_rev_durations_range = - boost::adaptors::reverse(segment_data_backup->GetReverseDurations(geometry_id)); + segment_data_backup->GetReverseDurations(geometry_id) | std::views::reverse; for (const auto segment_offset : util::irange(0, new_fwd_durations_range.size())) diff --git a/src/util/assert.cpp b/src/util/assert.cpp index f8a9cc2e6dd..07aea522d5a 100644 --- a/src/util/assert.cpp +++ b/src/util/assert.cpp @@ -1,6 +1,3 @@ -#include - -#include #include #include diff --git a/src/util/coordinate_calculation.cpp b/src/util/coordinate_calculation.cpp index 2e43d2abdae..19fbc2d0eb3 100644 --- a/src/util/coordinate_calculation.cpp +++ b/src/util/coordinate_calculation.cpp @@ -10,7 +10,6 @@ #include #include #include -#include namespace osrm::util::coordinate_calculation { diff --git a/src/util/fingerprint.cpp b/src/util/fingerprint.cpp index caaa85f524c..50e0f973acc 100644 --- a/src/util/fingerprint.cpp +++ b/src/util/fingerprint.cpp @@ -3,13 +3,11 @@ #include "util/exception_utils.hpp" #include "util/version.hpp" -#include #include #include #include -#include namespace osrm::util { diff --git a/src/util/timezones.cpp b/src/util/timezones.cpp index 3352cfaf093..ff1d7dbcaa2 100644 --- a/src/util/timezones.cpp +++ b/src/util/timezones.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/taginfo.json b/taginfo.json index 392e7c66092..dfe48f96a6f 100644 --- a/taginfo.json +++ b/taginfo.json @@ -176,7 +176,7 @@ {"key": "maxspeed", "value": "PH:rural"}, {"key": "maxspeed", "value": "PH:motorway"}, {"key": "maxspeed", "value": "PL:rural"}, - {"key": "maxspeed", "value": "PL:trunk"}, + {"key": "maxspeed", "value": "PL:expressway"}, {"key": "maxspeed", "value": "PL:motorway"}, {"key": "maxspeed", "value": "RO:trunk"}, {"key": "maxspeed", "value": "RU:living_street"}, diff --git a/third_party/libosmium/.clang-tidy b/third_party/libosmium/.clang-tidy index 466adca34bd..66e6dd0784b 100644 --- a/third_party/libosmium/.clang-tidy +++ b/third_party/libosmium/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto' +Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-convert-member-functions-to-static,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto' # # For a list of check options, see: # https://clang.llvm.org/extra/clang-tidy/checks/list.html @@ -137,6 +137,9 @@ Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugpro # This is header only library, so the declaration and implementation are # often the same and we want to have the const in implementations. # +# readability-convert-member-functions-to-static +# Reports too many false positives +# # readability-function-cognitive-complexity # Sometimes the large functions are needed. # diff --git a/third_party/libosmium/.github/actions/cmake-windows/action.yml b/third_party/libosmium/.github/actions/cmake-windows/action.yml index 1812fac8e73..2eafcb79687 100644 --- a/third_party/libosmium/.github/actions/cmake-windows/action.yml +++ b/third_party/libosmium/.github/actions/cmake-windows/action.yml @@ -7,7 +7,13 @@ runs: run: mkdir build shell: bash - name: Configure - run: cmake -LA .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_HEADERS=OFF -DBUILD_BENCHMARKS=ON -DOsmium_DEBUG=TRUE -DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include + run: | + cmake -LA .. \ + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DBUILD_HEADERS=OFF \ + -DBUILD_BENCHMARKS=ON \ + -DOsmium_DEBUG=TRUE \ + -DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include shell: bash working-directory: build diff --git a/third_party/libosmium/.github/actions/install-ubuntu/action.yml b/third_party/libosmium/.github/actions/install-ubuntu/action.yml index b11ee3b3045..1711847c0c1 100644 --- a/third_party/libosmium/.github/actions/install-ubuntu/action.yml +++ b/third_party/libosmium/.github/actions/install-ubuntu/action.yml @@ -5,7 +5,7 @@ runs: steps: - name: Install packages run: | - sudo apt-get update -q + sudo apt-get update -qq sudo apt-get install -yq \ doxygen \ libboost-dev \ @@ -16,8 +16,5 @@ runs: libsparsehash-dev \ ruby-json \ spatialite-bin - test "$CC" = clang-6.0 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-6.0 - test "$CC" = clang-8 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-8 - test "$CC" = clang-13 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-13 shell: bash diff --git a/third_party/libosmium/.github/workflows/ci.yml b/third_party/libosmium/.github/workflows/ci.yml index 73f6991b9bd..95469979f34 100644 --- a/third_party/libosmium/.github/workflows/ci.yml +++ b/third_party/libosmium/.github/workflows/ci.yml @@ -3,14 +3,13 @@ name: CI on: [ push, pull_request ] jobs: - linux: runs-on: ubuntu-latest timeout-minutes: 40 strategy: fail-fast: false matrix: - name: [Ubuntu-18, Ubuntu-20, Ubuntu-21, Debian-9, Debian-10, Debian-11, Debian-Testing, Debian-Experimental, Fedora-34] + name: [Ubuntu-18, Ubuntu-20, Ubuntu-22, Debian-10, Debian-11, Debian-12, Debian-Testing, Debian-Experimental, Fedora-35, Fedora-36, Fedora-37, Fedora-38] build_type: [Dev] cpp_compiler: [g++] cpp_version: [c++11] @@ -19,122 +18,136 @@ jobs: # Uses gcc 7.5.0, clang 6.0.0, cmake 3.10.2 image: "ubuntu:18.04" ubuntu: 18 - installer: apt - name: Ubuntu-20 # Uses gcc 9.3.0, clang 10.0.0, cmake 3.16.3 image: "ubuntu:20.04" ubuntu: 20 - installer: apt - - name: Ubuntu-21 - # Uses gcc 10.3.0, clang, 12.0.0, cmake 3.18.4 - image: "ubuntu:21.04" - ubuntu: 21 - installer: apt - - name: Debian-9 - # Uses gcc 6.3.0, clang 3.8.1, cmake 3.7.2 - image: "debian:stretch" - installer: apt + - name: Ubuntu-22 + # Uses gcc 12.2.0, clang 15.0.7, cmake 3.24.2 + image: "ubuntu:22.04" + ubuntu: 22 + CXXFLAGS: -Wno-stringop-overread - name: Debian-10 # Uses gcc 8.3.0, clang 7.0.1, cmake 3.13.4 image: "debian:buster" - installer: apt - name: Debian-11 # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt cpp_version: c++17 - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt cpp_version: c++20 - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt + c_compiler: clang + cpp_compiler: clang++ + - name: Debian-11 + image: "debian:bullseye" c_compiler: clang cpp_compiler: clang++ cpp_version: c++17 - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt c_compiler: clang cpp_compiler: clang++ cpp_version: c++20 - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt build_type: RelWithDebInfo - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 image: "debian:bullseye" - installer: apt c_compiler: clang cpp_compiler: clang++ - - name: Debian-11 - # Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4 - image: "debian:bullseye" - installer: apt + CXXFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer + LDFLAGS: -fsanitize=address,undefined + - name: Debian-12 + # Uses gcc 12.2.0, clang 15.0.6, cmake 3.25.1 + image: "debian:bookworm" + CXXFLAGS: -Wno-stringop-overread + - name: Debian-12 + image: "debian:bookworm" + cpp_version: c++17 + CXXFLAGS: -Wno-stringop-overread + - name: Debian-12 + image: "debian:bookworm" + cpp_version: c++20 + CXXFLAGS: -Wno-stringop-overread + - name: Debian-12 + image: "debian:bookworm" + c_compiler: clang + cpp_compiler: clang++ + - name: Debian-12 + image: "debian:bookworm" + c_compiler: clang + cpp_compiler: clang++ + cpp_version: c++17 + - name: Debian-12 + image: "debian:bookworm" + c_compiler: clang + cpp_compiler: clang++ + cpp_version: c++20 + - name: Debian-12 + image: "debian:bookworm" + build_type: RelWithDebInfo + CXXFLAGS: -Wno-stringop-overread + - name: Debian-12 + image: "debian:bookworm" c_compiler: clang cpp_compiler: clang++ - CXXFLAGS: -fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer - LDFLAGS: -fsanitize=address,undefined,integer + CXXFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer + LDFLAGS: -fsanitize=address,undefined - name: Debian-Testing - # Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3 image: "debian:testing" - installer: apt - CXXFLAGS: -Wno-stringop-overread + CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference - name: Debian-Testing - # Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3 image: "debian:testing" - installer: apt c_compiler: clang cpp_compiler: clang++ - name: Debian-Experimental - # Uses gcc 11, clang 14, cmake 3.21.3 image: "debian:experimental" - installer: apt - CXXFLAGS: -Wno-stringop-overread + CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference - name: Debian-Experimental - # Uses gcc 11, clang 14, cmake 3.21.3 image: "debian:experimental" - installer: apt - c_compiler: clang-14 - cpp_compiler: clang++-14 - - name: Fedora-34 - # Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5 - image: "fedora:34" - installer: dnf - CXXFLAGS: -Wno-stringop-overread + c_compiler: clang + cpp_compiler: clang++ - name: Fedora-35 # Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5 image: "fedora:35" - installer: dnf CXXFLAGS: -Wno-stringop-overread + - name: Fedora-36 + # Uses gcc 12.2.0, clang 14.0.5, cmake 3.24.2 + image: "fedora:36" + CXXFLAGS: -Wno-stringop-overread + - name: Fedora-37 + # Uses gcc 12.3.1, clang 15.0.7, cmake 3.26.4 + image: "fedora:37" + CXXFLAGS: -Wno-stringop-overread + - name: Fedora-38 + # Uses gcc 13.0.1, clang 16.0.5, cmake 3.26.4 + image: "fedora:38" + CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference container: image: ${{ matrix.image }} env: LANG: en_US.UTF-8 BUILD_TYPE: ${{ matrix.build_type }} - CXXFLAGS: ${{ matrix.CXXFLAGS }} - LDFLAGS: ${{ matrix.LDFLAGS }} CC: ${{ matrix.c_compiler }} CXX: ${{ matrix.cpp_compiler }} + CXXFLAGS: ${{ matrix.CXXFLAGS }} + LDFLAGS: ${{ matrix.LDFLAGS }} CPP_VERSION: ${{ matrix.cpp_version }} WITH_PROJ: ON + APT_LISTCHANGES_FRONTEND: none + DEBIAN_FRONTEND: noninteractive steps: - name: Prepare container (apt) + shell: bash + if: startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:') run: | - export APT_LISTCHANGES_FRONTEND=none - export DEBIAN_FRONTEND=noninteractive apt-get update -qq - apt-get install -y \ + apt-get install -yq \ clang \ cmake \ doxygen \ @@ -154,16 +167,13 @@ jobs: ruby-json \ spatialite-bin \ zlib1g-dev - shell: bash - if: matrix.installer == 'apt' - name: Install compiler shell: bash - run: | - export APT_LISTCHANGES_FRONTEND=none - export DEBIAN_FRONTEND=noninteractive - apt-get install -y clang-14 if: matrix.cpp_compiler == 'clang++-14' + run: apt-get install -yq clang-14 - name: Prepare container (dnf) + shell: bash + if: startsWith(matrix.image, 'fedora:') run: | dnf install --quiet --assumeyes \ boost-devel \ @@ -185,9 +195,7 @@ jobs: sparsehash-devel \ spatialite-tools \ zlib-devel - shell: bash - if: matrix.installer == 'dnf' - # Use v1 of checkout because v2 doesn't work with submodules + # Use v1 of checkout because v3 doesn't work with submodules - uses: actions/checkout@v1 with: submodules: true @@ -197,21 +205,23 @@ jobs: - uses: ./.github/actions/ctest ubuntu-latest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 40 env: - CC: clang-13 - CXX: clang++-13 + CC: clang-15 + CXX: clang++-15 BUILD_TYPE: Dev WITH_PROJ: ON steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Install new clang run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main' + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm-snapshot.asc + sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main' + sudo apt-get update -qq + sudo apt-get install -yq clang-15 shell: bash - uses: ./.github/actions/install-ubuntu - uses: ./.github/actions/install-protozero @@ -219,52 +229,27 @@ jobs: - uses: ./.github/actions/build - uses: ./.github/actions/ctest - macos10-dev: - runs-on: macos-10.15 - timeout-minutes: 60 - env: - CC: clang - CXX: clang++ - BUILD_TYPE: Dev - WITH_PROJ: OFF - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: ./.github/actions/install-macos - - uses: ./.github/actions/install-protozero - - uses: ./.github/actions/cmake - - uses: ./.github/actions/build - - uses: ./.github/actions/ctest - - macos11-dev: - runs-on: macos-11 - timeout-minutes: 60 - env: - CC: clang - CXX: clang++ - BUILD_TYPE: Dev - WITH_PROJ: OFF - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: ./.github/actions/install-macos - - uses: ./.github/actions/install-protozero - - uses: ./.github/actions/cmake - - uses: ./.github/actions/build - - uses: ./.github/actions/ctest - - macos11-release: - runs-on: macos-11 + macos: timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + os: + - "macos-11" + - "macos-12" + - "macos-13" + build_type: [Dev] + include: + - os: "macos-12" + build_type: Release + runs-on: ${{ matrix.os }} env: CC: clang CXX: clang++ - BUILD_TYPE: Release + BUILD_TYPE: ${{ matrix.build_type }} WITH_PROJ: OFF steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - uses: ./.github/actions/install-macos @@ -273,11 +258,17 @@ jobs: - uses: ./.github/actions/build - uses: ./.github/actions/ctest - windows-2019-minimal: - runs-on: windows-2019 + windows-minimal: timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + os: + - windows-2019 + - windows-2022 + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - uses: ./.github/actions/install-windows @@ -289,7 +280,7 @@ jobs: windows-2019-full: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - uses: ./.github/actions/install-windows @@ -301,16 +292,3 @@ jobs: - uses: ./.github/actions/build-windows - uses: ./.github/actions/ctest-windows - windows-2022-minimal: - runs-on: windows-2022 - timeout-minutes: 40 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: ./.github/actions/install-windows - - uses: ./.github/actions/install-protozero - - uses: ./.github/actions/cmake-windows - - uses: ./.github/actions/build-windows - - uses: ./.github/actions/ctest-windows - diff --git a/third_party/libosmium/.github/workflows/clang-tidy.yml b/third_party/libosmium/.github/workflows/clang-tidy.yml index 4328b5e81d8..a6c0b335915 100644 --- a/third_party/libosmium/.github/workflows/clang-tidy.yml +++ b/third_party/libosmium/.github/workflows/clang-tidy.yml @@ -3,7 +3,6 @@ name: clang-tidy on: workflow_dispatch jobs: - clang-tidy: runs-on: ubuntu-latest strategy: @@ -14,9 +13,9 @@ jobs: - image: "debian:bullseye" clang: 11 - image: "debian:testing" - clang: 12 + clang: 15 - image: "debian:experimental" - clang: 14 + clang: 15 container: image: ${{ matrix.image }} env: @@ -25,29 +24,29 @@ jobs: CXX: clang++-${{ matrix.clang }} CPP_VERSION: c++11 WITH_PROJ: ON + APT_LISTCHANGES_FRONTEND: none + DEBIAN_FRONTEND: noninteractive steps: - name: Prepare container (apt) run: | - export APT_LISTCHANGES_FRONTEND=none - export DEBIAN_FRONTEND=noninteractive apt-get update -qq - apt-get install -y \ - clang-${{ matrix.clang }} \ - clang-tidy-${{ matrix.clang }} \ - cmake \ - git \ - libboost-dev \ - libbz2-dev \ - libexpat1-dev \ - libgdal-dev \ - libgeos++-dev \ - liblz4-dev \ - libproj-dev \ - libsparsehash-dev \ - make \ - zlib1g-dev + apt-get install -yq \ + clang-${{ matrix.clang }} \ + clang-tidy-${{ matrix.clang }} \ + cmake \ + git \ + libboost-dev \ + libbz2-dev \ + libexpat1-dev \ + libgdal-dev \ + libgeos++-dev \ + liblz4-dev \ + libproj-dev \ + libsparsehash-dev \ + make \ + zlib1g-dev shell: bash - # Use v1 of checkout because v2 doesn't work with submodules + # Use v1 of checkout because v3 doesn't work with submodules - uses: actions/checkout@v1 with: submodules: true @@ -58,7 +57,7 @@ jobs: shell: bash working-directory: build - name: Upload Log - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: clang-tidy-${{ matrix.clang }}-log diff --git a/third_party/libosmium/.ycm_extra_conf.py b/third_party/libosmium/.ycm_extra_conf.py deleted file mode 100644 index a89927357fb..00000000000 --- a/third_party/libosmium/.ycm_extra_conf.py +++ /dev/null @@ -1,53 +0,0 @@ -#----------------------------------------------------------------------------- -# -# Configuration for YouCompleteMe Vim plugin -# -# https://valloric.github.io/YouCompleteMe/ -# -#----------------------------------------------------------------------------- - -from os.path import realpath, dirname - -basedir = dirname(realpath(__file__)) - -# some default flags -# for more information install clang-3.2-doc package and -# check UsersManual.html -flags = [ -'-Werror', -'-Wall', -'-Wextra', -'-pedantic', -'-Wno-return-type', -'-Wno-unused-parameter', -'-Wno-unused-variable', - -'-std=c++11', - -# '-x' and 'c++' also required -# use 'c' for C projects -'-x', -'c++', - -# workaround for https://github.com/Valloric/YouCompleteMe/issues/303 -# also see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800618 -'-isystem', -'/usr/lib/ycmd/clang_includes/', - -# libosmium include dirs -'-I%s/include' % basedir, -'-I%s/test/include' % basedir, -'-I%s/test/data-test/include' % basedir, - -# include third party libraries -'-I/usr/include/gdal', -] - -# youcompleteme is calling this function to get flags -# You can also set database for flags. Check: JSONCompilationDatabase.html in -# clang-3.2-doc package -def FlagsForFile( filename ): - return { - 'flags': flags, - 'do_cache': True - } diff --git a/third_party/libosmium/CHANGELOG.md b/third_party/libosmium/CHANGELOG.md index 1c2fd6639b3..231f3a25de3 100644 --- a/third_party/libosmium/CHANGELOG.md +++ b/third_party/libosmium/CHANGELOG.md @@ -12,6 +12,38 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +## [2.20.0] - 2023-09-20 + +### Changed + +* Optionally allow fractional seconds in timestamps in OSM files. +* Enable `posix_fadvise` usage on FreeBSD. +* Make parsing PBFs a bit less picky. +* Various small code cleanups. + +### Fixed + +* Don't use class template arguments on `GeometryFactory` constructor + definition. + +## [2.19.0] - 2023-01-19 + +### Changed + +* Mark RapidJSON support as deprecated. +* Update included Catch to v2.13.10. +* Remove deprecated BoolVector class. +* Remove deprecated NWRIdSet class. +* Remove deprecated AssemblerConfig constructor. +* Print start of offending string in overlong string exception. +* Implement `set_thread_name()` on FreeBSD. +* Some small code cleanups. + +### Fixed + +* Fix return type in `MembersDatabaseCommon::count_not_removed()`. +* Make bzip2 unit tests pass on musl-based systems. +* Fix bug in members database test case. ## [2.18.0] - 2022-02-07 @@ -1253,7 +1285,9 @@ long time. These will not be part of the next version of libosmium: Doxygen (up to version 1.8.8). This version contains a workaround to fix this. -[unreleased]: https://github.com/osmcode/libosmium/compare/v2.18.0...HEAD +[unreleased]: https://github.com/osmcode/libosmium/compare/v2.20.0...HEAD +[2.20.0]: https://github.com/osmcode/libosmium/compare/v2.19.0...v2.20.0 +[2.19.0]: https://github.com/osmcode/libosmium/compare/v2.18.9...v2.19.0 [2.18.0]: https://github.com/osmcode/libosmium/compare/v2.17.3...v2.18.0 [2.17.3]: https://github.com/osmcode/libosmium/compare/v2.17.2...v2.17.3 [2.17.2]: https://github.com/osmcode/libosmium/compare/v2.17.1...v2.17.2 diff --git a/third_party/libosmium/CMakeLists.txt b/third_party/libosmium/CMakeLists.txt index 11d75669236..c9c15bafa4b 100644 --- a/third_party/libosmium/CMakeLists.txt +++ b/third_party/libosmium/CMakeLists.txt @@ -39,7 +39,7 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Cover project(libosmium) set(LIBOSMIUM_VERSION_MAJOR 2) -set(LIBOSMIUM_VERSION_MINOR 18) +set(LIBOSMIUM_VERSION_MINOR 20) set(LIBOSMIUM_VERSION_PATCH 0) set(LIBOSMIUM_VERSION @@ -427,7 +427,7 @@ endif() # #----------------------------------------------------------------------------- message(STATUS "Looking for clang-tidy") -find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11) +find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-16 clang-tidy-15 clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11) if(CLANG_TIDY) message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}") diff --git a/third_party/libosmium/NOTES_FOR_DEVELOPERS.md b/third_party/libosmium/NOTES_FOR_DEVELOPERS.md index 9bc9a500476..f00f61b40fe 100644 --- a/third_party/libosmium/NOTES_FOR_DEVELOPERS.md +++ b/third_party/libosmium/NOTES_FOR_DEVELOPERS.md @@ -136,8 +136,7 @@ directory, some data tests in `test/osm-testdata` and tests of the examples in `test/examples`. They are built by the default cmake config. Run `ctest` to run them. We can always use more tests. -Tests are run automatically using Github Actions (Linux/macOS) and Appveyor -(Windows) services. +Tests are run automatically using Github Actions. ## Documenting the code diff --git a/third_party/libosmium/README.md b/third_party/libosmium/README.md index 7430673d017..4d73ed7a8c1 100644 --- a/third_party/libosmium/README.md +++ b/third_party/libosmium/README.md @@ -7,8 +7,6 @@ A fast and flexible C++ library for working with OpenStreetMap data. Libosmium works on Linux, macOS and Windows. [![Github Build Status](https://github.com/osmcode/libosmium/workflows/CI/badge.svg?branch=master)](https://github.com/osmcode/libosmium/actions) -[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/yy099a4vxcb604rn/branch/master?svg=true)](https://ci.appveyor.com/project/lonvia/libosmium-eq41p/branch/master) -[![Coverage Status](https://codecov.io/gh/osmcode/libosmium/branch/master/graph/badge.svg)](https://codecov.io/gh/osmcode/libosmium) [![Packaging status](https://repology.org/badge/tiny-repos/libosmium.svg)](https://repology.org/metapackage/libosmium) Please see the [Libosmium manual](https://osmcode.org/libosmium/manual.html) @@ -17,9 +15,8 @@ for more details than this README can provide. ## Prerequisites -Because Libosmium uses many C++11 features you need a modern compiler and -standard C++ library. Osmium needs at least GCC 4.8 or clang (LLVM) 3.4. -(Some parts may work with older versions.) +You need a C++11 compiler and standard C++ library. Osmium needs at least GCC +4.8 or clang (LLVM) 3.4. (Some parts may work with older versions.) Different parts of Libosmium (and the applications built on top of it) need different libraries. You DO NOT NEED to install all of them, just install those @@ -88,13 +85,6 @@ See the for instructions. -## Switching from the old Osmium - -If you have been using the old version of Osmium at -https://github.com/joto/osmium you might want to read about the [changes -needed](https://osmcode.org/libosmium/manual.html#changes-from-old-versions-of-osmium). - - ## License Libosmium is available under the Boost Software License. See LICENSE. diff --git a/third_party/libosmium/benchmarks/osmium_benchmark_static_vs_dynamic_index.cpp b/third_party/libosmium/benchmarks/osmium_benchmark_static_vs_dynamic_index.cpp index c2b9c145e97..e8d38386744 100644 --- a/third_party/libosmium/benchmarks/osmium_benchmark_static_vs_dynamic_index.cpp +++ b/third_party/libosmium/benchmarks/osmium_benchmark_static_vs_dynamic_index.cpp @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { try { const std::string input_filename{argv[1]}; - osmium::memory::Buffer buffer{osmium::io::read_file(input_filename)}; + const osmium::memory::Buffer buffer{osmium::io::read_file(input_filename)}; const auto& map_factory = osmium::index::MapFactory::instance(); diff --git a/third_party/libosmium/benchmarks/osmium_benchmark_write_pbf.cpp b/third_party/libosmium/benchmarks/osmium_benchmark_write_pbf.cpp index 9c9f026ef17..e4542140c16 100644 --- a/third_party/libosmium/benchmarks/osmium_benchmark_write_pbf.cpp +++ b/third_party/libosmium/benchmarks/osmium_benchmark_write_pbf.cpp @@ -18,12 +18,12 @@ int main(int argc, char* argv[]) { } try { - std::string input_filename{argv[1]}; - std::string output_filename{argv[2]}; + const std::string input_filename{argv[1]}; + const std::string output_filename{argv[2]}; osmium::io::Reader reader{input_filename}; - osmium::io::File output_file{output_filename, "pbf"}; - osmium::io::Header header; + const osmium::io::File output_file{output_filename, "pbf"}; + const osmium::io::Header header; osmium::io::Writer writer{output_file, header, osmium::io::overwrite::allow}; while (osmium::memory::Buffer buffer = reader.read()) { // NOLINT(bugprone-use-after-move) Bug in clang-tidy https://bugs.llvm.org/show_bug.cgi?id=36516 diff --git a/third_party/libosmium/build-appveyor.bat b/third_party/libosmium/build-appveyor.bat index 80c0550f698..5d0064b40b4 100644 --- a/third_party/libosmium/build-appveyor.bat +++ b/third_party/libosmium/build-appveyor.bat @@ -24,6 +24,11 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR SET PATH=C:/projects/bzip2.v140.1.0.6.9/build/native/bin/x64/%config%;%PATH% +nuget install lz4 -Version 1.3.1.2 +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +SET PATH=C:/projects/lz4.1.3.1.2/build/native/bin/x64/%config%;%PATH% + CD libosmium ECHO config^: %config% @@ -52,7 +57,9 @@ SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^ -DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^ -DEXPAT_LIBRARY=C:/projects/expat.v140.2.2.5/build/native/lib/x64/%config%/libexpat%libpostfix%.lib ^ -DBZIP2_INCLUDE_DIR=C:/projects/bzip2.v140.1.0.6.9/build/native/include ^ --DBZIP2_LIBRARIES=C:/projects/bzip2.v140.1.0.6.9/build/native/lib/x64/%config%/libbz2%libpostfix%.lib +-DBZIP2_LIBRARIES=C:/projects/bzip2.v140.1.0.6.9/build/native/lib/x64/%config%/libbz2%libpostfix%.lib ^ +-DLZ4_INCLUDE_DIR=C:/projects/lz4.1.3.1.2/build/native/include ^ +-DLZ4_LIBRARY=C:/projects/lz4.1.3.1.2/build/native/lib/x64/%config%/liblz4%libpostfix%.lib ECHO calling^: %CMAKE_CMD% %CMAKE_CMD% diff --git a/third_party/libosmium/build-msys2.bat b/third_party/libosmium/build-msys2.bat index bf2f231865e..9c00a3573be 100644 --- a/third_party/libosmium/build-msys2.bat +++ b/third_party/libosmium/build-msys2.bat @@ -16,8 +16,9 @@ call C:\msys64\mingw64\bin\gem.cmd install json REM Workaround for problem with spatialite (see https://github.com/osmcode/libosmium/issues/262) copy /y C:\msys64\mingw64\bin\libreadline8.dll C:\msys64\mingw64\bin\libreadline7.dll -echo "Setting PROJ_LIB variable for correct PROJ.4 working" +echo "Setting PROJ_LIB/DATA variable for correct PROJ.4 working" set PROJ_LIB=c:\msys64\mingw64\share\proj +set PROJ_DATA=c:\msys64\mingw64\share\proj set CXXFLAGS=-Wno-stringop-overflow diff --git a/third_party/libosmium/examples/osmium_amenity_list.cpp b/third_party/libosmium/examples/osmium_amenity_list.cpp index 17b2bede70e..3103d0679b7 100644 --- a/third_party/libosmium/examples/osmium_amenity_list.cpp +++ b/third_party/libosmium/examples/osmium_amenity_list.cpp @@ -74,8 +74,8 @@ class AmenityHandler : public osmium::handler::Handler { c.y += nr.lat(); } - c.x /= nr_list.size(); - c.y /= nr_list.size(); + c.x /= static_cast(nr_list.size()); + c.y /= static_cast(nr_list.size()); return c; } diff --git a/third_party/libosmium/examples/osmium_area_test.cpp b/third_party/libosmium/examples/osmium_area_test.cpp index 4df749d6c54..ac24ac810f1 100644 --- a/third_party/libosmium/examples/osmium_area_test.cpp +++ b/third_party/libosmium/examples/osmium_area_test.cpp @@ -122,11 +122,11 @@ int main(int argc, char* argv[]) { return 1; } - osmium::io::File input_file{argv[2]}; + const osmium::io::File input_file{argv[2]}; // Configuration for the multipolygon assembler. Here the default settings // are used, but you could change multiple settings. - osmium::area::Assembler::config_type assembler_config; + const osmium::area::Assembler::config_type assembler_config; // Set up a filter matching only forests. This will be used to only build // areas with matching tags. diff --git a/third_party/libosmium/examples/osmium_change_tags.cpp b/third_party/libosmium/examples/osmium_change_tags.cpp index 4348d17dd28..e85e5aaeea1 100644 --- a/third_party/libosmium/examples/osmium_change_tags.cpp +++ b/third_party/libosmium/examples/osmium_change_tags.cpp @@ -153,8 +153,8 @@ int main(int argc, char* argv[]) { } // Get input and output file names from command line. - std::string input_file_name{argv[1]}; - std::string output_file_name{argv[2]}; + const std::string input_file_name{argv[1]}; + const std::string output_file_name{argv[2]}; try { // Initialize Reader diff --git a/third_party/libosmium/examples/osmium_count.cpp b/third_party/libosmium/examples/osmium_count.cpp index 71361ccfe5f..34bc687486f 100644 --- a/third_party/libosmium/examples/osmium_count.cpp +++ b/third_party/libosmium/examples/osmium_count.cpp @@ -68,7 +68,7 @@ int main(int argc, char* argv[]) { try { // The Reader is initialized here with an osmium::io::File, but could // also be directly initialized with a file name. - osmium::io::File input_file{argv[1]}; + const osmium::io::File input_file{argv[1]}; osmium::io::Reader reader{input_file}; // Create an instance of our own CountHandler and push the data from the @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) { // (though not this one) can use huge amounts of data. So checking actual // memore usage is often useful and can be done easily with this class. // (Currently only works on Linux, not macOS and Windows.) - osmium::MemoryUsage memory; + const osmium::MemoryUsage memory; std::cout << "\nMemory used: " << memory.peak() << " MBytes\n"; } catch (const std::exception& e) { diff --git a/third_party/libosmium/examples/osmium_create_pois.cpp b/third_party/libosmium/examples/osmium_create_pois.cpp index 44de48da16f..8a30ff22ee9 100644 --- a/third_party/libosmium/examples/osmium_create_pois.cpp +++ b/third_party/libosmium/examples/osmium_create_pois.cpp @@ -40,11 +40,11 @@ int main(int argc, char* argv[]) { } // Get output file name from command line. - std::string output_file_name{argv[1]}; + const std::string output_file_name{argv[1]}; // If output file name is "-", this means STDOUT. Set the OPL file type // in this case. Otherwise take the file type from the file name suffix. - osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""}; + const osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""}; try { // Create a buffer where all objects will live. Use a sensible initial diff --git a/third_party/libosmium/examples/osmium_debug.cpp b/third_party/libosmium/examples/osmium_debug.cpp index d511fc8d1b8..8c9844c5cd4 100644 --- a/third_party/libosmium/examples/osmium_debug.cpp +++ b/third_party/libosmium/examples/osmium_debug.cpp @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) { // Get entity types from command line if there is a 2nd argument. if (argc == 3) { read_types = osmium::osm_entity_bits::nothing; - std::string types = argv[2]; + const std::string types = argv[2]; if (types.find('n') != std::string::npos) { read_types |= osmium::osm_entity_bits::node; } diff --git a/third_party/libosmium/examples/osmium_dump_internal.cpp b/third_party/libosmium/examples/osmium_dump_internal.cpp index e655813bc7d..16f11d83128 100644 --- a/third_party/libosmium/examples/osmium_dump_internal.cpp +++ b/third_party/libosmium/examples/osmium_dump_internal.cpp @@ -165,31 +165,31 @@ int main(int argc, char* argv[]) { reader.close(); // Write out node, way, and relation offset indexes to disk. - IndexFile nodes_idx{output_dir + "/nodes.idx"}; + const IndexFile nodes_idx{output_dir + "/nodes.idx"}; node_index.dump_as_list(nodes_idx.fd()); - IndexFile ways_idx{output_dir + "/ways.idx"}; + const IndexFile ways_idx{output_dir + "/ways.idx"}; way_index.dump_as_list(ways_idx.fd()); - IndexFile relations_idx{output_dir + "/relations.idx"}; + const IndexFile relations_idx{output_dir + "/relations.idx"}; relation_index.dump_as_list(relations_idx.fd()); // Sort the maps (so later binary search will work on them) and write // them to disk. map_node2way.sort(); - IndexFile node2way_idx{output_dir + "/node2way.map"}; + const IndexFile node2way_idx{output_dir + "/node2way.map"}; map_node2way.dump_as_list(node2way_idx.fd()); map_node2relation.sort(); - IndexFile node2relation_idx{output_dir + "/node2rel.map"}; + const IndexFile node2relation_idx{output_dir + "/node2rel.map"}; map_node2relation.dump_as_list(node2relation_idx.fd()); map_way2relation.sort(); - IndexFile way2relation_idx{output_dir + "/way2rel.map"}; + const IndexFile way2relation_idx{output_dir + "/way2rel.map"}; map_way2relation.dump_as_list(way2relation_idx.fd()); map_relation2relation.sort(); - IndexFile relation2relation_idx{output_dir + "/rel2rel.map"}; + const IndexFile relation2relation_idx{output_dir + "/rel2rel.map"}; map_relation2relation.dump_as_list(relation2relation_idx.fd()); } catch (const std::exception& e) { // All exceptions used by the Osmium library derive from std::exception. diff --git a/third_party/libosmium/examples/osmium_filter_discussions.cpp b/third_party/libosmium/examples/osmium_filter_discussions.cpp index 089b28ab2f8..2de151724a4 100644 --- a/third_party/libosmium/examples/osmium_filter_discussions.cpp +++ b/third_party/libosmium/examples/osmium_filter_discussions.cpp @@ -47,10 +47,10 @@ int main(int argc, char* argv[]) { try { // The input file, deduce file format from file suffix. - osmium::io::File input_file{argv[1]}; + const osmium::io::File input_file{argv[1]}; // The output file, force XML OSM file format. - osmium::io::File output_file{argv[2], "osm"}; + const osmium::io::File output_file{argv[2], "osm"}; // Initialize Reader for the input file. // Read only changesets (will ignore nodes, ways, and diff --git a/third_party/libosmium/examples/osmium_index_lookup.cpp b/third_party/libosmium/examples/osmium_index_lookup.cpp index d58a743ed16..fa60d043393 100644 --- a/third_party/libosmium/examples/osmium_index_lookup.cpp +++ b/third_party/libosmium/examples/osmium_index_lookup.cpp @@ -67,8 +67,8 @@ class IndexAccess { IndexAccess(const IndexAccess&) = delete; IndexAccess& operator=(const IndexAccess&) = delete; - IndexAccess(IndexAccess&&) = delete; - IndexAccess& operator=(IndexAccess&&) = delete; + IndexAccess(IndexAccess&&) noexcept = delete; + IndexAccess& operator=(IndexAccess&&) noexcept = delete; virtual ~IndexAccess() noexcept = default; @@ -106,7 +106,7 @@ class IndexAccessDense : public IndexAccess { ~IndexAccessDense() noexcept override = default; void dump() const override { - index_type index{this->fd()}; + const index_type index{this->fd()}; for (std::size_t i = 0; i < index.size(); ++i) { if (index.get(i) != TValue{}) { @@ -116,7 +116,7 @@ class IndexAccessDense : public IndexAccess { } bool search(const osmium::unsigned_object_id_type& key) const override { - index_type index{this->fd()}; + const index_type index{this->fd()}; try { TValue value = index.get(key); @@ -153,7 +153,7 @@ class IndexAccessSparse : public IndexAccess { ~IndexAccessSparse() noexcept override = default; void dump() const override { - index_type index{this->fd()}; + const index_type index{this->fd()}; for (const auto& element : index) { std::cout << element.first << " " << element.second << "\n"; @@ -164,7 +164,7 @@ class IndexAccessSparse : public IndexAccess { using element_type = typename index_type::element_type; index_type index{this->fd()}; - element_type elem{key, TValue{}}; + const element_type elem{key, TValue{}}; const auto positions = std::equal_range(index.begin(), index.end(), elem, @@ -347,7 +347,7 @@ int run(const IndexAccess& index, const Options& options) { int main(int argc, char* argv[]) { // Parse command line options. - Options options{argc, argv}; + const Options options{argc, argv}; // Open the index file. const int fd = ::open(options.filename(), O_RDWR); diff --git a/third_party/libosmium/examples/osmium_read.cpp b/third_party/libosmium/examples/osmium_read.cpp index bf0203fbd92..ac8531044d5 100644 --- a/third_party/libosmium/examples/osmium_read.cpp +++ b/third_party/libosmium/examples/osmium_read.cpp @@ -27,11 +27,11 @@ int main(int argc, char* argv[]) { try { // The Reader is initialized here with an osmium::io::File, but could // also be directly initialized with a file name. - osmium::io::File input_file{argv[1]}; + const osmium::io::File input_file{argv[1]}; osmium::io::Reader reader{input_file}; // OSM data comes in buffers, read until there are no more. - while (osmium::memory::Buffer buffer = reader.read()) { + while (const osmium::memory::Buffer buffer = reader.read()) { // do nothing } diff --git a/third_party/libosmium/examples/osmium_read_with_progress.cpp b/third_party/libosmium/examples/osmium_read_with_progress.cpp index 9cf752d1ff5..345348f7a68 100644 --- a/third_party/libosmium/examples/osmium_read_with_progress.cpp +++ b/third_party/libosmium/examples/osmium_read_with_progress.cpp @@ -34,14 +34,14 @@ int main(int argc, char* argv[]) { try { // The Reader is initialized here with an osmium::io::File, but could // also be directly initialized with a file name. - osmium::io::File input_file{argv[1]}; + const osmium::io::File input_file{argv[1]}; osmium::io::Reader reader{input_file}; // Initialize progress bar, enable it only if STDERR is a TTY. osmium::ProgressBar progress{reader.file_size(), osmium::isatty(2)}; // OSM data comes in buffers, read until there are no more. - while (osmium::memory::Buffer buffer = reader.read()) { + while (const osmium::memory::Buffer buffer = reader.read()) { // Update progress bar for each buffer. progress.update(reader.offset()); } diff --git a/third_party/libosmium/examples/osmium_tiles.cpp b/third_party/libosmium/examples/osmium_tiles.cpp index 27c1721be83..4a6a1f7b9b2 100644 --- a/third_party/libosmium/examples/osmium_tiles.cpp +++ b/third_party/libosmium/examples/osmium_tiles.cpp @@ -68,7 +68,7 @@ int main(int argc, char* argv[]) { // Create a tile at this location. This will also internally use the // Mercator projection and then calculate the tile coordinates. - const osmium::geom::Tile tile{uint32_t(zoom), location}; + const osmium::geom::Tile tile{static_cast(zoom), location}; std::cout << "Tile: zoom=" << tile.z << " x=" << tile.x << " y=" << tile.y << "\n"; } diff --git a/third_party/libosmium/include/osmium/area/assembler.hpp b/third_party/libosmium/include/osmium/area/assembler.hpp index cc9ac2c62b9..9ed2d5ff13b 100644 --- a/third_party/libosmium/include/osmium/area/assembler.hpp +++ b/third_party/libosmium/include/osmium/area/assembler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -213,7 +213,7 @@ namespace osmium { // Now create the Area object and add the attributes and tags // from the relation. - bool okay = create_area(out_buffer, relation, members); + const bool okay = create_area(out_buffer, relation, members); if (okay) { out_buffer.commit(); } else { diff --git a/third_party/libosmium/include/osmium/area/assembler_config.hpp b/third_party/libosmium/include/osmium/area/assembler_config.hpp index 1a999d3a9b4..5fa11d2cab8 100644 --- a/third_party/libosmium/include/osmium/area/assembler_config.hpp +++ b/third_party/libosmium/include/osmium/area/assembler_config.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -124,15 +124,6 @@ namespace osmium { AssemblerConfig() noexcept = default; - /** - * Constructor - * @deprecated Use default constructor and set values afterwards. - */ - explicit AssemblerConfig(ProblemReporter* pr, bool d = false) : - problem_reporter(pr), - debug_level(d) { - } - }; // struct AssemblerConfig } // namespace area diff --git a/third_party/libosmium/include/osmium/area/assembler_legacy.hpp b/third_party/libosmium/include/osmium/area/assembler_legacy.hpp index 0ca48735ca6..23bfa2bca61 100644 --- a/third_party/libosmium/include/osmium/area/assembler_legacy.hpp +++ b/third_party/libosmium/include/osmium/area/assembler_legacy.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -332,10 +332,10 @@ namespace osmium { if (!way.nodes().empty() && way.is_closed() && !way.tags().empty()) { const auto d = std::count_if(way.tags().cbegin(), way.tags().cend(), std::cref(filter())); if (d > 0) { - osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend()); - osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend()); - osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend()); - osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend()); + const osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend()); + const osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend()); + const osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend()); + const osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend()); #ifdef __cpp_lib_robust_nonmodifying_seq_ops if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin, area_fi_end)) { #else diff --git a/third_party/libosmium/include/osmium/area/detail/basic_assembler.hpp b/third_party/libosmium/include/osmium/area/detail/basic_assembler.hpp index 0fa8feb43df..84213624973 100644 --- a/third_party/libosmium/include/osmium/area/detail/basic_assembler.hpp +++ b/third_party/libosmium/include/osmium/area/detail/basic_assembler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -608,7 +608,7 @@ namespace osmium { void create_rings_simple_case() { auto count_remaining = m_segment_list.size(); - for (slocation& sl : m_locations) { + for (const slocation& sl : m_locations) { const NodeRefSegment& segment = m_segment_list[sl.item]; if (!segment.is_done()) { count_remaining -= add_new_ring(sl); @@ -671,7 +671,7 @@ namespace osmium { std::cerr << " Trying to merge " << open_ring_its.size() << " open rings (try_to_merge)\n"; } - std::vector xrings = create_location_to_ring_map(open_ring_its); + const auto xrings = create_location_to_ring_map(open_ring_its); auto it = xrings.cbegin(); while (it != xrings.cend()) { @@ -825,7 +825,7 @@ namespace osmium { find_inner_outer_complex(); ProtoRing* outer_ring = find_enclosing_ring(ring_min->ring().min_segment()); - bool ring_min_is_outer = !outer_ring; + const bool ring_min_is_outer = !outer_ring; if (debug()) { std::cerr << " Open ring is " << (ring_min_is_outer ? "outer" : "inner") << " ring\n"; } @@ -924,7 +924,7 @@ namespace osmium { // Now find all the rest of the rings (ie not starting at split locations) if (count_remaining > 0) { - for (slocation& sl : m_locations) { + for (const slocation& sl : m_locations) { const NodeRefSegment& segment = m_segment_list[sl.item]; if (!segment.is_done()) { count_remaining -= add_new_ring_complex(sl); diff --git a/third_party/libosmium/include/osmium/area/detail/basic_assembler_with_tags.hpp b/third_party/libosmium/include/osmium/area/detail/basic_assembler_with_tags.hpp index fa7aad110b6..b5a173b44f5 100644 --- a/third_party/libosmium/include/osmium/area/detail/basic_assembler_with_tags.hpp +++ b/third_party/libosmium/include/osmium/area/detail/basic_assembler_with_tags.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/detail/node_ref_segment.hpp b/third_party/libosmium/include/osmium/area/detail/node_ref_segment.hpp index 3db137f1a3a..8da4f8ccf17 100644 --- a/third_party/libosmium/include/osmium/area/detail/node_ref_segment.hpp +++ b/third_party/libosmium/include/osmium/area/detail/node_ref_segment.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -193,7 +193,7 @@ namespace osmium { const char* role_name() const noexcept { static const std::array names = {{"unknown", "outer", "inner", "empty"}}; - return names[int(m_role)]; + return names[static_cast(m_role)]; } const osmium::Way* way() const noexcept { @@ -327,9 +327,9 @@ namespace osmium { if ((d > 0 && na >= 0 && na <= d && nb >= 0 && nb <= d) || (d < 0 && na <= 0 && na >= d && nb <= 0 && nb >= d)) { - const double ua = double(na) / d; + const double ua = static_cast(na) / static_cast(d); const vec i = p0 + ua * (p1 - p0); - return osmium::Location{int32_t(i.x), int32_t(i.y)}; + return osmium::Location{static_cast(i.x), static_cast(i.y)}; } return osmium::Location{}; diff --git a/third_party/libosmium/include/osmium/area/detail/proto_ring.hpp b/third_party/libosmium/include/osmium/area/detail/proto_ring.hpp index 9c3f41c181c..9b773a0a92b 100644 --- a/third_party/libosmium/include/osmium/area/detail/proto_ring.hpp +++ b/third_party/libosmium/include/osmium/area/detail/proto_ring.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -86,16 +86,16 @@ namespace osmium { int64_t m_num; #endif - int64_t m_sum; + int64_t m_sum = 0; public: explicit ProtoRing(NodeRefSegment* segment) noexcept : - m_min_segment(segment), + m_min_segment(segment) #ifdef OSMIUM_DEBUG_RING_NO - m_num(next_num()), + , m_num(next_num()) #endif - m_sum(0) { + { add_segment_back(segment); } diff --git a/third_party/libosmium/include/osmium/area/detail/segment_list.hpp b/third_party/libosmium/include/osmium/area/detail/segment_list.hpp index 4a4fe76f8ad..53f203215b9 100644 --- a/third_party/libosmium/include/osmium/area/detail/segment_list.hpp +++ b/third_party/libosmium/include/osmium/area/detail/segment_list.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -333,7 +333,7 @@ namespace osmium { } if (y_range_overlap(s1, s2)) { - osmium::Location intersection{calculate_intersection(s1, s2)}; + const osmium::Location intersection{calculate_intersection(s1, s2)}; if (intersection) { ++found_intersections; if (m_debug) { diff --git a/third_party/libosmium/include/osmium/area/detail/vector.hpp b/third_party/libosmium/include/osmium/area/detail/vector.hpp index a74e1d62423..e52a65cc532 100644 --- a/third_party/libosmium/include/osmium/area/detail/vector.hpp +++ b/third_party/libosmium/include/osmium/area/detail/vector.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -89,12 +89,12 @@ namespace osmium { // scale vector constexpr inline vec operator*(double s, const vec& v) noexcept { - return vec{int64_t(s * v.x), int64_t(s * v.y)}; + return vec{static_cast(s * static_cast(v.x)), static_cast(s * static_cast(v.y))}; } // scale vector constexpr inline vec operator*(const vec& v, double s) noexcept { - return vec{int64_t(s * v.x), int64_t(s * v.y)}; + return vec{static_cast(s * static_cast(v.x)), static_cast(s * static_cast(v.y))}; } // equality diff --git a/third_party/libosmium/include/osmium/area/geom_assembler.hpp b/third_party/libosmium/include/osmium/area/geom_assembler.hpp index 5dd397764e5..6a665b4a984 100644 --- a/third_party/libosmium/include/osmium/area/geom_assembler.hpp +++ b/third_party/libosmium/include/osmium/area/geom_assembler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/multipolygon_collector.hpp b/third_party/libosmium/include/osmium/area/multipolygon_collector.hpp index 8f87db3ed74..a2a70b69f8b 100644 --- a/third_party/libosmium/include/osmium/area/multipolygon_collector.hpp +++ b/third_party/libosmium/include/osmium/area/multipolygon_collector.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/multipolygon_manager.hpp b/third_party/libosmium/include/osmium/area/multipolygon_manager.hpp index 65dc8998843..c478aa1586d 100644 --- a/third_party/libosmium/include/osmium/area/multipolygon_manager.hpp +++ b/third_party/libosmium/include/osmium/area/multipolygon_manager.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/multipolygon_manager_legacy.hpp b/third_party/libosmium/include/osmium/area/multipolygon_manager_legacy.hpp index 2f93ebc9b5b..feea9a04bdd 100644 --- a/third_party/libosmium/include/osmium/area/multipolygon_manager_legacy.hpp +++ b/third_party/libosmium/include/osmium/area/multipolygon_manager_legacy.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/problem_reporter.hpp b/third_party/libosmium/include/osmium/area/problem_reporter.hpp index 06da1fb64e1..4c32ed9704a 100644 --- a/third_party/libosmium/include/osmium/area/problem_reporter.hpp +++ b/third_party/libosmium/include/osmium/area/problem_reporter.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/problem_reporter_exception.hpp b/third_party/libosmium/include/osmium/area/problem_reporter_exception.hpp index 8caecddeca7..4527a99849a 100644 --- a/third_party/libosmium/include/osmium/area/problem_reporter_exception.hpp +++ b/third_party/libosmium/include/osmium/area/problem_reporter_exception.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/problem_reporter_ogr.hpp b/third_party/libosmium/include/osmium/area/problem_reporter_ogr.hpp index c030967800b..bad49f89cdf 100644 --- a/third_party/libosmium/include/osmium/area/problem_reporter_ogr.hpp +++ b/third_party/libosmium/include/osmium/area/problem_reporter_ogr.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -75,15 +75,15 @@ namespace osmium { void set_object(gdalcpp::Feature& feature) { const char t[2] = {osmium::item_type_to_char(m_object_type), '\0'}; feature.set_field("obj_type", t); - feature.set_field("obj_id", int32_t(m_object_id)); - feature.set_field("nodes", int32_t(m_nodes)); + feature.set_field("obj_id", static_cast(m_object_id)); + feature.set_field("nodes", static_cast(m_nodes)); } void write_point(const char* problem_type, osmium::object_id_type id1, osmium::object_id_type id2, osmium::Location location) { gdalcpp::Feature feature{m_layer_perror, m_ogr_factory.create_point(location)}; set_object(feature); - feature.set_field("id1", double(id1)); - feature.set_field("id2", double(id2)); + feature.set_field("id1", static_cast(id1)); + feature.set_field("id2", static_cast(id2)); feature.set_field("problem", problem_type); feature.add_to_layer(); } @@ -176,7 +176,7 @@ namespace osmium { try { gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)}; set_object(feature); - feature.set_field("id1", int32_t(way.id())); + feature.set_field("id1", static_cast(way.id())); feature.set_field("id2", 0); feature.set_field("problem", "way_in_multiple_rings"); feature.add_to_layer(); @@ -192,7 +192,7 @@ namespace osmium { try { gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)}; set_object(feature); - feature.set_field("id1", int32_t(way.id())); + feature.set_field("id1", static_cast(way.id())); feature.set_field("id2", 0); feature.set_field("problem", "inner_with_same_tags"); feature.add_to_layer(); @@ -208,7 +208,7 @@ namespace osmium { try { gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)}; set_object(feature); - feature.set_field("id1", int32_t(way.id())); + feature.set_field("id1", static_cast(way.id())); feature.set_field("id2", 0); feature.set_field("problem", "duplicate_way"); feature.add_to_layer(); @@ -229,7 +229,7 @@ namespace osmium { try { gdalcpp::Feature feature{m_layer_ways, m_ogr_factory.create_linestring(way)}; set_object(feature); - feature.set_field("way_id", int32_t(way.id())); + feature.set_field("way_id", static_cast(way.id())); feature.add_to_layer(); } catch (const osmium::geometry_error&) { // XXX diff --git a/third_party/libosmium/include/osmium/area/problem_reporter_stream.hpp b/third_party/libosmium/include/osmium/area/problem_reporter_stream.hpp index 73f4bb7d6b7..9fa2ccdb75a 100644 --- a/third_party/libosmium/include/osmium/area/problem_reporter_stream.hpp +++ b/third_party/libosmium/include/osmium/area/problem_reporter_stream.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/area/stats.hpp b/third_party/libosmium/include/osmium/area/stats.hpp index 587473f4b04..d081e6110f8 100644 --- a/third_party/libosmium/include/osmium/area/stats.hpp +++ b/third_party/libosmium/include/osmium/area/stats.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/builder/attr.hpp b/third_party/libosmium/include/osmium/builder/attr.hpp index 4214a39f955..b112726593d 100644 --- a/third_party/libosmium/include/osmium/builder/attr.hpp +++ b/third_party/libosmium/include/osmium/builder/attr.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/builder/builder.hpp b/third_party/libosmium/include/osmium/builder/builder.hpp index c20b58a71e7..feda7c36e5d 100644 --- a/third_party/libosmium/include/osmium/builder/builder.hpp +++ b/third_party/libosmium/include/osmium/builder/builder.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/builder/osm_object_builder.hpp b/third_party/libosmium/include/osmium/builder/osm_object_builder.hpp index 22808973743..c3228ca7d96 100644 --- a/third_party/libosmium/include/osmium/builder/osm_object_builder.hpp +++ b/third_party/libosmium/include/osmium/builder/osm_object_builder.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -125,8 +125,8 @@ namespace osmium { if (value_length > osmium::max_osm_string_length) { throw std::length_error{"OSM tag value is too long"}; } - add_size(append_with_zero(key, osmium::memory::item_size_type(key_length))); - add_size(append_with_zero(value, osmium::memory::item_size_type(value_length))); + add_size(append_with_zero(key, static_cast(key_length))); + add_size(append_with_zero(value, static_cast(value_length))); } /** @@ -142,8 +142,8 @@ namespace osmium { if (value.size() > osmium::max_osm_string_length) { throw std::length_error{"OSM tag value is too long"}; } - add_size(append(key.data(), osmium::memory::item_size_type(key.size()) + 1)); - add_size(append(value.data(), osmium::memory::item_size_type(value.size()) + 1)); + add_size(append(key.data(), static_cast(key.size()) + 1)); + add_size(append(value.data(), static_cast(value.size()) + 1)); } /** @@ -240,8 +240,8 @@ namespace osmium { if (length > osmium::max_osm_string_length) { throw std::length_error{"OSM relation member role is too long"}; } - member.set_role_size(osmium::string_size_type(length) + 1); - add_size(append_with_zero(role, osmium::memory::item_size_type(length))); + member.set_role_size(static_cast(length) + 1); + add_size(append_with_zero(role, static_cast(length))); add_padding(true); } @@ -330,16 +330,16 @@ namespace osmium { if (length > osmium::max_osm_string_length) { throw std::length_error{"OSM user name is too long"}; } - comment.set_user_size(osmium::string_size_type(length) + 1); - add_size(append_with_zero(user, osmium::memory::item_size_type(length))); + comment.set_user_size(static_cast(length) + 1); + add_size(append_with_zero(user, static_cast(length))); } void add_text(osmium::ChangesetComment& comment, const char* text, const std::size_t length) { if (length > std::numeric_limits::max() - 1) { throw std::length_error{"OSM changeset comment is too long"}; } - comment.set_text_size(osmium::changeset_comment_size_type(length) + 1); - add_size(append_with_zero(text, osmium::memory::item_size_type(length))); + comment.set_text_size(static_cast(length) + 1); + add_size(append_with_zero(text, static_cast(length))); add_padding(true); } diff --git a/third_party/libosmium/include/osmium/diff_handler.hpp b/third_party/libosmium/include/osmium/diff_handler.hpp index 4d58be1cbec..1f88f768d8a 100644 --- a/third_party/libosmium/include/osmium/diff_handler.hpp +++ b/third_party/libosmium/include/osmium/diff_handler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/diff_iterator.hpp b/third_party/libosmium/include/osmium/diff_iterator.hpp index 6573e14cc71..08b8ea09bb7 100644 --- a/third_party/libosmium/include/osmium/diff_iterator.hpp +++ b/third_party/libosmium/include/osmium/diff_iterator.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/diff_visitor.hpp b/third_party/libosmium/include/osmium/diff_visitor.hpp index 2e855ad3014..976c633139d 100644 --- a/third_party/libosmium/include/osmium/diff_visitor.hpp +++ b/third_party/libosmium/include/osmium/diff_visitor.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/dynamic_handler.hpp b/third_party/libosmium/include/osmium/dynamic_handler.hpp index 6c2a5378412..73f2ac54a11 100644 --- a/third_party/libosmium/include/osmium/dynamic_handler.hpp +++ b/third_party/libosmium/include/osmium/dynamic_handler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/experimental/flex_reader.hpp b/third_party/libosmium/include/osmium/experimental/flex_reader.hpp index 66cf571ebf0..dc82896249f 100644 --- a/third_party/libosmium/include/osmium/experimental/flex_reader.hpp +++ b/third_party/libosmium/include/osmium/experimental/flex_reader.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/fwd.hpp b/third_party/libosmium/include/osmium/fwd.hpp index c43be5fffea..f556d3fc31c 100644 --- a/third_party/libosmium/include/osmium/fwd.hpp +++ b/third_party/libosmium/include/osmium/fwd.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/coordinates.hpp b/third_party/libosmium/include/osmium/geom/coordinates.hpp index 804400256b3..161c0021ec6 100644 --- a/third_party/libosmium/include/osmium/geom/coordinates.hpp +++ b/third_party/libosmium/include/osmium/geom/coordinates.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/factory.hpp b/third_party/libosmium/include/osmium/geom/factory.hpp index 704ae4d6679..07c7f2e6742 100644 --- a/third_party/libosmium/include/osmium/geom/factory.hpp +++ b/third_party/libosmium/include/osmium/geom/factory.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -166,7 +166,7 @@ namespace osmium { public: - GeometryFactory() : + GeometryFactory() : m_projection(), m_impl(m_projection.epsg()) { } @@ -175,7 +175,7 @@ namespace osmium { * Constructor for default initialized projection. */ template - explicit GeometryFactory(TArgs&&... args) : + explicit GeometryFactory(TArgs&&... args) : m_projection(), m_impl(m_projection.epsg(), std::forward(args)...) { } @@ -185,7 +185,7 @@ namespace osmium { * projection is moved into the GeometryFactory. */ template - explicit GeometryFactory(TProjection&& projection, TArgs&&... args) : + explicit GeometryFactory(TProjection&& projection, TArgs&&... args) : m_projection(std::move(projection)), m_impl(m_projection.epsg(), std::forward(args)...) { } diff --git a/third_party/libosmium/include/osmium/geom/geojson.hpp b/third_party/libosmium/include/osmium/geom/geojson.hpp index 3d97702d7c7..193c8cd2210 100644 --- a/third_party/libosmium/include/osmium/geom/geojson.hpp +++ b/third_party/libosmium/include/osmium/geom/geojson.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/geos.hpp b/third_party/libosmium/include/osmium/geom/geos.hpp index c3c0c4d984d..73538f9b585 100644 --- a/third_party/libosmium/include/osmium/geom/geos.hpp +++ b/third_party/libosmium/include/osmium/geom/geos.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/haversine.hpp b/third_party/libosmium/include/osmium/geom/haversine.hpp index d0e95e2a458..3da00d58894 100644 --- a/third_party/libosmium/include/osmium/geom/haversine.hpp +++ b/third_party/libosmium/include/osmium/geom/haversine.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/mercator_projection.hpp b/third_party/libosmium/include/osmium/geom/mercator_projection.hpp index b0e67d993f2..acb4d27f1ef 100644 --- a/third_party/libosmium/include/osmium/geom/mercator_projection.hpp +++ b/third_party/libosmium/include/osmium/geom/mercator_projection.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/ogr.hpp b/third_party/libosmium/include/osmium/geom/ogr.hpp index 1179ae0642f..226684b28b4 100644 --- a/third_party/libosmium/include/osmium/geom/ogr.hpp +++ b/third_party/libosmium/include/osmium/geom/ogr.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/projection.hpp b/third_party/libosmium/include/osmium/geom/projection.hpp index 8a4c670caf2..b96980f8635 100644 --- a/third_party/libosmium/include/osmium/geom/projection.hpp +++ b/third_party/libosmium/include/osmium/geom/projection.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/rapid_geojson.hpp b/third_party/libosmium/include/osmium/geom/rapid_geojson.hpp index c9d104a8c19..94f172609bc 100644 --- a/third_party/libosmium/include/osmium/geom/rapid_geojson.hpp +++ b/third_party/libosmium/include/osmium/geom/rapid_geojson.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -47,6 +47,9 @@ namespace osmium { /** * A geometry factory implementation that can be used with the * RapidJSON (https://github.com/miloyip/rapidjson) JSON writer. + * + * @deprecated The RapidJSON support will be removed in a future + * version of libosmium. */ template class RapidGeoJSONFactoryImpl { diff --git a/third_party/libosmium/include/osmium/geom/relations.hpp b/third_party/libosmium/include/osmium/geom/relations.hpp index fb33f89129e..6c4352d3eda 100644 --- a/third_party/libosmium/include/osmium/geom/relations.hpp +++ b/third_party/libosmium/include/osmium/geom/relations.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/tile.hpp b/third_party/libosmium/include/osmium/geom/tile.hpp index 4c3e02ed616..d03504bc93a 100644 --- a/third_party/libosmium/include/osmium/geom/tile.hpp +++ b/third_party/libosmium/include/osmium/geom/tile.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/util.hpp b/third_party/libosmium/include/osmium/geom/util.hpp index a51e72ddb20..2e8ee858c15 100644 --- a/third_party/libosmium/include/osmium/geom/util.hpp +++ b/third_party/libosmium/include/osmium/geom/util.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/geom/wkb.hpp b/third_party/libosmium/include/osmium/geom/wkb.hpp index a07844c7877..15a7d44ec35 100644 --- a/third_party/libosmium/include/osmium/geom/wkb.hpp +++ b/third_party/libosmium/include/osmium/geom/wkb.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -68,7 +68,7 @@ namespace osmium { std::string out; out.reserve(str.size() * 2); - for (char c : str) { + for (const char c : str) { out += lookup_hex[(static_cast(c) >> 4U) & 0xfU]; out += lookup_hex[ static_cast(c) & 0xfU]; } diff --git a/third_party/libosmium/include/osmium/geom/wkt.hpp b/third_party/libosmium/include/osmium/geom/wkt.hpp index 235b9daaeab..216873dfef2 100644 --- a/third_party/libosmium/include/osmium/geom/wkt.hpp +++ b/third_party/libosmium/include/osmium/geom/wkt.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler.hpp b/third_party/libosmium/include/osmium/handler.hpp index 9d6fc8911a6..58bc427cd88 100644 --- a/third_party/libosmium/include/osmium/handler.hpp +++ b/third_party/libosmium/include/osmium/handler.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/chain.hpp b/third_party/libosmium/include/osmium/handler/chain.hpp index 432ee2afc0b..70ad76b3cd5 100644 --- a/third_party/libosmium/include/osmium/handler/chain.hpp +++ b/third_party/libosmium/include/osmium/handler/chain.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/check_order.hpp b/third_party/libosmium/include/osmium/handler/check_order.hpp index 31de2b97c1d..1daedda3107 100644 --- a/third_party/libosmium/include/osmium/handler/check_order.hpp +++ b/third_party/libosmium/include/osmium/handler/check_order.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/disk_store.hpp b/third_party/libosmium/include/osmium/handler/disk_store.hpp index b6a9b43b581..e5bd36c5181 100644 --- a/third_party/libosmium/include/osmium/handler/disk_store.hpp +++ b/third_party/libosmium/include/osmium/handler/disk_store.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/dump.hpp b/third_party/libosmium/include/osmium/handler/dump.hpp index fcfa7f81a92..86398c9cd8d 100644 --- a/third_party/libosmium/include/osmium/handler/dump.hpp +++ b/third_party/libosmium/include/osmium/handler/dump.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/node_locations_for_ways.hpp b/third_party/libosmium/include/osmium/handler/node_locations_for_ways.hpp index 4fd38753e78..8e66f38377e 100644 --- a/third_party/libosmium/include/osmium/handler/node_locations_for_ways.hpp +++ b/third_party/libosmium/include/osmium/handler/node_locations_for_ways.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/handler/object_relations.hpp b/third_party/libosmium/include/osmium/handler/object_relations.hpp index 1cfec9255ee..a50b61c6594 100644 --- a/third_party/libosmium/include/osmium/handler/object_relations.hpp +++ b/third_party/libosmium/include/osmium/handler/object_relations.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/bool_vector.hpp b/third_party/libosmium/include/osmium/index/bool_vector.hpp deleted file mode 100644 index 52906356526..00000000000 --- a/third_party/libosmium/include/osmium/index/bool_vector.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef OSMIUM_INDEX_BOOL_VECTOR_HPP -#define OSMIUM_INDEX_BOOL_VECTOR_HPP - -/* - -This file is part of Osmium (https://osmcode.org/libosmium). - -Copyright 2013-2022 Jochen Topf and others (see README). - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -*/ - -#include - -namespace osmium { - - namespace index { - - /// @deprecated Use osmium::index::IdSet instead. - template - using BoolVector = IdSet; - - } // namespace index - -} // namespace osmium - -#endif // OSMIUM_INDEX_BOOL_VECTOR_HPP diff --git a/third_party/libosmium/include/osmium/index/detail/create_map_with_fd.hpp b/third_party/libosmium/include/osmium/index/detail/create_map_with_fd.hpp index 004b7683399..c67329f9a41 100644 --- a/third_party/libosmium/include/osmium/index/detail/create_map_with_fd.hpp +++ b/third_party/libosmium/include/osmium/index/detail/create_map_with_fd.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/detail/mmap_vector_anon.hpp b/third_party/libosmium/include/osmium/index/detail/mmap_vector_anon.hpp index 0f97e99996b..075d187e859 100644 --- a/third_party/libosmium/include/osmium/index/detail/mmap_vector_anon.hpp +++ b/third_party/libosmium/include/osmium/index/detail/mmap_vector_anon.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/detail/mmap_vector_base.hpp b/third_party/libosmium/include/osmium/index/detail/mmap_vector_base.hpp index b5b193e5cbb..3da81ca4b56 100644 --- a/third_party/libosmium/include/osmium/index/detail/mmap_vector_base.hpp +++ b/third_party/libosmium/include/osmium/index/detail/mmap_vector_base.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/detail/mmap_vector_file.hpp b/third_party/libosmium/include/osmium/index/detail/mmap_vector_file.hpp index 80e20adec9a..5f048e072c2 100644 --- a/third_party/libosmium/include/osmium/index/detail/mmap_vector_file.hpp +++ b/third_party/libosmium/include/osmium/index/detail/mmap_vector_file.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/detail/tmpfile.hpp b/third_party/libosmium/include/osmium/index/detail/tmpfile.hpp index 4734e671a5e..38746d3f148 100644 --- a/third_party/libosmium/include/osmium/index/detail/tmpfile.hpp +++ b/third_party/libosmium/include/osmium/index/detail/tmpfile.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/detail/vector_map.hpp b/third_party/libosmium/include/osmium/index/detail/vector_map.hpp index fd643144f1e..d9ee56db4c0 100644 --- a/third_party/libosmium/include/osmium/index/detail/vector_map.hpp +++ b/third_party/libosmium/include/osmium/index/detail/vector_map.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -241,7 +241,7 @@ namespace osmium { void dump_as_array(const int fd) final { constexpr const size_t value_size = sizeof(TValue); constexpr const size_t buffer_size = (10L * 1024L * 1024L) / value_size; - std::unique_ptr output_buffer{new TValue[buffer_size]}; + const std::unique_ptr output_buffer{new TValue[buffer_size]}; size_t buffer_start_id = 0; for (auto it = cbegin(); it != cend();) { diff --git a/third_party/libosmium/include/osmium/index/detail/vector_multimap.hpp b/third_party/libosmium/include/osmium/index/detail/vector_multimap.hpp index 3b4796209b7..ab272618eaa 100644 --- a/third_party/libosmium/include/osmium/index/detail/vector_multimap.hpp +++ b/third_party/libosmium/include/osmium/index/detail/vector_multimap.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 diff --git a/third_party/libosmium/include/osmium/index/id_set.hpp b/third_party/libosmium/include/osmium/index/id_set.hpp index 1c64aa55b64..c2f44c59e49 100644 --- a/third_party/libosmium/include/osmium/index/id_set.hpp +++ b/third_party/libosmium/include/osmium/index/id_set.hpp @@ -5,7 +5,7 @@ This file is part of Osmium (https://osmcode.org/libosmium). -Copyright 2013-2022 Jochen Topf and others (see README). +Copyright 2013-2023 Jochen Topf and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 @@ -503,26 +503,6 @@ namespace osmium { }; // class IdSetSmall - /// @deprecated Use nwr_array helper class instead. - template