Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 015ba69f3e | |||
| 61464fc2bd | |||
| 6f235cca15 | |||
| 3614af7f64 | |||
| 48e8382785 | |||
| becfd8a56d | |||
| 4f1c62a768 | |||
| 09a716a9e5 | |||
| 676f6d4704 | |||
| f636dbfd44 | |||
| 5f67e715af | |||
| 203314b1aa | |||
| e5e25a1aca | |||
| 84f12c7c6d | |||
| 7802f86bd6 | |||
| 0cd0340346 | |||
| 8a31f2f5e3 | |||
| 2faaeb7756 | |||
| 8671fa7272 | |||
| fd174a433a | |||
| 01ab85192f | |||
| 43afec3b39 | |||
| 2da7ca5338 | |||
| 8ae9abaa63 | |||
| d3638ace59 | |||
| c2f877eb9d | |||
| 825132eec7 | |||
| 7436835244 |
@@ -446,14 +446,14 @@ jobs:
|
||||
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}
|
||||
BOOST_VERSION_FLAVOR="${BOOST_VERSION}-b2-nodocs"
|
||||
wget -q https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION_FLAVOR}.tar.gz
|
||||
tar xzf boost-${BOOST_VERSION_FLAVOR}.tar.gz
|
||||
cd boost-${BOOST_VERSION}
|
||||
sudo ./bootstrap.sh
|
||||
sudo ./b2 install
|
||||
cd ..
|
||||
sudo rm -rf boost_${BOOST_VERSION_UNDERSCORE}*
|
||||
sudo rm -rf boost-${BOOST_VERSION}*
|
||||
|
||||
- name: Install dev dependencies
|
||||
run: |
|
||||
@@ -502,6 +502,13 @@ jobs:
|
||||
|
||||
conan config init
|
||||
yq eval '.compiler.clang.version += ["18"]' -i "$HOME/.conan/settings.yml"
|
||||
- name: Add Apple-clang 16 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Apple-clang 16
|
||||
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.runs-on == 'macos-14' }}
|
||||
run: |
|
||||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_darwin_arm64 -O /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
|
||||
|
||||
conan config init
|
||||
yq eval '.compiler.apple-clang.version += ["16.0"]' -i "$HOME/.conan/settings.yml"
|
||||
- name: Prepare build
|
||||
run: |
|
||||
mkdir ${OSRM_BUILD_DIR}
|
||||
@@ -653,7 +660,7 @@ jobs:
|
||||
benchmarks:
|
||||
if: github.event_name == 'pull_request'
|
||||
needs: [format-taginfo-docs]
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: self-hosted
|
||||
env:
|
||||
CCOMPILER: clang-16
|
||||
CXXCOMPILER: clang++-16
|
||||
@@ -664,37 +671,17 @@ jobs:
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }}
|
||||
steps:
|
||||
- name: Enable data.osm.pbf cache
|
||||
if: ${{ ! env.RUN_BIG_BENCHMARK }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/data.osm.pbf
|
||||
key: v1-data-osm-pbf
|
||||
restore-keys: |
|
||||
v1-data-osm-pbf
|
||||
- name: Enable compiler cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: v1-ccache-benchmarks-${{ github.sha }}
|
||||
restore-keys: |
|
||||
v1-ccache-benchmarks-
|
||||
- name: Enable Conan cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.conan
|
||||
key: v1-conan-benchmarks-${{ github.sha }}
|
||||
restore-keys: |
|
||||
v1-conan-benchmarks-
|
||||
- name: Checkout PR Branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
path: pr
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4" --break-system-packages
|
||||
sudo apt-get update -y && sudo apt-get install ccache
|
||||
- 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
|
||||
@@ -722,50 +709,67 @@ jobs:
|
||||
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 ..
|
||||
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 ..
|
||||
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: mkdir -p /opt/benchmarks
|
||||
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 mount -t tmpfs -o size=4g none /opt/benchmarks
|
||||
cp -rf pr/build /opt/benchmarks/build
|
||||
mkdir -p /opt/benchmarks/test
|
||||
cp -rf pr/test/data /opt/benchmarks/test/data
|
||||
cp -rf pr/profiles /opt/benchmarks/profiles
|
||||
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
|
||||
|
||||
./pr/scripts/ci/run_benchmarks.sh -f /opt/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b /opt/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
|
||||
sudo umount /opt/benchmarks
|
||||
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 mount -t tmpfs -o size=4g none /opt/benchmarks
|
||||
cp -rf base/build /opt/benchmarks/build
|
||||
mkdir -p /opt/benchmarks/test
|
||||
cp -rf base/test/data /opt/benchmarks/test/data
|
||||
cp -rf base/profiles /opt/benchmarks/profiles
|
||||
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 /opt/benchmarks/test/data/portugal_to_korea.json ]; then
|
||||
cp base/src/benchmarks/portugal_to_korea.json /opt/benchmarks/test/data/portugal_to_korea.json
|
||||
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
|
||||
./pr/scripts/ci/run_benchmarks.sh -f /opt/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b /opt/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
|
||||
sudo umount /opt/benchmarks
|
||||
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
|
||||
|
||||
@@ -46,7 +46,6 @@ Thumbs.db
|
||||
/example/build/
|
||||
/test/data/monaco.osrm*
|
||||
/test/data/ch
|
||||
/test/data/corech
|
||||
/test/data/mld
|
||||
/cmake/postinst
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Unreleased
|
||||
- Changes from 5.27.1
|
||||
- Features
|
||||
- ADDED: Route pedestrians over highway=platform [#6993](https://github.com/Project-OSRM/osrm-backend/pull/6993)
|
||||
- REMOVED: Remove all core-CH left-overs [#6920](https://github.com/Project-OSRM/osrm-backend/pull/6920)
|
||||
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
|
||||
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
|
||||
@@ -24,6 +25,9 @@
|
||||
- NodeJS:
|
||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||
- Misc:
|
||||
- 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)
|
||||
- CHANGED: Get rid of boost::optional leftovers. [#6977](https://github.com/Project-OSRM/osrm-backend/pull/6977)
|
||||
- CHANGED: Use Link Time Optimisation whenever possible. [#6967](https://github.com/Project-OSRM/osrm-backend/pull/6967)
|
||||
@@ -76,6 +80,7 @@
|
||||
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
|
||||
- Profiles:
|
||||
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
|
||||
- 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)
|
||||
|
||||
@@ -56,6 +56,9 @@ endif()
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if (POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
project(OSRM C CXX)
|
||||
|
||||
|
||||
@@ -133,6 +136,7 @@ endif()
|
||||
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/generated/include/)
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/include)
|
||||
|
||||
set(BOOST_COMPONENTS date_time iostreams program_options thread unit_test_framework)
|
||||
|
||||
+29
-12
@@ -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
|
||||
@@ -39,16 +53,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 && \
|
||||
@@ -60,3 +76,4 @@ RUN /usr/local/bin/osrm-extract --help && \
|
||||
WORKDIR /opt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
|
||||
+30
-21
@@ -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
|
||||
@@ -41,19 +44,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 && \
|
||||
@@ -65,3 +73,4 @@ RUN /usr/local/bin/osrm-extract --help && \
|
||||
WORKDIR /opt
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
|
||||
@@ -26,7 +26,15 @@ Feature: Foot - Access tags on ways
|
||||
| motorway | no | | |
|
||||
| motorway | no | yes | x |
|
||||
| motorway | no | no | |
|
||||
|
||||
| platform | | | x |
|
||||
| platform | | yes | x |
|
||||
| platform | | no | |
|
||||
| platform | yes | | x |
|
||||
| platform | yes | yes | x |
|
||||
| platform | yes | no | |
|
||||
| platform | no | | |
|
||||
| platform | no | yes | x |
|
||||
| platform | no | no | |
|
||||
|
||||
Scenario: Foot - Overwriting implied acccess on ways
|
||||
Then routability should be
|
||||
|
||||
@@ -1061,7 +1061,7 @@ Feature: Collapse
|
||||
# i
|
||||
# """
|
||||
|
||||
And the node locations
|
||||
Given the node locations
|
||||
| node | lat | lon | #id |
|
||||
| a | -33.9644254 | 151.1378673 | 33226063 |
|
||||
| b | -33.9644373 | 151.1377172 | 1072787030 |
|
||||
|
||||
@@ -9,7 +9,7 @@ Feature: Basic Roundabout
|
||||
"""
|
||||
|
||||
Scenario: Roundabout exit counting for left sided driving
|
||||
And a grid size of 10 meters
|
||||
Given a grid size of 10 meters
|
||||
And the node map
|
||||
"""
|
||||
a
|
||||
@@ -33,7 +33,7 @@ Feature: Basic Roundabout
|
||||
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
|
||||
|
||||
Scenario: Mixed Entry and Exit
|
||||
And a grid size of 10 meters
|
||||
Given a grid size of 10 meters
|
||||
And the node map
|
||||
"""
|
||||
c a
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
@prepare @options @help
|
||||
Feature: osrm-contract command line options: help
|
||||
|
||||
Scenario: osrm-contract - Help should be shown when no options are passed
|
||||
When I try to run "osrm-contract"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--core"
|
||||
And stdout should contain "--segment-speed-file"
|
||||
And it should exit with an error
|
||||
|
||||
Scenario: osrm-contract - Help, short
|
||||
When I run "osrm-contract -h"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--core"
|
||||
And stdout should contain "--segment-speed-file"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-contract - Help, long
|
||||
When I run "osrm-contract --help"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--core"
|
||||
And stdout should contain "--segment-speed-file"
|
||||
And it should exit successfully
|
||||
@@ -1,38 +0,0 @@
|
||||
@contract @options @help
|
||||
Feature: osrm-customize command line options: help
|
||||
|
||||
Scenario: osrm-customize - Help should be shown when no options are passed
|
||||
When I try to run "osrm-customize"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And it should exit with an error
|
||||
|
||||
Scenario: osrm-customize - Help, short
|
||||
When I run "osrm-customize -h"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-customize - Help, long
|
||||
When I run "osrm-customize --help"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And it should exit successfully
|
||||
@@ -33,10 +33,6 @@ Feature: osrm-datastore command line options
|
||||
When I try to run "osrm-datastore {processed_file} --dataset-name cucumber/only_metric_test --only-metric"
|
||||
Then it should exit successfully
|
||||
|
||||
Scenario: osrm-datastore - Displaying help should work
|
||||
When I try to run "osrm-datastore {processed_file} --help"
|
||||
Then it should exit successfully
|
||||
|
||||
Scenario: osrm-datastore - Errors on invalid path
|
||||
When I try to run "osrm-datastore invalid_path.osrm"
|
||||
Then stderr should contain "[error] Config contains invalid file paths."
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
@extract @options @help
|
||||
Feature: osrm-extract command line options: help
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
|
||||
Scenario: osrm-extract - Help should be shown when no options are passed
|
||||
When I run "osrm-extract"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--profile"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--small-component-size"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-extract - Help, short
|
||||
When I run "osrm-extract -h"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--profile"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--small-component-size"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-extract - Help, long
|
||||
When I run "osrm-extract --help"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--profile"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--small-component-size"
|
||||
And it should exit successfully
|
||||
@@ -1,53 +0,0 @@
|
||||
@partition @options @help
|
||||
Feature: osrm-partition command line options: help
|
||||
|
||||
Scenario: osrm-partition - Help should be shown when no options are passed
|
||||
When I try to run "osrm-partition"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--balance"
|
||||
And stdout should contain "--boundary"
|
||||
And stdout should contain "--optimizing-cuts"
|
||||
And stdout should contain "--small-component-size"
|
||||
And stdout should contain "--max-cell-sizes"
|
||||
And it should exit with an error
|
||||
|
||||
Scenario: osrm-partition - Help, short
|
||||
When I run "osrm-partition -h"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--balance"
|
||||
And stdout should contain "--boundary"
|
||||
And stdout should contain "--optimizing-cuts"
|
||||
And stdout should contain "--small-component-size"
|
||||
And stdout should contain "--max-cell-sizes"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-partition - Help, long
|
||||
When I run "osrm-partition --help"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--balance"
|
||||
And stdout should contain "--boundary"
|
||||
And stdout should contain "--optimizing-cuts"
|
||||
And stdout should contain "--small-component-size"
|
||||
And stdout should contain "--max-cell-sizes"
|
||||
And it should exit successfully
|
||||
@@ -1,71 +0,0 @@
|
||||
@routed @options @help
|
||||
Feature: osrm-routed command line options: help
|
||||
|
||||
Background:
|
||||
Given the profile "testbot"
|
||||
|
||||
Scenario: osrm-routed - Help should be shown when no options are passed
|
||||
When I run "osrm-routed"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "--trial"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--ip"
|
||||
And stdout should contain "--port"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--shared-memory"
|
||||
And stdout should contain "--max-viaroute-size"
|
||||
And stdout should contain "--max-trip-size"
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-routed - Help, short
|
||||
When I run "osrm-routed -h"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "--trial"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--ip"
|
||||
And stdout should contain "--port"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--shared-memory"
|
||||
And stdout should contain "--max-viaroute-size"
|
||||
And stdout should contain "--max-trip-size"
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
|
||||
Scenario: osrm-routed - Help, long
|
||||
When I run "osrm-routed --help"
|
||||
Then stderr should be empty
|
||||
And stdout should contain /osrm-routed(.exe)? <base.osrm> \[<options>\]:/
|
||||
And stdout should contain "Options:"
|
||||
And stdout should contain "--version"
|
||||
And stdout should contain "--help"
|
||||
And stdout should contain "--verbosity"
|
||||
And stdout should contain "--trial"
|
||||
And stdout should contain "Configuration:"
|
||||
And stdout should contain "--ip"
|
||||
And stdout should contain "--port"
|
||||
And stdout should contain "--threads"
|
||||
And stdout should contain "--shared-memory"
|
||||
And stdout should contain "--max-trip-size"
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-table-size"
|
||||
And stdout should contain "--max-matching-size"
|
||||
And stdout should contain "--default-radius"
|
||||
And stdout should contain "--keepalive-timeout"
|
||||
And it should exit successfully
|
||||
@@ -75,7 +75,7 @@ Feature: Avoid weird loops caused by rounding errors
|
||||
|
||||
@412 @via
|
||||
Scenario: Avoid weird loops 3
|
||||
And the node map
|
||||
Given the node map
|
||||
"""
|
||||
a
|
||||
b e
|
||||
|
||||
@@ -136,22 +136,6 @@ Feature: Basic Map Matching
|
||||
| trace | matchings |
|
||||
| abcbd | abbd |
|
||||
|
||||
Scenario: Testbot - Map matching with core factor
|
||||
Given the contract extra arguments "--core 0.8"
|
||||
Given the node map
|
||||
"""
|
||||
a b c d
|
||||
e
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| abcd | no |
|
||||
|
||||
When I match I should get
|
||||
| trace | timestamps | matchings |
|
||||
| abcd | 0 1 2 3 | abcd |
|
||||
|
||||
Scenario: Testbot - Map matching with small distortion
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
@@ -401,12 +401,12 @@ Feature: Snapping at intersections
|
||||
Given the extract extra arguments "--small-component-size=4"
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | no |
|
||||
| bc | no |
|
||||
| cd | no |
|
||||
| fed | no |
|
||||
| bg | yes | # small SCC
|
||||
| nodes | oneway | # comment |
|
||||
| ab | no | |
|
||||
| bc | no | |
|
||||
| cd | no | |
|
||||
| fed | no | |
|
||||
| bg | yes | small SCC |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
@@ -437,14 +437,14 @@ Feature: Snapping at intersections
|
||||
Given the extract extra arguments "--small-component-size=4"
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | no |
|
||||
| bc | no |
|
||||
| cd | no |
|
||||
| fed | no |
|
||||
| ghi | no |
|
||||
| jkl | no |
|
||||
| bm | yes | # small SCC
|
||||
| nodes | oneway | # comment |
|
||||
| ab | no | |
|
||||
| bc | no | |
|
||||
| cd | no | |
|
||||
| fed | no | |
|
||||
| ghi | no | |
|
||||
| jkl | no | |
|
||||
| bm | yes | small SCC |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction |
|
||||
|
||||
@@ -65,32 +65,6 @@ Feature: Via points
|
||||
| waypoints | route | turns |
|
||||
| 1,2,3 | cd,ac,ab,bd,cd | depart,new name right,new name right,new name right,arrive |
|
||||
|
||||
Scenario: Simple via point with core factor
|
||||
Given the contract extra arguments "--core 0.8"
|
||||
Given the node map
|
||||
"""
|
||||
a b c d
|
||||
e f g
|
||||
h i
|
||||
j
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| abcd |
|
||||
| efg |
|
||||
| hi |
|
||||
| be |
|
||||
| cfh |
|
||||
| dgij |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route |
|
||||
| a,b,c | abcd,abcd,abcd,abcd |
|
||||
| c,b,a | abcd,abcd,abcd,abcd |
|
||||
| a,d,j | abcd,abcd,dgij,dgij |
|
||||
| j,d,a | dgij,dgij,abcd,abcd |
|
||||
|
||||
Scenario: Via point at a dead end
|
||||
Given the node map
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
#define FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "route_generated.h"
|
||||
#include "table_generated.h"
|
||||
|
||||
namespace osrm {
|
||||
namespace engine {
|
||||
namespace api {
|
||||
namespace fbresult {
|
||||
|
||||
struct Error;
|
||||
struct ErrorBuilder;
|
||||
|
||||
struct FBResult;
|
||||
struct FBResultBuilder;
|
||||
|
||||
struct Error FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef ErrorBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_CODE = 4,
|
||||
VT_MESSAGE = 6
|
||||
};
|
||||
const ::flatbuffers::String *code() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_CODE);
|
||||
}
|
||||
const ::flatbuffers::String *message() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_MESSAGE);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_CODE) &&
|
||||
verifier.VerifyString(code()) &&
|
||||
VerifyOffset(verifier, VT_MESSAGE) &&
|
||||
verifier.VerifyString(message()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct ErrorBuilder {
|
||||
typedef Error Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_code(::flatbuffers::Offset<::flatbuffers::String> code) {
|
||||
fbb_.AddOffset(Error::VT_CODE, code);
|
||||
}
|
||||
void add_message(::flatbuffers::Offset<::flatbuffers::String> message) {
|
||||
fbb_.AddOffset(Error::VT_MESSAGE, message);
|
||||
}
|
||||
explicit ErrorBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Error> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Error>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Error> CreateError(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::String> code = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> message = 0) {
|
||||
ErrorBuilder builder_(_fbb);
|
||||
builder_.add_message(message);
|
||||
builder_.add_code(code);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Error> CreateErrorDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *code = nullptr,
|
||||
const char *message = nullptr) {
|
||||
auto code__ = code ? _fbb.CreateString(code) : 0;
|
||||
auto message__ = message ? _fbb.CreateString(message) : 0;
|
||||
return osrm::engine::api::fbresult::CreateError(
|
||||
_fbb,
|
||||
code__,
|
||||
message__);
|
||||
}
|
||||
|
||||
struct FBResult FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FBResultBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ERROR = 4,
|
||||
VT_CODE = 6,
|
||||
VT_DATA_VERSION = 8,
|
||||
VT_WAYPOINTS = 10,
|
||||
VT_ROUTES = 12,
|
||||
VT_TABLE = 14
|
||||
};
|
||||
bool error() const {
|
||||
return GetField<uint8_t>(VT_ERROR, 0) != 0;
|
||||
}
|
||||
const osrm::engine::api::fbresult::Error *code() const {
|
||||
return GetPointer<const osrm::engine::api::fbresult::Error *>(VT_CODE);
|
||||
}
|
||||
const ::flatbuffers::String *data_version() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_DATA_VERSION);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *waypoints() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *>(VT_WAYPOINTS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *routes() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *>(VT_ROUTES);
|
||||
}
|
||||
const osrm::engine::api::fbresult::TableResult *table() const {
|
||||
return GetPointer<const osrm::engine::api::fbresult::TableResult *>(VT_TABLE);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint8_t>(verifier, VT_ERROR, 1) &&
|
||||
VerifyOffset(verifier, VT_CODE) &&
|
||||
verifier.VerifyTable(code()) &&
|
||||
VerifyOffset(verifier, VT_DATA_VERSION) &&
|
||||
verifier.VerifyString(data_version()) &&
|
||||
VerifyOffset(verifier, VT_WAYPOINTS) &&
|
||||
verifier.VerifyVector(waypoints()) &&
|
||||
verifier.VerifyVectorOfTables(waypoints()) &&
|
||||
VerifyOffset(verifier, VT_ROUTES) &&
|
||||
verifier.VerifyVector(routes()) &&
|
||||
verifier.VerifyVectorOfTables(routes()) &&
|
||||
VerifyOffset(verifier, VT_TABLE) &&
|
||||
verifier.VerifyTable(table()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FBResultBuilder {
|
||||
typedef FBResult Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_error(bool error) {
|
||||
fbb_.AddElement<uint8_t>(FBResult::VT_ERROR, static_cast<uint8_t>(error), 0);
|
||||
}
|
||||
void add_code(::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code) {
|
||||
fbb_.AddOffset(FBResult::VT_CODE, code);
|
||||
}
|
||||
void add_data_version(::flatbuffers::Offset<::flatbuffers::String> data_version) {
|
||||
fbb_.AddOffset(FBResult::VT_DATA_VERSION, data_version);
|
||||
}
|
||||
void add_waypoints(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> waypoints) {
|
||||
fbb_.AddOffset(FBResult::VT_WAYPOINTS, waypoints);
|
||||
}
|
||||
void add_routes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>> routes) {
|
||||
fbb_.AddOffset(FBResult::VT_ROUTES, routes);
|
||||
}
|
||||
void add_table(::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table) {
|
||||
fbb_.AddOffset(FBResult::VT_TABLE, table);
|
||||
}
|
||||
explicit FBResultBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FBResult> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FBResult>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FBResult> CreateFBResult(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
bool error = false,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> data_version = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> waypoints = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>> routes = 0,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table = 0) {
|
||||
FBResultBuilder builder_(_fbb);
|
||||
builder_.add_table(table);
|
||||
builder_.add_routes(routes);
|
||||
builder_.add_waypoints(waypoints);
|
||||
builder_.add_data_version(data_version);
|
||||
builder_.add_code(code);
|
||||
builder_.add_error(error);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<FBResult> CreateFBResultDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
bool error = false,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::Error> code = 0,
|
||||
const char *data_version = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *waypoints = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>> *routes = nullptr,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::TableResult> table = 0) {
|
||||
auto data_version__ = data_version ? _fbb.CreateString(data_version) : 0;
|
||||
auto waypoints__ = waypoints ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>(*waypoints) : 0;
|
||||
auto routes__ = routes ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::RouteObject>>(*routes) : 0;
|
||||
return osrm::engine::api::fbresult::CreateFBResult(
|
||||
_fbb,
|
||||
error,
|
||||
code,
|
||||
data_version__,
|
||||
waypoints__,
|
||||
routes__,
|
||||
table);
|
||||
}
|
||||
|
||||
inline const osrm::engine::api::fbresult::FBResult *GetFBResult(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<osrm::engine::api::fbresult::FBResult>(buf);
|
||||
}
|
||||
|
||||
inline const osrm::engine::api::fbresult::FBResult *GetSizePrefixedFBResult(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<osrm::engine::api::fbresult::FBResult>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyFBResultBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<osrm::engine::api::fbresult::FBResult>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedFBResultBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<osrm::engine::api::fbresult::FBResult>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishFBResultBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::FBResult> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedFBResultBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<osrm::engine::api::fbresult::FBResult> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace fbresult
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_FBRESULT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
@@ -0,0 +1,51 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_
|
||||
#define FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace osrm {
|
||||
namespace engine {
|
||||
namespace api {
|
||||
namespace fbresult {
|
||||
|
||||
struct Position;
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Position FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
float longitude_;
|
||||
float latitude_;
|
||||
|
||||
public:
|
||||
Position()
|
||||
: longitude_(0),
|
||||
latitude_(0) {
|
||||
}
|
||||
Position(float _longitude, float _latitude)
|
||||
: longitude_(::flatbuffers::EndianScalar(_longitude)),
|
||||
latitude_(::flatbuffers::EndianScalar(_latitude)) {
|
||||
}
|
||||
float longitude() const {
|
||||
return ::flatbuffers::EndianScalar(longitude_);
|
||||
}
|
||||
float latitude() const {
|
||||
return ::flatbuffers::EndianScalar(latitude_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Position, 8);
|
||||
|
||||
} // namespace fbresult
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_POSITION_OSRM_ENGINE_API_FBRESULT_H_
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,149 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_
|
||||
#define FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "waypoint_generated.h"
|
||||
|
||||
namespace osrm {
|
||||
namespace engine {
|
||||
namespace api {
|
||||
namespace fbresult {
|
||||
|
||||
struct TableResult;
|
||||
struct TableResultBuilder;
|
||||
|
||||
struct TableResult FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableResultBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_DURATIONS = 4,
|
||||
VT_ROWS = 6,
|
||||
VT_COLS = 8,
|
||||
VT_DISTANCES = 10,
|
||||
VT_DESTINATIONS = 12,
|
||||
VT_FALLBACK_SPEED_CELLS = 14
|
||||
};
|
||||
const ::flatbuffers::Vector<float> *durations() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_DURATIONS);
|
||||
}
|
||||
uint16_t rows() const {
|
||||
return GetField<uint16_t>(VT_ROWS, 0);
|
||||
}
|
||||
uint16_t cols() const {
|
||||
return GetField<uint16_t>(VT_COLS, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<float> *distances() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<float> *>(VT_DISTANCES);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *destinations() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *>(VT_DESTINATIONS);
|
||||
}
|
||||
const ::flatbuffers::Vector<uint32_t> *fallback_speed_cells() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<uint32_t> *>(VT_FALLBACK_SPEED_CELLS);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_DURATIONS) &&
|
||||
verifier.VerifyVector(durations()) &&
|
||||
VerifyField<uint16_t>(verifier, VT_ROWS, 2) &&
|
||||
VerifyField<uint16_t>(verifier, VT_COLS, 2) &&
|
||||
VerifyOffset(verifier, VT_DISTANCES) &&
|
||||
verifier.VerifyVector(distances()) &&
|
||||
VerifyOffset(verifier, VT_DESTINATIONS) &&
|
||||
verifier.VerifyVector(destinations()) &&
|
||||
verifier.VerifyVectorOfTables(destinations()) &&
|
||||
VerifyOffset(verifier, VT_FALLBACK_SPEED_CELLS) &&
|
||||
verifier.VerifyVector(fallback_speed_cells()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct TableResultBuilder {
|
||||
typedef TableResult Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_durations(::flatbuffers::Offset<::flatbuffers::Vector<float>> durations) {
|
||||
fbb_.AddOffset(TableResult::VT_DURATIONS, durations);
|
||||
}
|
||||
void add_rows(uint16_t rows) {
|
||||
fbb_.AddElement<uint16_t>(TableResult::VT_ROWS, rows, 0);
|
||||
}
|
||||
void add_cols(uint16_t cols) {
|
||||
fbb_.AddElement<uint16_t>(TableResult::VT_COLS, cols, 0);
|
||||
}
|
||||
void add_distances(::flatbuffers::Offset<::flatbuffers::Vector<float>> distances) {
|
||||
fbb_.AddOffset(TableResult::VT_DISTANCES, distances);
|
||||
}
|
||||
void add_destinations(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> destinations) {
|
||||
fbb_.AddOffset(TableResult::VT_DESTINATIONS, destinations);
|
||||
}
|
||||
void add_fallback_speed_cells(::flatbuffers::Offset<::flatbuffers::Vector<uint32_t>> fallback_speed_cells) {
|
||||
fbb_.AddOffset(TableResult::VT_FALLBACK_SPEED_CELLS, fallback_speed_cells);
|
||||
}
|
||||
explicit TableResultBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<TableResult> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<TableResult>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<TableResult> CreateTableResult(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<float>> durations = 0,
|
||||
uint16_t rows = 0,
|
||||
uint16_t cols = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<float>> distances = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>> destinations = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<uint32_t>> fallback_speed_cells = 0) {
|
||||
TableResultBuilder builder_(_fbb);
|
||||
builder_.add_fallback_speed_cells(fallback_speed_cells);
|
||||
builder_.add_destinations(destinations);
|
||||
builder_.add_distances(distances);
|
||||
builder_.add_durations(durations);
|
||||
builder_.add_cols(cols);
|
||||
builder_.add_rows(rows);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<TableResult> CreateTableResultDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const std::vector<float> *durations = nullptr,
|
||||
uint16_t rows = 0,
|
||||
uint16_t cols = 0,
|
||||
const std::vector<float> *distances = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>> *destinations = nullptr,
|
||||
const std::vector<uint32_t> *fallback_speed_cells = nullptr) {
|
||||
auto durations__ = durations ? _fbb.CreateVector<float>(*durations) : 0;
|
||||
auto distances__ = distances ? _fbb.CreateVector<float>(*distances) : 0;
|
||||
auto destinations__ = destinations ? _fbb.CreateVector<::flatbuffers::Offset<osrm::engine::api::fbresult::Waypoint>>(*destinations) : 0;
|
||||
auto fallback_speed_cells__ = fallback_speed_cells ? _fbb.CreateVector<uint32_t>(*fallback_speed_cells) : 0;
|
||||
return osrm::engine::api::fbresult::CreateTableResult(
|
||||
_fbb,
|
||||
durations__,
|
||||
rows,
|
||||
cols,
|
||||
distances__,
|
||||
destinations__,
|
||||
fallback_speed_cells__);
|
||||
}
|
||||
|
||||
} // namespace fbresult
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_TABLE_OSRM_ENGINE_API_FBRESULT_H_
|
||||
@@ -0,0 +1,205 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
#define FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 3 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 25,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "position_generated.h"
|
||||
|
||||
namespace osrm {
|
||||
namespace engine {
|
||||
namespace api {
|
||||
namespace fbresult {
|
||||
|
||||
struct Uint64Pair;
|
||||
|
||||
struct Waypoint;
|
||||
struct WaypointBuilder;
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Uint64Pair FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
uint64_t first_;
|
||||
uint64_t second_;
|
||||
|
||||
public:
|
||||
Uint64Pair()
|
||||
: first_(0),
|
||||
second_(0) {
|
||||
}
|
||||
Uint64Pair(uint64_t _first, uint64_t _second)
|
||||
: first_(::flatbuffers::EndianScalar(_first)),
|
||||
second_(::flatbuffers::EndianScalar(_second)) {
|
||||
}
|
||||
uint64_t first() const {
|
||||
return ::flatbuffers::EndianScalar(first_);
|
||||
}
|
||||
uint64_t second() const {
|
||||
return ::flatbuffers::EndianScalar(second_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Uint64Pair, 16);
|
||||
|
||||
struct Waypoint FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef WaypointBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_HINT = 4,
|
||||
VT_DISTANCE = 6,
|
||||
VT_NAME = 8,
|
||||
VT_LOCATION = 10,
|
||||
VT_NODES = 12,
|
||||
VT_MATCHINGS_INDEX = 14,
|
||||
VT_WAYPOINT_INDEX = 16,
|
||||
VT_ALTERNATIVES_COUNT = 18,
|
||||
VT_TRIPS_INDEX = 20
|
||||
};
|
||||
const ::flatbuffers::String *hint() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_HINT);
|
||||
}
|
||||
float distance() const {
|
||||
return GetField<float>(VT_DISTANCE, 0.0f);
|
||||
}
|
||||
const ::flatbuffers::String *name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_NAME);
|
||||
}
|
||||
const osrm::engine::api::fbresult::Position *location() const {
|
||||
return GetStruct<const osrm::engine::api::fbresult::Position *>(VT_LOCATION);
|
||||
}
|
||||
const osrm::engine::api::fbresult::Uint64Pair *nodes() const {
|
||||
return GetStruct<const osrm::engine::api::fbresult::Uint64Pair *>(VT_NODES);
|
||||
}
|
||||
uint32_t matchings_index() const {
|
||||
return GetField<uint32_t>(VT_MATCHINGS_INDEX, 0);
|
||||
}
|
||||
uint32_t waypoint_index() const {
|
||||
return GetField<uint32_t>(VT_WAYPOINT_INDEX, 0);
|
||||
}
|
||||
uint32_t alternatives_count() const {
|
||||
return GetField<uint32_t>(VT_ALTERNATIVES_COUNT, 0);
|
||||
}
|
||||
uint32_t trips_index() const {
|
||||
return GetField<uint32_t>(VT_TRIPS_INDEX, 0);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_HINT) &&
|
||||
verifier.VerifyString(hint()) &&
|
||||
VerifyField<float>(verifier, VT_DISTANCE, 4) &&
|
||||
VerifyOffset(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyField<osrm::engine::api::fbresult::Position>(verifier, VT_LOCATION, 4) &&
|
||||
VerifyField<osrm::engine::api::fbresult::Uint64Pair>(verifier, VT_NODES, 8) &&
|
||||
VerifyField<uint32_t>(verifier, VT_MATCHINGS_INDEX, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_WAYPOINT_INDEX, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_ALTERNATIVES_COUNT, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_TRIPS_INDEX, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct WaypointBuilder {
|
||||
typedef Waypoint Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_hint(::flatbuffers::Offset<::flatbuffers::String> hint) {
|
||||
fbb_.AddOffset(Waypoint::VT_HINT, hint);
|
||||
}
|
||||
void add_distance(float distance) {
|
||||
fbb_.AddElement<float>(Waypoint::VT_DISTANCE, distance, 0.0f);
|
||||
}
|
||||
void add_name(::flatbuffers::Offset<::flatbuffers::String> name) {
|
||||
fbb_.AddOffset(Waypoint::VT_NAME, name);
|
||||
}
|
||||
void add_location(const osrm::engine::api::fbresult::Position *location) {
|
||||
fbb_.AddStruct(Waypoint::VT_LOCATION, location);
|
||||
}
|
||||
void add_nodes(const osrm::engine::api::fbresult::Uint64Pair *nodes) {
|
||||
fbb_.AddStruct(Waypoint::VT_NODES, nodes);
|
||||
}
|
||||
void add_matchings_index(uint32_t matchings_index) {
|
||||
fbb_.AddElement<uint32_t>(Waypoint::VT_MATCHINGS_INDEX, matchings_index, 0);
|
||||
}
|
||||
void add_waypoint_index(uint32_t waypoint_index) {
|
||||
fbb_.AddElement<uint32_t>(Waypoint::VT_WAYPOINT_INDEX, waypoint_index, 0);
|
||||
}
|
||||
void add_alternatives_count(uint32_t alternatives_count) {
|
||||
fbb_.AddElement<uint32_t>(Waypoint::VT_ALTERNATIVES_COUNT, alternatives_count, 0);
|
||||
}
|
||||
void add_trips_index(uint32_t trips_index) {
|
||||
fbb_.AddElement<uint32_t>(Waypoint::VT_TRIPS_INDEX, trips_index, 0);
|
||||
}
|
||||
explicit WaypointBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<Waypoint> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<Waypoint>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<Waypoint> CreateWaypoint(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::String> hint = 0,
|
||||
float distance = 0.0f,
|
||||
::flatbuffers::Offset<::flatbuffers::String> name = 0,
|
||||
const osrm::engine::api::fbresult::Position *location = nullptr,
|
||||
const osrm::engine::api::fbresult::Uint64Pair *nodes = nullptr,
|
||||
uint32_t matchings_index = 0,
|
||||
uint32_t waypoint_index = 0,
|
||||
uint32_t alternatives_count = 0,
|
||||
uint32_t trips_index = 0) {
|
||||
WaypointBuilder builder_(_fbb);
|
||||
builder_.add_trips_index(trips_index);
|
||||
builder_.add_alternatives_count(alternatives_count);
|
||||
builder_.add_waypoint_index(waypoint_index);
|
||||
builder_.add_matchings_index(matchings_index);
|
||||
builder_.add_nodes(nodes);
|
||||
builder_.add_location(location);
|
||||
builder_.add_name(name);
|
||||
builder_.add_distance(distance);
|
||||
builder_.add_hint(hint);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<Waypoint> CreateWaypointDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *hint = nullptr,
|
||||
float distance = 0.0f,
|
||||
const char *name = nullptr,
|
||||
const osrm::engine::api::fbresult::Position *location = nullptr,
|
||||
const osrm::engine::api::fbresult::Uint64Pair *nodes = nullptr,
|
||||
uint32_t matchings_index = 0,
|
||||
uint32_t waypoint_index = 0,
|
||||
uint32_t alternatives_count = 0,
|
||||
uint32_t trips_index = 0) {
|
||||
auto hint__ = hint ? _fbb.CreateString(hint) : 0;
|
||||
auto name__ = name ? _fbb.CreateString(name) : 0;
|
||||
return osrm::engine::api::fbresult::CreateWaypoint(
|
||||
_fbb,
|
||||
hint__,
|
||||
distance,
|
||||
name__,
|
||||
location,
|
||||
nodes,
|
||||
matchings_index,
|
||||
waypoint_index,
|
||||
alternatives_count,
|
||||
trips_index);
|
||||
}
|
||||
|
||||
} // namespace fbresult
|
||||
} // namespace api
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_WAYPOINT_OSRM_ENGINE_API_FBRESULT_H_
|
||||
@@ -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());
|
||||
|
||||
@@ -14,7 +14,7 @@ table FBResult {
|
||||
data_version: string;
|
||||
waypoints: [Waypoint]; //Used as 'sources' waypoints for a 'Table' service
|
||||
routes: [RouteObject];
|
||||
table: Table;
|
||||
table: TableResult;
|
||||
}
|
||||
|
||||
root_type FBResult;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
include "waypoint.fbs";
|
||||
namespace osrm.engine.api.fbresult;
|
||||
|
||||
table Table {
|
||||
table TableResult {
|
||||
durations: [float];
|
||||
rows: ushort;
|
||||
cols: ushort;
|
||||
|
||||
@@ -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<std::uint64_t>(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<std::uint64_t>(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<std::uint64_t>(osm_node_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ class TableAPI final : public BaseAPI
|
||||
speed_cells = MakeEstimatesTable(fb_result, fallback_speed_cells);
|
||||
}
|
||||
|
||||
fbresult::TableBuilder table(fb_result);
|
||||
fbresult::TableResultBuilder table(fb_result);
|
||||
table.add_destinations(destinations);
|
||||
table.add_rows(number_of_sources);
|
||||
table.add_cols(number_of_destinations);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <boost/archive/iterators/base64_from_binary.hpp>
|
||||
#include <boost/archive/iterators/binary_from_base64.hpp>
|
||||
#include <boost/archive/iterators/transform_width.hpp>
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
|
||||
@@ -603,6 +603,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)
|
||||
|
||||
@@ -29,13 +29,11 @@
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/range/any_range.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include <engine/bearing.hpp>
|
||||
#include <optional>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
@@ -50,20 +48,21 @@ class BaseDataFacade
|
||||
using RTreeLeaf = extractor::EdgeBasedNodeSegment;
|
||||
|
||||
using NodeForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
|
||||
using NodeReverseRange = boost::reversed_range<const NodeForwardRange>;
|
||||
std::ranges::subrange<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
|
||||
using NodeReverseRange = std::ranges::reverse_view<NodeForwardRange>;
|
||||
|
||||
using WeightForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
|
||||
using WeightReverseRange = boost::reversed_range<const WeightForwardRange>;
|
||||
std::ranges::subrange<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
|
||||
|
||||
using WeightReverseRange = std::ranges::reverse_view<WeightForwardRange>;
|
||||
|
||||
using DurationForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
|
||||
using DurationReverseRange = boost::reversed_range<const DurationForwardRange>;
|
||||
std::ranges::subrange<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
|
||||
using DurationReverseRange = std::ranges::reverse_view<DurationForwardRange>;
|
||||
|
||||
using DatasourceForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
|
||||
using DatasourceReverseRange = boost::reversed_range<const DatasourceForwardRange>;
|
||||
std::ranges::subrange<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
|
||||
using DatasourceReverseRange = std::ranges::reverse_view<DatasourceForwardRange>;
|
||||
|
||||
BaseDataFacade() {}
|
||||
virtual ~BaseDataFacade() {}
|
||||
|
||||
@@ -394,7 +394,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
alias_cast<EdgeDuration>(forward_durations[data.fwd_segment_position]);
|
||||
EdgeDistance forward_distance =
|
||||
to_alias<EdgeDistance>(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<EdgeWeight>(
|
||||
@@ -426,7 +426,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
EdgeDistance reverse_distance =
|
||||
to_alias<EdgeDistance>(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)
|
||||
|
||||
@@ -61,7 +61,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 +142,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 +154,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
from_alias<double>(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 +168,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());
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
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
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "util/query_heap.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/thread/tss.hpp>
|
||||
|
||||
namespace osrm::engine
|
||||
{
|
||||
|
||||
@@ -45,19 +43,19 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||
ManyToManyHeapData,
|
||||
util::UnorderedMapStorage<NodeID, int>>;
|
||||
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
||||
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
static SearchEngineHeapPtr reverse_heap_1;
|
||||
static SearchEngineHeapPtr forward_heap_2;
|
||||
static SearchEngineHeapPtr reverse_heap_2;
|
||||
static SearchEngineHeapPtr forward_heap_3;
|
||||
static SearchEngineHeapPtr reverse_heap_3;
|
||||
static ManyToManyHeapPtr many_to_many_heap;
|
||||
static SearchEngineHeapPtr map_matching_forward_heap_1;
|
||||
static SearchEngineHeapPtr map_matching_reverse_heap_1;
|
||||
static thread_local SearchEngineHeapPtr forward_heap_1;
|
||||
static thread_local SearchEngineHeapPtr reverse_heap_1;
|
||||
static thread_local SearchEngineHeapPtr forward_heap_2;
|
||||
static thread_local SearchEngineHeapPtr reverse_heap_2;
|
||||
static thread_local SearchEngineHeapPtr forward_heap_3;
|
||||
static thread_local SearchEngineHeapPtr reverse_heap_3;
|
||||
static thread_local ManyToManyHeapPtr many_to_many_heap;
|
||||
static thread_local SearchEngineHeapPtr map_matching_forward_heap_1;
|
||||
static thread_local SearchEngineHeapPtr map_matching_reverse_heap_1;
|
||||
|
||||
void InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes);
|
||||
|
||||
@@ -127,16 +125,16 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
||||
MapMatchingMultiLayerDijkstraHeapData,
|
||||
util::TwoLevelStorage<NodeID, int>>;
|
||||
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
using MapMatchingHeapPtr = boost::thread_specific_ptr<MapMatchingQueryHeap>;
|
||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
||||
using MapMatchingHeapPtr = std::unique_ptr<MapMatchingQueryHeap>;
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
static SearchEngineHeapPtr reverse_heap_1;
|
||||
static MapMatchingHeapPtr map_matching_forward_heap_1;
|
||||
static MapMatchingHeapPtr map_matching_reverse_heap_1;
|
||||
static thread_local SearchEngineHeapPtr forward_heap_1;
|
||||
static thread_local SearchEngineHeapPtr reverse_heap_1;
|
||||
static thread_local MapMatchingHeapPtr map_matching_forward_heap_1;
|
||||
static thread_local MapMatchingHeapPtr map_matching_reverse_heap_1;
|
||||
|
||||
static ManyToManyHeapPtr many_to_many_heap;
|
||||
static thread_local ManyToManyHeapPtr many_to_many_heap;
|
||||
|
||||
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes,
|
||||
unsigned number_of_boundary_nodes);
|
||||
@@ -148,4 +146,4 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
||||
};
|
||||
} // namespace osrm::engine
|
||||
|
||||
#endif // SEARCH_ENGINE_DATA_HPP
|
||||
#endif // SEARCH_ENGINE_DATA_HPP
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
namespace osrm::extractor
|
||||
{
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "restriction_graph.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -26,7 +24,7 @@ template <typename RestrictionFilter> 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 +32,7 @@ template <typename RestrictionFilter> 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:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/node_based_graph.hpp"
|
||||
#include "util/std_hash.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <ranges>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace osrm::extractor
|
||||
@@ -102,9 +102,9 @@ struct RestrictionGraph
|
||||
friend restriction_graph_details::transferBuilder;
|
||||
friend RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &);
|
||||
|
||||
using EdgeRange = boost::iterator_range<std::vector<RestrictionEdge>::const_iterator>;
|
||||
using EdgeRange = std::ranges::subrange<std::vector<RestrictionEdge>::const_iterator>;
|
||||
using RestrictionRange =
|
||||
boost::iterator_range<std::vector<const TurnRestriction *>::const_iterator>;
|
||||
std::ranges::subrange<std::vector<const TurnRestriction *>::const_iterator>;
|
||||
using EdgeKey = std::pair<NodeID, NodeID>;
|
||||
|
||||
// Helper functions for iterating over node restrictions and edges
|
||||
|
||||
@@ -7,11 +7,8 @@
|
||||
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
#include "storage/tar_fwd.hpp"
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -79,12 +76,12 @@ template <storage::Ownership Ownership> 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 +89,7 @@ template <storage::Ownership Ownership> 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 +97,7 @@ template <storage::Ownership Ownership> 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 +105,7 @@ template <storage::Ownership Ownership> 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 +113,7 @@ template <storage::Ownership Ownership> 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 +121,7 @@ template <storage::Ownership Ownership> 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 +129,7 @@ template <storage::Ownership Ownership> 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 +137,12 @@ template <storage::Ownership Ownership> 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 +150,7 @@ template <storage::Ownership Ownership> 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 +158,7 @@ template <storage::Ownership Ownership> 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 +166,7 @@ template <storage::Ownership Ownership> 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 +174,7 @@ template <storage::Ownership Ownership> 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 +182,7 @@ template <storage::Ownership Ownership> 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 +190,7 @@ template <storage::Ownership Ownership> 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; }
|
||||
|
||||
@@ -30,7 +30,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;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -40,7 +40,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;
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
#include "customizer/cell_metric.hpp"
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <ranges>
|
||||
#include <tbb/parallel_sort.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -128,19 +126,19 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
||||
|
||||
friend class ::boost::iterator_core_access;
|
||||
ValuePtrT current;
|
||||
const std::size_t stride;
|
||||
std::size_t stride;
|
||||
};
|
||||
|
||||
template <typename ValuePtr> 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 <typename ValuePtr> auto GetInRange(const ValuePtr ptr, const NodeID node) const
|
||||
@@ -148,14 +146,14 @@ template <storage::Ownership Ownership> 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<ValuePtr>{},
|
||||
ColumnIterator<ValuePtr>{});
|
||||
return std::ranges::subrange(ColumnIterator<ValuePtr>{},
|
||||
ColumnIterator<ValuePtr>{});
|
||||
|
||||
auto column = std::distance(destination_boundary, iter);
|
||||
auto begin = ColumnIterator<ValuePtr>{ptr + column, num_destination_nodes};
|
||||
auto end = ColumnIterator<ValuePtr>{
|
||||
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 <storage::Ownership Ownership> 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,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <ranges>
|
||||
|
||||
namespace osrm::partitioner
|
||||
{
|
||||
@@ -281,7 +281,7 @@ template <storage::Ownership Ownership> 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()];
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <ranges>
|
||||
namespace osrm::partitioner
|
||||
{
|
||||
|
||||
@@ -84,26 +83,26 @@ template <typename NodeEntryT, typename EdgeEntryT> 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 +117,8 @@ template <typename NodeEntryT, typename EdgeEntryT> 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
|
||||
{
|
||||
|
||||
@@ -11,46 +11,6 @@ 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
|
||||
|
||||
@@ -2,43 +2,13 @@
|
||||
#define OSRM_UTIL_BIT_RANGE_HPP
|
||||
|
||||
#include "util/msb.hpp"
|
||||
|
||||
#include <bit>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
namespace osrm::util
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename T> std::size_t countOnes(T value)
|
||||
{
|
||||
static_assert(std::is_unsigned<T>::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 <typename DataT>
|
||||
@@ -70,7 +40,7 @@ class BitIterator : public boost::iterator_facade<BitIterator<DataT>,
|
||||
|
||||
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<BitIterator<DataT>,
|
||||
// Returns range over all 1 bits of value
|
||||
template <typename T> auto makeBitRange(const T value)
|
||||
{
|
||||
return boost::make_iterator_range(BitIterator<T>{value}, BitIterator<T>{});
|
||||
return std::ranges::subrange(BitIterator<T>{value}, BitIterator<T>{});
|
||||
}
|
||||
} // namespace osrm::util
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ using Value = std::variant<String, Number, Object, Array, True, False, Null>;
|
||||
*/
|
||||
struct Object
|
||||
{
|
||||
std::unordered_map<std::string, Value> values;
|
||||
std::unordered_map<std::string_view, Value> values;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,13 +44,13 @@ struct Comparator
|
||||
|
||||
bool operator()(const Object &lhs, const Object &rhs) const
|
||||
{
|
||||
std::set<std::string> lhs_keys;
|
||||
std::set<std::string_view> lhs_keys;
|
||||
for (const auto &key_value : lhs.values)
|
||||
{
|
||||
lhs_keys.insert(key_value.first);
|
||||
}
|
||||
|
||||
std::set<std::string> rhs_keys;
|
||||
std::set<std::string_view> rhs_keys;
|
||||
for (const auto &key_value : rhs.values)
|
||||
{
|
||||
rhs_keys.insert(key_value.first);
|
||||
@@ -60,7 +60,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 +69,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 +81,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;
|
||||
|
||||
@@ -97,7 +97,7 @@ template <typename Out> 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 +110,7 @@ template <typename Out> struct Renderer
|
||||
Out &out;
|
||||
};
|
||||
|
||||
template <> void Renderer<std::vector<char>>::write(const std::string &str)
|
||||
template <> void Renderer<std::vector<char>>::write(std::string_view str)
|
||||
{
|
||||
out.insert(out.end(), str.begin(), str.end());
|
||||
}
|
||||
@@ -122,7 +122,7 @@ template <> void Renderer<std::vector<char>>::write(const char *str, size_t size
|
||||
|
||||
template <> void Renderer<std::vector<char>>::write(char ch) { out.push_back(ch); }
|
||||
|
||||
template <> void Renderer<std::ostream>::write(const std::string &str) { out << str; }
|
||||
template <> void Renderer<std::ostream>::write(std::string_view str) { out << str; }
|
||||
|
||||
template <> void Renderer<std::ostream>::write(const char *str, size_t size)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ template <> void Renderer<std::ostream>::write(const char *str, size_t size)
|
||||
|
||||
template <> void Renderer<std::ostream>::write(char ch) { out << ch; }
|
||||
|
||||
template <> void Renderer<std::string>::write(const std::string &str) { out += str; }
|
||||
template <> void Renderer<std::string>::write(std::string_view str) { out += str; }
|
||||
|
||||
template <> void Renderer<std::string>::write(const char *str, size_t size)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define MEMINFO_HPP
|
||||
|
||||
#include "util/log.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/resource.h>
|
||||
@@ -10,22 +11,31 @@
|
||||
namespace osrm::util
|
||||
{
|
||||
|
||||
inline void DumpMemoryStats()
|
||||
inline size_t PeakRAMUsedInBytes()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
rusage usage;
|
||||
getrusage(RUSAGE_SELF, &usage);
|
||||
#ifdef __linux__
|
||||
// Under linux, ru.maxrss is in kb
|
||||
util::Log() << "RAM: peak bytes used: " << usage.ru_maxrss * 1024;
|
||||
return usage.ru_maxrss * 1024;
|
||||
#else // __linux__
|
||||
// Under BSD systems (OSX), it's in bytes
|
||||
util::Log() << "RAM: peak bytes used: " << usage.ru_maxrss;
|
||||
return usage.ru_maxrss;
|
||||
#endif // __linux__
|
||||
#else // _WIN32
|
||||
return 0;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
inline void DumpMemoryStats()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
util::Log() << "RAM: peak bytes used: " << PeakRAMUsedInBytes();
|
||||
#else // _WIN32
|
||||
util::Log() << "RAM: peak bytes used: <not implemented on Windows>";
|
||||
#endif // _WIN32
|
||||
}
|
||||
} // namespace osrm::util
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+7
-33
@@ -1,50 +1,24 @@
|
||||
#ifndef OSRM_UTIL_MSB_HPP
|
||||
#define OSRM_UTIL_MSB_HPP
|
||||
|
||||
#include <bit>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <limits>
|
||||
|
||||
namespace osrm::util
|
||||
{
|
||||
|
||||
// get the msb of an integer
|
||||
// return 0 for integers without msb
|
||||
template <typename T> std::size_t msb(T value)
|
||||
{
|
||||
BOOST_ASSERT(value > 0);
|
||||
|
||||
static_assert(std::is_integral<T>::value && !std::is_signed<T>::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<unsigned char>::digits * sizeof(T) - 1;
|
||||
|
||||
return MSB_INDEX - std::countl_zero(value);
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
#endif
|
||||
} // namespace osrm::util
|
||||
|
||||
#endif
|
||||
|
||||
@@ -340,6 +340,8 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
|
||||
{
|
||||
}
|
||||
|
||||
ReferenceT operator[](difference_type n) const { return container->operator[](index + n); }
|
||||
|
||||
private:
|
||||
void increment() { ++index; }
|
||||
void decrement() { --index; }
|
||||
|
||||
@@ -15,48 +15,6 @@
|
||||
namespace osrm::util
|
||||
{
|
||||
|
||||
template <typename NodeID, typename Key> class GenerationArrayStorage
|
||||
{
|
||||
using GenerationCounter = std::uint16_t;
|
||||
|
||||
public:
|
||||
explicit GenerationArrayStorage(std::size_t size)
|
||||
: positions(size, 0), generation(1), generations(size, 0)
|
||||
{
|
||||
}
|
||||
|
||||
Key &operator[](NodeID node)
|
||||
{
|
||||
generation[node] = generation;
|
||||
return positions[node];
|
||||
}
|
||||
|
||||
Key peek_index(const NodeID node) const
|
||||
{
|
||||
if (generations[node] < generation)
|
||||
{
|
||||
return std::numeric_limits<Key>::max();
|
||||
}
|
||||
return positions[node];
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
generation++;
|
||||
// if generation overflows we end up at 0 again and need to clear the vector
|
||||
if (generation == 0)
|
||||
{
|
||||
generation = 1;
|
||||
std::fill(generations.begin(), generations.end(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
GenerationCounter generation;
|
||||
std::vector<GenerationCounter> generations;
|
||||
std::vector<Key> positions;
|
||||
};
|
||||
|
||||
template <typename NodeID, typename Key> class ArrayStorage
|
||||
{
|
||||
public:
|
||||
@@ -72,29 +30,6 @@ template <typename NodeID, typename Key> class ArrayStorage
|
||||
std::vector<Key> positions;
|
||||
};
|
||||
|
||||
template <typename NodeID, typename Key> class MapStorage
|
||||
{
|
||||
public:
|
||||
explicit MapStorage(std::size_t) {}
|
||||
|
||||
Key &operator[](NodeID node) { return nodes[node]; }
|
||||
|
||||
void Clear() { nodes.clear(); }
|
||||
|
||||
Key peek_index(const NodeID node) const
|
||||
{
|
||||
const auto iter = nodes.find(node);
|
||||
if (nodes.end() != iter)
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
return std::numeric_limits<Key>::max();
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<NodeID, Key> nodes;
|
||||
};
|
||||
|
||||
template <typename NodeID, typename Key> class UnorderedMapStorage
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -42,6 +42,8 @@ class VectorViewIterator : public boost::iterator_facade<VectorViewIterator<Data
|
||||
explicit VectorViewIterator() : m_value(nullptr) {}
|
||||
explicit VectorViewIterator(DataT *x) : m_value(x) {}
|
||||
|
||||
reference operator[](difference_type n) const { return m_value[n]; }
|
||||
|
||||
private:
|
||||
void increment() { ++m_value; }
|
||||
void decrement() { --m_value; }
|
||||
|
||||
Generated
+12
-1
@@ -10,7 +10,8 @@
|
||||
"hasInstallScript": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.11"
|
||||
"@mapbox/node-pre-gyp": "^1.0.11",
|
||||
"seedrandom": "^3.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.18.10",
|
||||
@@ -14652,6 +14653,11 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"devOptional": true
|
||||
},
|
||||
"node_modules/seedrandom": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
|
||||
"integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
|
||||
@@ -30296,6 +30302,11 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"devOptional": true
|
||||
},
|
||||
"seedrandom": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
|
||||
"integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
|
||||
|
||||
+7
-4
@@ -4,7 +4,8 @@
|
||||
"private": false,
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++ designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.11"
|
||||
"@mapbox/node-pre-gyp": "^1.0.11",
|
||||
"seedrandom": "^3.0.5"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
@@ -57,6 +58,7 @@
|
||||
"jsonpath": "^1.1.1",
|
||||
"mkdirp": "^0.5.6",
|
||||
"node-addon-api": "^5.0.0",
|
||||
"node-cmake": "^2.5.1",
|
||||
"node-timeout": "0.0.4",
|
||||
"polyline": "^0.2.0",
|
||||
"request": "^2.88.2",
|
||||
@@ -64,12 +66,13 @@
|
||||
"tape": "^4.16.0",
|
||||
"turf": "^3.0.14",
|
||||
"uglify-js": "^3.17.0",
|
||||
"xmlbuilder": "^4.2.1",
|
||||
"node-cmake": "^2.5.1"
|
||||
"xmlbuilder": "^4.2.1"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"binary": {
|
||||
"napi_versions": [8],
|
||||
"napi_versions": [
|
||||
8
|
||||
],
|
||||
"module_name": "node_osrm",
|
||||
"module_path": "./lib/binding_napi_v{napi_build_version}/",
|
||||
"host": "https://github.com",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -90,6 +90,7 @@ function setup()
|
||||
path = walking_speed,
|
||||
steps = walking_speed,
|
||||
pedestrian = walking_speed,
|
||||
platform = walking_speed,
|
||||
footway = walking_speed,
|
||||
pier = walking_speed,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readline = require('readline');
|
||||
const seedrandom = require('seedrandom');
|
||||
|
||||
|
||||
let RNG;
|
||||
|
||||
class GPSData {
|
||||
constructor(gpsTracesFilePath) {
|
||||
this.tracks = {};
|
||||
this.coordinates = [];
|
||||
this.trackIds = [];
|
||||
this._loadGPSTraces(gpsTracesFilePath);
|
||||
}
|
||||
|
||||
_loadGPSTraces(gpsTracesFilePath) {
|
||||
const expandedPath = path.resolve(gpsTracesFilePath);
|
||||
const data = fs.readFileSync(expandedPath, 'utf-8');
|
||||
const lines = data.split('\n');
|
||||
const headers = lines[0].split(',');
|
||||
|
||||
const latitudeIndex = headers.indexOf('Latitude');
|
||||
const longitudeIndex = headers.indexOf('Longitude');
|
||||
const trackIdIndex = headers.indexOf('TrackID');
|
||||
|
||||
for (let i = 1; i < lines.length; i++) {
|
||||
if (lines[i].trim() === '') continue;
|
||||
const row = lines[i].split(',');
|
||||
|
||||
const latitude = parseFloat(row[latitudeIndex]);
|
||||
const longitude = parseFloat(row[longitudeIndex]);
|
||||
const trackId = row[trackIdIndex];
|
||||
|
||||
const coord = [longitude, latitude];
|
||||
this.coordinates.push(coord);
|
||||
|
||||
if (!this.tracks[trackId]) {
|
||||
this.tracks[trackId] = [];
|
||||
}
|
||||
this.tracks[trackId].push(coord);
|
||||
}
|
||||
|
||||
this.trackIds = Object.keys(this.tracks);
|
||||
}
|
||||
|
||||
getRandomCoordinate() {
|
||||
const randomIndex = Math.floor(RNG() * this.coordinates.length);
|
||||
return this.coordinates[randomIndex];
|
||||
}
|
||||
|
||||
getRandomTrack() {
|
||||
const randomIndex = Math.floor(RNG() * this.trackIds.length);
|
||||
const trackId = this.trackIds[randomIndex];
|
||||
return this.tracks[trackId];
|
||||
}
|
||||
};
|
||||
|
||||
async function runOSRMMethod(osrm, method, coordinates) {
|
||||
const time = await new Promise((resolve, reject) => {
|
||||
const startTime = process.hrtime();
|
||||
osrm[method]({coordinates}, (err, result) => {
|
||||
if (err) {
|
||||
if (['NoSegment', 'NoMatch', 'NoRoute', 'NoTrips'].includes(err.message)) {
|
||||
resolve(null);
|
||||
} else {
|
||||
|
||||
reject(err);
|
||||
}
|
||||
} else {
|
||||
const endTime = process.hrtime(startTime);
|
||||
resolve(endTime[0] + endTime[1] / 1e9);
|
||||
}
|
||||
});
|
||||
});
|
||||
return time;
|
||||
}
|
||||
|
||||
async function nearest(osrm, gpsData) {
|
||||
const times = [];
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const coord = gpsData.getRandomCoordinate();
|
||||
times.push(await runOSRMMethod(osrm, 'nearest', [coord]));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
async function route(osrm, gpsData) {
|
||||
const times = [];
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const from = gpsData.getRandomCoordinate();
|
||||
const to = gpsData.getRandomCoordinate();
|
||||
|
||||
|
||||
times.push(await runOSRMMethod(osrm, 'route', [from, to]));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
async function table(osrm, gpsData) {
|
||||
const times = [];
|
||||
for (let i = 0; i < 250; i++) {
|
||||
const numPoints = Math.floor(RNG() * 3) + 15;
|
||||
const coordinates = [];
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
coordinates.push(gpsData.getRandomCoordinate());
|
||||
}
|
||||
|
||||
|
||||
times.push(await runOSRMMethod(osrm, 'table', coordinates));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
async function match(osrm, gpsData) {
|
||||
const times = [];
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const numPoints = Math.floor(RNG() * 50) + 50;
|
||||
const coordinates = gpsData.getRandomTrack().slice(0, numPoints);
|
||||
|
||||
|
||||
times.push(await runOSRMMethod(osrm, 'match', coordinates));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
async function trip(osrm, gpsData) {
|
||||
const times = [];
|
||||
for (let i = 0; i < 250; i++) {
|
||||
const numPoints = Math.floor(RNG() * 2) + 5;
|
||||
const coordinates = [];
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
coordinates.push(gpsData.getRandomCoordinate());
|
||||
}
|
||||
|
||||
|
||||
times.push(await runOSRMMethod(osrm, 'trip', coordinates));
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
function bootstrapConfidenceInterval(data, numSamples = 1000, confidenceLevel = 0.95) {
|
||||
let means = [];
|
||||
let dataLength = data.length;
|
||||
|
||||
for (let i = 0; i < numSamples; i++) {
|
||||
let sample = [];
|
||||
for (let j = 0; j < dataLength; j++) {
|
||||
let randomIndex = Math.floor(RNG() * dataLength);
|
||||
sample.push(data[randomIndex]);
|
||||
}
|
||||
let sampleMean = sample.reduce((a, b) => a + b, 0) / sample.length;
|
||||
means.push(sampleMean);
|
||||
}
|
||||
|
||||
means.sort((a, b) => a - b);
|
||||
let lowerBoundIndex = Math.floor((1 - confidenceLevel) / 2 * numSamples);
|
||||
let upperBoundIndex = Math.floor((1 + confidenceLevel) / 2 * numSamples);
|
||||
let mean = means.reduce((a, b) => a + b, 0) / means.length;
|
||||
let lowerBound = means[lowerBoundIndex];
|
||||
let upperBound = means[upperBoundIndex];
|
||||
|
||||
return { mean: mean, lowerBound: lowerBound, upperBound: upperBound };
|
||||
}
|
||||
|
||||
function calculateConfidenceInterval(data) {
|
||||
let { mean, lowerBound, upperBound } = bootstrapConfidenceInterval(data);
|
||||
let bestValue = Math.max(...data);
|
||||
let errorMargin = (upperBound - lowerBound) / 2;
|
||||
|
||||
return { mean, errorMargin, bestValue };
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const {OSRM} = require(args[0]);
|
||||
const path = args[1];
|
||||
const algorithm = args[2].toUpperCase();
|
||||
const method = args[3];
|
||||
const gpsTracesFilePath = args[4];
|
||||
const iterations = parseInt(args[5]);
|
||||
|
||||
const gpsData = new GPSData(gpsTracesFilePath);
|
||||
const osrm = new OSRM({path, algorithm});
|
||||
|
||||
|
||||
const functions = {
|
||||
route: route,
|
||||
table: table,
|
||||
nearest: nearest,
|
||||
match: match,
|
||||
trip: trip
|
||||
};
|
||||
const func = functions[method];
|
||||
if (!func) {
|
||||
throw new Error('Unknown method');
|
||||
}
|
||||
const allTimes = [];
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
RNG = seedrandom(42);
|
||||
allTimes.push((await func(osrm, gpsData)).filter(t => t !== null));
|
||||
}
|
||||
|
||||
const opsPerSec = allTimes.map(times => times.length / times.reduce((a, b) => a + b, 0));
|
||||
const { mean, errorMargin, bestValue } = calculateConfidenceInterval(opsPerSec);
|
||||
console.log(`Ops: ${mean.toFixed(1)} ± ${errorMargin.toFixed(1)} ops/s. Best: ${bestValue.toFixed(1)} ops/s`);
|
||||
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -53,6 +53,7 @@ function run_benchmarks_for_folder {
|
||||
mkdir -p $RESULTS_FOLDER
|
||||
|
||||
BENCHMARKS_FOLDER="$BINARIES_FOLDER/src/benchmarks"
|
||||
|
||||
echo "Running match-bench MLD"
|
||||
$BENCHMARKS_FOLDER/match-bench "$FOLDER/test/data/mld/monaco.osrm" mld > "$RESULTS_FOLDER/match_mld.bench"
|
||||
echo "Running match-bench CH"
|
||||
@@ -81,6 +82,18 @@ function run_benchmarks_for_folder {
|
||||
echo "Running osrm-contract"
|
||||
measure_peak_ram_and_time "$BINARIES_FOLDER/osrm-contract $FOLDER/data.osrm" "$RESULTS_FOLDER/osrm_contract.bench"
|
||||
|
||||
|
||||
for ALGORITHM in ch mld; do
|
||||
for BENCH in nearest table trip route match; do
|
||||
echo "Running node $BENCH $ALGORITHM"
|
||||
START=$(date +%s.%N)
|
||||
node $SCRIPTS_FOLDER/scripts/ci/bench.js $FOLDER/lib/binding/node_osrm.node $FOLDER/data.osrm $ALGORITHM $BENCH $GPS_TRACES > "$RESULTS_FOLDER/node_${BENCH}_${ALGORITHM}.bench" 5
|
||||
END=$(date +%s.%N)
|
||||
DIFF=$(echo "$END - $START" | bc)
|
||||
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"
|
||||
|
||||
@@ -59,7 +59,6 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
SET test_region=monaco
|
||||
SET test_region_ch=ch\monaco
|
||||
SET test_region_corech=corech\monaco
|
||||
SET test_region_mld=mld\monaco
|
||||
SET test_osm=%test_region%.osm.pbf
|
||||
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
|
||||
@@ -69,18 +68,13 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
MKDIR ch
|
||||
XCOPY %test_region%.osrm.* ch\
|
||||
XCOPY %test_region%.osrm ch\
|
||||
MKDIR corech
|
||||
XCOPY %test_region%.osrm.* corech\
|
||||
XCOPY %test_region%.osrm corech\
|
||||
MKDIR mld
|
||||
XCOPY %test_region%.osrm.* mld\
|
||||
XCOPY %test_region%.osrm mld\
|
||||
%CONFIGURATION%\osrm-contract.exe %test_region_ch%.osrm
|
||||
%CONFIGURATION%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
|
||||
%CONFIGURATION%\osrm-partition.exe %test_region_mld%.osrm
|
||||
%CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm
|
||||
XCOPY /Y ch\*.* ..\test\data\ch\
|
||||
XCOPY /Y corech\*.* ..\test\data\corech\
|
||||
XCOPY /Y mld\*.* ..\test\data\mld\
|
||||
unit_tests\%CONFIGURATION%\library-tests.exe
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
@@ -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
|
||||
@@ -30,6 +30,9 @@ VTZERO_TAG=v1.1.0
|
||||
FMT_PATH="fmtlib/fmt"
|
||||
FMT_TAG=v10.2.1
|
||||
|
||||
FLATBUFFERS_PATH="google/flatbuffers"
|
||||
FLATBUFFERS_TAG=v24.3.25
|
||||
|
||||
function update_subtree () {
|
||||
name=$(echo "$1" | tr '[:lower:]' '[:upper:]')
|
||||
path=$(tmpvar=${name}_PATH && echo ${!tmpvar})
|
||||
@@ -53,6 +56,6 @@ function update_subtree () {
|
||||
}
|
||||
|
||||
## Update dependencies
|
||||
for dep in osmium sol rapidjson microtar protozero vtzero fmt; do
|
||||
for dep in osmium sol rapidjson microtar protozero vtzero fmt flatbuffers; do
|
||||
update_subtree $dep
|
||||
done
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
#include "util/meminfo.hpp"
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
@@ -655,6 +655,12 @@ try
|
||||
std::cerr << "Unknown benchmark: " << benchmarkToRun << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout << "Peak RAM: " << std::setprecision(3)
|
||||
<< static_cast<double>(osrm::util::PeakRAMUsedInBytes()) /
|
||||
static_cast<double>((1024 * 1024))
|
||||
<< "MB" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
|
||||
@@ -9,12 +9,17 @@
|
||||
#include <rapidjson/document.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <unordered_set>
|
||||
|
||||
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<std::string> 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;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "engine/routing_algorithms/routing_base_ch.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@@ -106,7 +106,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &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;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "engine/routing_algorithms/routing_base_mld.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@@ -148,8 +148,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 +169,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 +189,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());
|
||||
@@ -222,7 +222,6 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
std::vector<EdgeDuration> durations_table(target_indices.size(), MAXIMAL_EDGE_DURATION);
|
||||
std::vector<EdgeDistance> distances_table(calculate_distance ? target_indices.size() : 0,
|
||||
MAXIMAL_EDGE_DISTANCE);
|
||||
std::vector<NodeID> middle_nodes_table(target_indices.size(), SPECIAL_NODEID);
|
||||
|
||||
// Collect destination (source) nodes into a map
|
||||
std::unordered_multimap<NodeID, std::tuple<std::size_t, EdgeWeight, EdgeDuration, EdgeDistance>>
|
||||
@@ -307,7 +306,6 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
|
||||
weights_table[index] = path_weight;
|
||||
durations_table[index] = path_duration;
|
||||
current_distance = path_distance;
|
||||
middle_nodes_table[index] = node;
|
||||
}
|
||||
|
||||
// Remove node from destinations list
|
||||
@@ -428,7 +426,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &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;
|
||||
|
||||
@@ -5,16 +5,18 @@ namespace osrm::engine
|
||||
|
||||
// CH heaps
|
||||
using CH = routing_algorithms::ch::Algorithm;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::map_matching_forward_heap_1;
|
||||
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::map_matching_reverse_heap_1;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr
|
||||
SearchEngineData<CH>::map_matching_forward_heap_1;
|
||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr
|
||||
SearchEngineData<CH>::map_matching_reverse_heap_1;
|
||||
|
||||
SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
|
||||
thread_local SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
|
||||
|
||||
void SearchEngineData<CH>::InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes)
|
||||
{
|
||||
@@ -114,11 +116,13 @@ void SearchEngineData<CH>::InitializeOrClearManyToManyThreadLocalStorage(unsigne
|
||||
|
||||
// MLD
|
||||
using MLD = routing_algorithms::mld::Algorithm;
|
||||
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
||||
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_1;
|
||||
SearchEngineData<MLD>::MapMatchingHeapPtr SearchEngineData<MLD>::map_matching_forward_heap_1;
|
||||
SearchEngineData<MLD>::MapMatchingHeapPtr SearchEngineData<MLD>::map_matching_reverse_heap_1;
|
||||
SearchEngineData<MLD>::ManyToManyHeapPtr SearchEngineData<MLD>::many_to_many_heap;
|
||||
thread_local SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
||||
thread_local SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_1;
|
||||
thread_local SearchEngineData<MLD>::MapMatchingHeapPtr
|
||||
SearchEngineData<MLD>::map_matching_forward_heap_1;
|
||||
thread_local SearchEngineData<MLD>::MapMatchingHeapPtr
|
||||
SearchEngineData<MLD>::map_matching_reverse_heap_1;
|
||||
thread_local SearchEngineData<MLD>::ManyToManyHeapPtr SearchEngineData<MLD>::many_to_many_heap;
|
||||
|
||||
void SearchEngineData<MLD>::InitializeOrClearMapMatchingThreadLocalStorage(
|
||||
unsigned number_of_nodes, unsigned number_of_boundary_nodes)
|
||||
@@ -178,4 +182,4 @@ void SearchEngineData<MLD>::InitializeOrClearManyToManyThreadLocalStorage(
|
||||
many_to_many_heap.reset(new ManyToManyQueryHeap(number_of_nodes, number_of_boundary_nodes));
|
||||
}
|
||||
}
|
||||
} // namespace osrm::engine
|
||||
} // namespace osrm::engine
|
||||
@@ -968,11 +968,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(
|
||||
|
||||
@@ -424,13 +424,11 @@ double findEdgeLength(const IntersectionEdgeGeometries &geometries, const EdgeID
|
||||
}
|
||||
|
||||
template <typename RestrictionsRange>
|
||||
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,
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "util/timing_util.hpp"
|
||||
#include <util/for_each_pair.hpp>
|
||||
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
|
||||
namespace osrm::extractor
|
||||
{
|
||||
|
||||
@@ -276,16 +274,16 @@ RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &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
|
||||
|
||||
@@ -124,7 +124,7 @@ bisectionToPartition(const std::vector<BisectionID> &node_to_bisection_id,
|
||||
std::vector<std::uint32_t> 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);
|
||||
|
||||
+5
-14
@@ -46,25 +46,16 @@ return_code parseArguments(int argc,
|
||||
boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
|
||||
->default_value(std::thread::hardware_concurrency()),
|
||||
"Number of threads to use")(
|
||||
"core,k",
|
||||
boost::program_options::value<double>(&contractor_config.core_factor)->default_value(1.0),
|
||||
"DEPRECATED: Will always be 1.0. Percentage of the graph (in vertices) to contract "
|
||||
"[0..1].")("segment-speed-file",
|
||||
boost::program_options::value<std::vector<std::string>>(
|
||||
&contractor_config.updater_config.segment_speed_lookup_paths)
|
||||
->composing(),
|
||||
"Lookup files containing nodeA, nodeB, speed data to adjust edge weights")(
|
||||
"segment-speed-file",
|
||||
boost::program_options::value<std::vector<std::string>>(
|
||||
&contractor_config.updater_config.segment_speed_lookup_paths)
|
||||
->composing(),
|
||||
"Lookup files containing nodeA, nodeB, speed data to adjust edge weights")(
|
||||
"turn-penalty-file",
|
||||
boost::program_options::value<std::vector<std::string>>(
|
||||
&contractor_config.updater_config.turn_penalty_lookup_paths)
|
||||
->composing(),
|
||||
"Lookup files containing from_, to_, via_nodes, and turn penalties to adjust turn weights")(
|
||||
"level-cache,o",
|
||||
boost::program_options::bool_switch(&contractor_config.use_cached_priority)
|
||||
->default_value(false),
|
||||
"DEPRECATED: Will always be false. Use .level file to retain the contraction level for "
|
||||
"each "
|
||||
"node from the last run.")(
|
||||
"edge-weight-updates-over-factor",
|
||||
boost::program_options::value<double>(
|
||||
&contractor_config.updater_config.log_edge_updates_factor)
|
||||
|
||||
@@ -252,11 +252,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 +337,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<std::size_t>(0, new_fwd_durations_range.size()))
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
:: Copyright 2018 Google Inc. All rights reserved.
|
||||
::
|
||||
:: Licensed under the Apache License, Version 2.0 (the "License");
|
||||
:: you may not use this file except in compliance with the License.
|
||||
:: You may obtain a copy of the License at
|
||||
::
|
||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
||||
::
|
||||
:: Unless required by applicable law or agreed to in writing, software
|
||||
:: distributed under the License is distributed on an "AS IS" BASIS,
|
||||
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
:: See the License for the specific language governing permissions and
|
||||
:: limitations under the License.
|
||||
set buildtype=Release
|
||||
if "%1"=="-b" set buildtype=%2
|
||||
|
||||
cd tests
|
||||
call generate_code.bat -b %buildtype% || goto FAIL
|
||||
|
||||
:: TODO: Release and Debug builds produce differences here for some reason.
|
||||
git checkout HEAD -- monster_test.bfbs
|
||||
git checkout HEAD -- arrays_test.bfbs
|
||||
|
||||
git -c core.autocrlf=true diff --exit-code --quiet || goto :DIFFFOUND
|
||||
goto SUCCESS
|
||||
|
||||
:DIFFFOUND
|
||||
@echo "" >&2
|
||||
@echo "ERROR: ********************************************************" >&2
|
||||
@echo "ERROR: The following differences were found after running the" >&2
|
||||
@echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
|
||||
@echo "ERROR: it after making changes in a generator or schema?" >&2
|
||||
@echo "ERROR: ********************************************************" >&2
|
||||
@echo "" >&2
|
||||
@git -c core.autocrlf=true --no-pager diff --binary
|
||||
|
||||
:FAIL
|
||||
set EXITCODE=1
|
||||
:SUCCESS
|
||||
cd ..
|
||||
EXIT /B %EXITCODE%
|
||||
+29
-9
@@ -1,18 +1,38 @@
|
||||
---
|
||||
buildifier: latest
|
||||
bazel: 6.4.0
|
||||
platforms:
|
||||
ubuntu1604:
|
||||
build_targets:
|
||||
- "..."
|
||||
test_targets:
|
||||
- "..."
|
||||
ubuntu1804:
|
||||
environment:
|
||||
CC: clang
|
||||
SWIFT_VERSION: "5.5.3"
|
||||
SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
|
||||
PATH: "$PATH:$SWIFT_HOME/usr/bin"
|
||||
shell_commands:
|
||||
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
|
||||
- "mkdir $SWIFT_HOME"
|
||||
- "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu1804/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu18.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
|
||||
build_targets:
|
||||
- "..."
|
||||
- "//..."
|
||||
test_targets:
|
||||
- "..."
|
||||
- "//..."
|
||||
ubuntu2004:
|
||||
environment:
|
||||
CC: clang
|
||||
SWIFT_VERSION: "5.5.3"
|
||||
SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
|
||||
PATH: "$PATH:$SWIFT_HOME/usr/bin"
|
||||
shell_commands:
|
||||
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
|
||||
- "mkdir $SWIFT_HOME"
|
||||
- "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
|
||||
build_targets:
|
||||
- "//..."
|
||||
test_targets:
|
||||
- "//..."
|
||||
macos:
|
||||
xcode_version: "14.2"
|
||||
build_targets:
|
||||
- "..."
|
||||
- "//..."
|
||||
test_targets:
|
||||
- "..."
|
||||
- "//..."
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
# We cannot use "common" here because the "version" command doesn't support
|
||||
# --deleted_packages. We need to specify it for both build and query instead.
|
||||
build --deleted_packages=tests/ts/bazel_repository_test_dir
|
||||
query --deleted_packages=tests/ts/bazel_repository_test_dir
|
||||
Vendored
+347
@@ -0,0 +1,347 @@
|
||||
---
|
||||
FormatStyle: "file"
|
||||
WarningsAsErrors: "*"
|
||||
HeaderFilterRegex: ".*"
|
||||
Checks: "google-build-explicit-make-pair,
|
||||
google-build-namespaces,
|
||||
google-build-using-namespace,
|
||||
google-default-arguments,
|
||||
google-explicit-constructor,
|
||||
google-global-names-in-headers,
|
||||
google-objc-avoid-nsobject-new,
|
||||
google-objc-avoid-throwing-exception,
|
||||
google-objc-function-naming,
|
||||
google-objc-global-variable-declaration,
|
||||
google-readability-avoid-underscore-in-googletest-name,
|
||||
google-readability-braces-around-statements,
|
||||
google-readability-casting,
|
||||
google-readability-function-size,
|
||||
google-readability-namespace-comments,
|
||||
google-runtime-int,
|
||||
google-runtime-operator,
|
||||
google-upgrade-googletest-case,
|
||||
clang-analyzer-apiModeling.StdCLibraryFunctions,
|
||||
clang-analyzer-apiModeling.TrustNonnull,
|
||||
clang-analyzer-apiModeling.google.GTest,
|
||||
clang-analyzer-apiModeling.llvm.CastValue,
|
||||
clang-analyzer-apiModeling.llvm.ReturnValue,
|
||||
clang-analyzer-core.CallAndMessage,
|
||||
clang-analyzer-core.CallAndMessageModeling,
|
||||
clang-analyzer-core.DivideZero,
|
||||
clang-analyzer-core.DynamicTypePropagation,
|
||||
clang-analyzer-core.NonNullParamChecker,
|
||||
clang-analyzer-core.NonnilStringConstants,
|
||||
clang-analyzer-core.NullDereference,
|
||||
clang-analyzer-core.StackAddrEscapeBase,
|
||||
clang-analyzer-core.StackAddressEscape,
|
||||
clang-analyzer-core.UndefinedBinaryOperatorResult,
|
||||
clang-analyzer-core.VLASize,
|
||||
clang-analyzer-core.builtin.BuiltinFunctions,
|
||||
clang-analyzer-core.builtin.NoReturnFunctions,
|
||||
clang-analyzer-core.uninitialized.ArraySubscript,
|
||||
clang-analyzer-core.uninitialized.Assign,
|
||||
clang-analyzer-core.uninitialized.Branch,
|
||||
clang-analyzer-core.uninitialized.CapturedBlockVariable,
|
||||
clang-analyzer-core.uninitialized.UndefReturn,
|
||||
clang-analyzer-cplusplus.InnerPointer,
|
||||
clang-analyzer-cplusplus.Move,
|
||||
clang-analyzer-cplusplus.NewDelete,
|
||||
clang-analyzer-cplusplus.NewDeleteLeaks,
|
||||
clang-analyzer-cplusplus.PlacementNew,
|
||||
clang-analyzer-cplusplus.PureVirtualCall,
|
||||
clang-analyzer-cplusplus.SelfAssignment,
|
||||
clang-analyzer-cplusplus.SmartPtrModeling,
|
||||
clang-analyzer-cplusplus.StringChecker,
|
||||
clang-analyzer-cplusplus.VirtualCallModeling,
|
||||
clang-analyzer-deadcode.DeadStores,
|
||||
clang-analyzer-fuchsia.HandleChecker,
|
||||
clang-analyzer-nullability.NullPassedToNonnull,
|
||||
clang-analyzer-nullability.NullReturnedFromNonnull,
|
||||
clang-analyzer-nullability.NullabilityBase,
|
||||
clang-analyzer-nullability.NullableDereferenced,
|
||||
clang-analyzer-nullability.NullablePassedToNonnull,
|
||||
clang-analyzer-nullability.NullableReturnedFromNonnull,
|
||||
clang-analyzer-optin.cplusplus.UninitializedObject,
|
||||
clang-analyzer-optin.cplusplus.VirtualCall,
|
||||
clang-analyzer-optin.mpi.MPI-Checker,
|
||||
clang-analyzer-optin.osx.OSObjectCStyleCast,
|
||||
clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
|
||||
clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker,
|
||||
clang-analyzer-optin.performance.GCDAntipattern,
|
||||
clang-analyzer-optin.performance.Padding,
|
||||
clang-analyzer-optin.portability.UnixAPI,
|
||||
clang-analyzer-osx.API,
|
||||
clang-analyzer-osx.MIG,
|
||||
clang-analyzer-osx.NSOrCFErrorDerefChecker,
|
||||
clang-analyzer-osx.NumberObjectConversion,
|
||||
clang-analyzer-osx.OSObjectRetainCount,
|
||||
clang-analyzer-osx.ObjCProperty,
|
||||
clang-analyzer-osx.SecKeychainAPI,
|
||||
clang-analyzer-osx.cocoa.AtSync,
|
||||
clang-analyzer-osx.cocoa.AutoreleaseWrite,
|
||||
clang-analyzer-osx.cocoa.ClassRelease,
|
||||
clang-analyzer-osx.cocoa.Dealloc,
|
||||
clang-analyzer-osx.cocoa.IncompatibleMethodTypes,
|
||||
clang-analyzer-osx.cocoa.Loops,
|
||||
clang-analyzer-osx.cocoa.MissingSuperCall,
|
||||
clang-analyzer-osx.cocoa.NSAutoreleasePool,
|
||||
clang-analyzer-osx.cocoa.NSError,
|
||||
clang-analyzer-osx.cocoa.NilArg,
|
||||
clang-analyzer-osx.cocoa.NonNilReturnValue,
|
||||
clang-analyzer-osx.cocoa.ObjCGenerics,
|
||||
clang-analyzer-osx.cocoa.RetainCount,
|
||||
clang-analyzer-osx.cocoa.RetainCountBase,
|
||||
clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak,
|
||||
clang-analyzer-osx.cocoa.SelfInit,
|
||||
clang-analyzer-osx.cocoa.SuperDealloc,
|
||||
clang-analyzer-osx.cocoa.UnusedIvars,
|
||||
clang-analyzer-osx.cocoa.VariadicMethodTypes,
|
||||
clang-analyzer-osx.coreFoundation.CFError,
|
||||
clang-analyzer-osx.coreFoundation.CFNumber,
|
||||
clang-analyzer-osx.coreFoundation.CFRetainRelease,
|
||||
clang-analyzer-osx.coreFoundation.containers.OutOfBounds,
|
||||
clang-analyzer-osx.coreFoundation.containers.PointerSizedValues,
|
||||
clang-analyzer-security.FloatLoopCounter,
|
||||
clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||
clang-analyzer-security.insecureAPI.SecuritySyntaxChecker,
|
||||
clang-analyzer-security.insecureAPI.UncheckedReturn,
|
||||
clang-analyzer-security.insecureAPI.bcmp,
|
||||
clang-analyzer-security.insecureAPI.bcopy,
|
||||
clang-analyzer-security.insecureAPI.bzero,
|
||||
clang-analyzer-security.insecureAPI.decodeValueOfObjCType,
|
||||
clang-analyzer-security.insecureAPI.getpw,
|
||||
clang-analyzer-security.insecureAPI.gets,
|
||||
clang-analyzer-security.insecureAPI.mkstemp,
|
||||
clang-analyzer-security.insecureAPI.mktemp,
|
||||
clang-analyzer-security.insecureAPI.rand,
|
||||
clang-analyzer-security.insecureAPI.strcpy,
|
||||
clang-analyzer-security.insecureAPI.vfork,
|
||||
clang-analyzer-unix.API,
|
||||
clang-analyzer-unix.DynamicMemoryModeling,
|
||||
clang-analyzer-unix.Malloc,
|
||||
clang-analyzer-unix.MallocSizeof,
|
||||
clang-analyzer-unix.MismatchedDeallocator,
|
||||
clang-analyzer-unix.Vfork,
|
||||
clang-analyzer-unix.cstring.BadSizeArg,
|
||||
clang-analyzer-unix.cstring.CStringModeling,
|
||||
clang-analyzer-unix.cstring.NullArg,
|
||||
clang-analyzer-valist.CopyToSelf,
|
||||
clang-analyzer-valist.Uninitialized,
|
||||
clang-analyzer-valist.Unterminated,
|
||||
clang-analyzer-valist.ValistBase,
|
||||
clang-analyzer-webkit.NoUncountedMemberChecker,
|
||||
clang-analyzer-webkit.RefCntblBaseVirtualDtor,
|
||||
clang-analyzer-webkit.UncountedLambdaCapturesChecker,
|
||||
|
||||
################################################ Optional checks ################################################
|
||||
|
||||
#google-readability-todo,
|
||||
#bugprone-argument-comment,
|
||||
#bugprone-assert-side-effect,
|
||||
#bugprone-bad-signal-to-kill-thread,
|
||||
#bugprone-bool-pointer-implicit-conversion,
|
||||
#bugprone-branch-clone,
|
||||
#bugprone-copy-constructor-init,
|
||||
#bugprone-dangling-handle,
|
||||
#bugprone-dynamic-static-initializers,
|
||||
#bugprone-easily-swappable-parameters,
|
||||
#bugprone-exception-escape,
|
||||
#bugprone-fold-init-type,
|
||||
#bugprone-forward-declaration-namespace,
|
||||
#bugprone-forwarding-reference-overload,
|
||||
#bugprone-implicit-widening-of-multiplication-result,
|
||||
#bugprone-inaccurate-erase,
|
||||
#bugprone-incorrect-roundings,
|
||||
#bugprone-infinite-loop,
|
||||
#bugprone-integer-division,
|
||||
#bugprone-lambda-function-name,
|
||||
#bugprone-macro-parentheses,
|
||||
#bugprone-macro-repeated-side-effects,
|
||||
#bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
#bugprone-misplaced-pointer-arithmetic-in-alloc,
|
||||
#bugprone-misplaced-widening-cast,
|
||||
#bugprone-move-forwarding-reference,
|
||||
#bugprone-multiple-statement-macro,
|
||||
#bugprone-narrowing-conversions,
|
||||
#bugprone-no-escape,
|
||||
#bugprone-not-null-terminated-result,
|
||||
#bugprone-parent-virtual-call,
|
||||
#bugprone-posix-return,
|
||||
#bugprone-redundant-branch-condition,
|
||||
#bugprone-reserved-identifier,
|
||||
#bugprone-signal-handler,
|
||||
#bugprone-signed-char-misuse,
|
||||
#bugprone-sizeof-container,
|
||||
#bugprone-sizeof-expression,
|
||||
#bugprone-spuriously-wake-up-functions,
|
||||
#bugprone-string-constructor,
|
||||
#bugprone-string-integer-assignment,
|
||||
#bugprone-string-literal-with-embedded-nul,
|
||||
#bugprone-stringview-nullptr,
|
||||
#bugprone-suspicious-enum-usage,
|
||||
#bugprone-suspicious-include,
|
||||
#bugprone-suspicious-memory-comparison,
|
||||
#bugprone-suspicious-memset-usage,
|
||||
#bugprone-suspicious-missing-comma,
|
||||
#bugprone-suspicious-semicolon,
|
||||
#bugprone-suspicious-string-compare,
|
||||
#bugprone-swapped-arguments,
|
||||
#bugprone-terminating-continue,
|
||||
#bugprone-throw-keyword-missing,
|
||||
#bugprone-too-small-loop-variable,
|
||||
#bugprone-undefined-memory-manipulation,
|
||||
#bugprone-undelegated-constructor,
|
||||
#bugprone-unhandled-exception-at-new,
|
||||
#bugprone-unhandled-self-assignment,
|
||||
#bugprone-unused-raii,
|
||||
#bugprone-unused-return-value,
|
||||
#bugprone-use-after-move,
|
||||
#bugprone-virtual-near-miss,
|
||||
#cppcoreguidelines-avoid-c-arrays,
|
||||
#cppcoreguidelines-avoid-goto,
|
||||
#cppcoreguidelines-avoid-magic-numbers,
|
||||
#cppcoreguidelines-avoid-non-const-global-variables,
|
||||
#cppcoreguidelines-c-copy-assignment-signature,
|
||||
#cppcoreguidelines-explicit-virtual-functions,
|
||||
#cppcoreguidelines-init-variables,
|
||||
#cppcoreguidelines-interfaces-global-init,
|
||||
#cppcoreguidelines-macro-usage,
|
||||
#cppcoreguidelines-narrowing-conversions,
|
||||
#cppcoreguidelines-no-malloc,
|
||||
#cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
#cppcoreguidelines-owning-memory,
|
||||
#cppcoreguidelines-prefer-member-initializer,
|
||||
#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-cstyle-cast,
|
||||
#cppcoreguidelines-pro-type-member-init,
|
||||
#cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
#cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
#cppcoreguidelines-pro-type-union-access,
|
||||
#cppcoreguidelines-pro-type-vararg,
|
||||
#cppcoreguidelines-slicing,
|
||||
#cppcoreguidelines-special-member-functions,
|
||||
#cppcoreguidelines-virtual-class-destructor,
|
||||
#hicpp-avoid-c-arrays,
|
||||
#hicpp-avoid-goto,
|
||||
#hicpp-braces-around-statements,
|
||||
#hicpp-deprecated-headers,
|
||||
#hicpp-exception-baseclass,
|
||||
#hicpp-explicit-conversions,
|
||||
#hicpp-function-size,
|
||||
#hicpp-invalid-access-moved,
|
||||
#hicpp-member-init,
|
||||
#hicpp-move-const-arg,
|
||||
#hicpp-multiway-paths-covered,
|
||||
#hicpp-named-parameter,
|
||||
#hicpp-new-delete-operators,
|
||||
#hicpp-no-array-decay,
|
||||
#hicpp-no-assembler,
|
||||
#hicpp-no-malloc,
|
||||
#hicpp-noexcept-move,
|
||||
#hicpp-signed-bitwise,
|
||||
#hicpp-special-member-functions,
|
||||
#hicpp-static-assert,
|
||||
#hicpp-undelegated-constructor,
|
||||
#hicpp-uppercase-literal-suffix,
|
||||
#hicpp-use-auto,
|
||||
#hicpp-use-emplace,
|
||||
#hicpp-use-equals-default,
|
||||
#hicpp-use-equals-delete,
|
||||
#hicpp-use-noexcept,
|
||||
#hicpp-use-nullptr,
|
||||
#hicpp-use-override,
|
||||
#hicpp-vararg,
|
||||
#modernize-avoid-bind,
|
||||
#modernize-avoid-c-arrays,
|
||||
#modernize-concat-nested-namespaces,
|
||||
#modernize-deprecated-headers,
|
||||
#modernize-deprecated-ios-base-aliases,
|
||||
#modernize-loop-convert,
|
||||
#modernize-make-shared,
|
||||
#modernize-make-unique,
|
||||
#modernize-pass-by-value,
|
||||
#modernize-raw-string-literal,
|
||||
#modernize-redundant-void-arg,
|
||||
#modernize-replace-auto-ptr,
|
||||
#modernize-replace-disallow-copy-and-assign-macro,
|
||||
#modernize-replace-random-shuffle,
|
||||
#modernize-return-braced-init-list,
|
||||
#modernize-shrink-to-fit,
|
||||
#modernize-unary-static-assert,
|
||||
#modernize-use-auto,
|
||||
#modernize-use-bool-literals,
|
||||
#modernize-use-default-member-init,
|
||||
#modernize-use-emplace,
|
||||
#modernize-use-equals-default,
|
||||
#modernize-use-equals-delete,
|
||||
#modernize-use-nodiscard,
|
||||
#modernize-use-noexcept,
|
||||
#modernize-use-nullptr,
|
||||
#modernize-use-override,
|
||||
#modernize-use-trailing-return-type,
|
||||
#modernize-use-transparent-functors,
|
||||
#modernize-use-uncaught-exceptions,
|
||||
#modernize-use-using,
|
||||
#performance-faster-string-find,
|
||||
#performance-for-range-copy,
|
||||
#performance-implicit-conversion-in-loop,
|
||||
#performance-inefficient-algorithm,
|
||||
#performance-inefficient-string-concatenation,
|
||||
#performance-inefficient-vector-operation,
|
||||
#performance-move-const-arg,
|
||||
#performance-move-constructor-init,
|
||||
#performance-no-automatic-move,
|
||||
#performance-no-int-to-ptr,
|
||||
#performance-noexcept-move-constructor,
|
||||
#performance-trivially-destructible,
|
||||
#performance-type-promotion-in-math-fn,
|
||||
#performance-unnecessary-copy-initialization,
|
||||
#performance-unnecessary-value-param,
|
||||
#portability-restrict-system-includes,
|
||||
#portability-simd-intrinsics,
|
||||
#readability-avoid-const-params-in-decls,
|
||||
#readability-braces-around-statements,
|
||||
#readability-const-return-type,
|
||||
#readability-container-contains,
|
||||
#readability-container-data-pointer,
|
||||
#readability-container-size-empty,
|
||||
#readability-convert-member-functions-to-static,
|
||||
#readability-delete-null-pointer,
|
||||
#readability-duplicate-include,
|
||||
#readability-else-after-return,
|
||||
#readability-function-cognitive-complexity,
|
||||
#readability-function-size,
|
||||
#readability-identifier-length,
|
||||
#readability-identifier-naming,
|
||||
#readability-implicit-bool-conversion,
|
||||
#readability-inconsistent-declaration-parameter-name,
|
||||
#readability-isolate-declaration,
|
||||
#readability-magic-numbers,
|
||||
#readability-make-member-function-const,
|
||||
#readability-misleading-indentation,
|
||||
#readability-misplaced-array-index,
|
||||
#readability-named-parameter,
|
||||
#readability-non-const-parameter,
|
||||
#readability-qualified-auto,
|
||||
#readability-redundant-access-specifiers,
|
||||
#readability-redundant-control-flow,
|
||||
#readability-redundant-declaration,
|
||||
#readability-redundant-function-ptr-dereference,
|
||||
#readability-redundant-member-init,
|
||||
#readability-redundant-preprocessor,
|
||||
#readability-redundant-smartptr-get,
|
||||
#readability-redundant-string-cstr,
|
||||
#readability-redundant-string-init,
|
||||
#readability-simplify-boolean-expr,
|
||||
#readability-simplify-subscript-expr,
|
||||
#readability-static-accessed-through-instance,
|
||||
#readability-static-definition-in-anonymous-namespace,
|
||||
#readability-string-compare,
|
||||
#readability-suspicious-call-argument,
|
||||
#readability-uniqueptr-delete-release,
|
||||
#readability-uppercase-literal-suffix,
|
||||
#readability-use-anyofallof
|
||||
"
|
||||
+1
@@ -5,3 +5,4 @@ root = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/* eslint-env node */
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
]
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
Thank you for submitting an issue!
|
||||
|
||||
Please make sure you include the names of the affected language(s), compiler version(s), operating system version(s), and FlatBuffers version(s) in your issue title.
|
||||
|
||||
This helps us get the correct maintainers to look at your issue. Here are examples of good titles:
|
||||
|
||||
- Crash when accessing FlatBuffer [C++, gcc 4.8, OS X, master]
|
||||
- Flatc converts a protobuf 'bytes' field to 'string' in fbs schema file [all languages, FlatBuffers 1.4]
|
||||
|
||||
Include other details as appropriate.
|
||||
|
||||
Thanks!
|
||||
@@ -1,16 +0,0 @@
|
||||
Thank you for submitting a PR!
|
||||
|
||||
Please make sure you include the names of the affected language(s) in your PR title.
|
||||
This helps us get the correct maintainers to look at your issue.
|
||||
|
||||
If you make changes to any of the code generators, be sure to run
|
||||
`cd tests && sh generate_code.sh` (or equivalent .bat) and include the generated
|
||||
code changes in the PR. This allows us to better see the effect of the PR.
|
||||
|
||||
If your PR includes C++ code, please adhere to the Google C++ Style Guide,
|
||||
and don't forget we try to support older compilers (e.g. VS2010, GCC 4.6.3),
|
||||
so only some C++11 support is available.
|
||||
|
||||
Include other details as appropriate.
|
||||
|
||||
Thanks!
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 365
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 14
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
activity for 1 year. It will be automatically closed if no further activity occurs.
|
||||
To keep it open, simply post a new comment. Maintainers will re-open on
|
||||
new activity. Thank you for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
@@ -1,6 +1,13 @@
|
||||
*_wire.txt
|
||||
*_wire.bin
|
||||
.DS_Store
|
||||
**/.build
|
||||
build
|
||||
**/Packages
|
||||
/*.xcodeproj
|
||||
**/xcuserdata/
|
||||
**/xcshareddata/
|
||||
**/.swiftpm/
|
||||
*.o
|
||||
*.o.d
|
||||
*.class
|
||||
@@ -39,12 +46,16 @@ project.properties
|
||||
proguard-project.txt
|
||||
linklint_results
|
||||
Makefile
|
||||
flatbenchmark
|
||||
flatbenchmark.exe
|
||||
flatc
|
||||
flatc.exe
|
||||
flathash
|
||||
flathash.exe
|
||||
flattests
|
||||
flattests.exe
|
||||
flattests_cpp17
|
||||
flattests_cpp17.exe
|
||||
flatsamplebinary
|
||||
flatsamplebinary.exe
|
||||
flatsampletext
|
||||
@@ -63,13 +74,11 @@ tests/monsterdata_go_wire.mon
|
||||
tests/monsterdata_javascript_wire.mon
|
||||
tests/monsterdata_lobster_wire.mon
|
||||
tests/monsterdata_rust_wire.mon
|
||||
tests/unicode_test.mon
|
||||
tests/ts/
|
||||
tests/php/
|
||||
CMakeLists.txt.user
|
||||
CMakeScripts/**
|
||||
CTestTestfile.cmake
|
||||
FlatbuffersConfigVersion.cmake
|
||||
flatbuffers-config-version.cmake
|
||||
FlatBuffers.cbp
|
||||
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
||||
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
||||
@@ -79,6 +88,7 @@ java/*.iml
|
||||
.idea
|
||||
*.iml
|
||||
target
|
||||
java/target
|
||||
**/*.pyc
|
||||
build/VS2010/FlatBuffers.sdf
|
||||
build/VS2010/FlatBuffers.opensdf
|
||||
@@ -96,7 +106,10 @@ android/build/
|
||||
samples/android/.externalNativeBuild/
|
||||
samples/android/.gradle/
|
||||
samples/android/build/
|
||||
js/flatbuffers.mjs
|
||||
js/**/*.js
|
||||
js/**/*.d.ts
|
||||
mjs/**/*.js
|
||||
mjs/**/*.d.ts
|
||||
/bazel-bin
|
||||
/bazel-flatbuffers
|
||||
/bazel-genfiles
|
||||
@@ -116,3 +129,27 @@ dart/doc/api/
|
||||
Cargo.lock
|
||||
.corpus**
|
||||
.seed**
|
||||
.crash**
|
||||
grpc/google/
|
||||
**/Package.resolved
|
||||
.clangd/**
|
||||
package-lock.json
|
||||
/*.ilk
|
||||
/*.pdb
|
||||
.clwb
|
||||
yarn-error.log
|
||||
.cache/
|
||||
/flatbuffers.lib
|
||||
.cmake/
|
||||
**/dist
|
||||
**/vendor
|
||||
**/go.sum
|
||||
flatbuffers.pc
|
||||
**/FlatBuffers.Test.Swift.xcodeproj
|
||||
**/html/**
|
||||
**/latex/**
|
||||
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_BASE_DIR
|
||||
cmake-build-debug/
|
||||
_deps/
|
||||
**/.gradle/**
|
||||
kotlin/**/generated
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
hoist=false
|
||||
Vendored
-221
@@ -1,221 +0,0 @@
|
||||
env:
|
||||
global:
|
||||
# Set at the root level as this is ignored when set under matrix.env.
|
||||
- GCC_VERSION="4.9"
|
||||
# Fail on first error if UBSAN or ASAN enabled for a target
|
||||
- UBSAN_OPTIONS=halt_on_error=1
|
||||
- ASAN_OPTIONS=halt_on_error=1
|
||||
# Travis machines have 2 cores
|
||||
- JOBS=2
|
||||
- MAKEFLAGS="-j 2"
|
||||
|
||||
conan-linux: &conan-linux
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: python
|
||||
python: "3.7"
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- ./conan/travis/install.sh
|
||||
script:
|
||||
- ./conan/travis/build.sh
|
||||
if: tag IS present
|
||||
|
||||
conan-linux-master: &conan-linux-master
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: python
|
||||
python: "3.7"
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/install.sh; fi'
|
||||
script:
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/build.sh; fi'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
conan-osx: &conan-osx
|
||||
os: osx
|
||||
language: generic
|
||||
install:
|
||||
- ./conan/travis/install.sh
|
||||
script:
|
||||
- ./conan/travis/build.sh
|
||||
if: tag IS present
|
||||
|
||||
matrix:
|
||||
include:
|
||||
#- language: python
|
||||
# python: "2.7"
|
||||
# install:
|
||||
# - "pip install wheel twine"
|
||||
# script:
|
||||
# - "cd python/"
|
||||
# - 'VERSION="$TRAVIS_TAG" python setup.py sdist bdist_wheel'
|
||||
# - "cd ../"
|
||||
# deploy:
|
||||
# # Checkpointed release builds.
|
||||
# - provider: script
|
||||
# script: .travis/deploy-python.sh
|
||||
# skip_cleanup: true
|
||||
# on:
|
||||
# tags: true
|
||||
# # all_branches must be set with tags: true. See below post:
|
||||
# # https://stackoverflow.com/a/27775257/1076585
|
||||
# all_branches: true
|
||||
# # Produce a new build for the cutting edge when master changes.
|
||||
# - provider: script
|
||||
# script: .travis/deploy-python.sh
|
||||
# skip_cleanup: true
|
||||
# on:
|
||||
# branch: master
|
||||
- language: cpp
|
||||
os:
|
||||
- linux
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
script:
|
||||
- bash .travis/build-and-run-docker-test-containers.sh
|
||||
|
||||
- language: cpp
|
||||
os:
|
||||
- linux
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BUILD_TYPE=Debug
|
||||
- BUILD_TYPE=Release
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
|
||||
|
||||
script:
|
||||
- bash .travis/check-sources.sh
|
||||
- bash grpc/build_grpc.sh
|
||||
- cmake .
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
-DFLATBUFFERS_BUILD_GRPCTEST=ON
|
||||
-DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
|
||||
-DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
|
||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
||||
- cmake --build . -- -j${JOBS}
|
||||
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
||||
- bash .travis/check-generate-code.sh
|
||||
|
||||
- language: cpp
|
||||
os: osx
|
||||
osx_image: xcode9.3
|
||||
env:
|
||||
matrix:
|
||||
- BUILD_TYPE=Debug
|
||||
- BUILD_TYPE=Release
|
||||
|
||||
script:
|
||||
- bash grpc/build_grpc.sh
|
||||
- cmake .
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
-DFLATBUFFERS_BUILD_GRPCTEST=ON
|
||||
-DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
|
||||
-DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
|
||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
||||
- cmake --build . -- -j${JOBS}
|
||||
- DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
||||
- bash .travis/check-generate-code.sh
|
||||
|
||||
- <<: *conan-linux-master
|
||||
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||
- <<: *conan-linux
|
||||
env: CONAN_GCC_VERSIONS=9 CONAN_DOCKER_IMAGE=conanio/gcc9
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=7.0 CONAN_DOCKER_IMAGE=conanio/clang7
|
||||
- <<: *conan-linux
|
||||
env: CONAN_CLANG_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/clang8
|
||||
- <<: *conan-osx
|
||||
osx_image: xcode7.3
|
||||
env: CONAN_APPLE_CLANG_VERSIONS=7.3
|
||||
- <<: *conan-osx
|
||||
osx_image: xcode8.3
|
||||
env: CONAN_APPLE_CLANG_VERSIONS=8.1
|
||||
- <<: *conan-osx
|
||||
osx_image: xcode9
|
||||
env: CONAN_APPLE_CLANG_VERSIONS=9.0
|
||||
- <<: *conan-osx
|
||||
osx_image: xcode9.4
|
||||
env: CONAN_APPLE_CLANG_VERSIONS=9.1
|
||||
- <<: *conan-osx
|
||||
osx_image: xcode10.2
|
||||
env: CONAN_APPLE_CLANG_VERSIONS=10.0
|
||||
|
||||
- language: android
|
||||
sudo: true
|
||||
dist: trusty
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- platform-tools
|
||||
- build-tools-25.0.2
|
||||
- android-25
|
||||
- extra-android-m2repository
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
before_install:
|
||||
# Output something every 10 minutes or Travis kills the job
|
||||
- while sleep 540; do echo "=====[ $SECONDS seconds still running ]====="; done &
|
||||
# Install the r17c version of the NDK that still so that we can continue to test with gnustl
|
||||
# and stlport.
|
||||
- export ANDROID_NDK_HOME=$HOME/android-ndk
|
||||
- NDK_ZIP=$ANDROID_NDK_HOME/ndk.zip
|
||||
- mkdir -p $ANDROID_NDK_HOME
|
||||
- curl -o $NDK_ZIP https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip
|
||||
- unzip -q -d $ANDROID_NDK_HOME $NDK_ZIP
|
||||
- rm $NDK_ZIP
|
||||
- mv $ANDROID_NDK_HOME/android-ndk-*/* $ANDROID_NDK_HOME
|
||||
- rmdir $ANDROID_NDK_HOME/android-ndk-*
|
||||
- export CMAKE=$(which cmake)
|
||||
# libc required for prebuilt llvm toolchain the NDK r17c.
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq libc6; fi
|
||||
# Setup environment for Linux build which is required to build the sample.
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
|
||||
script:
|
||||
- failed=0; for build_gradle in $(git ls-files | grep build.gradle); do ( cd "$(dirname "${build_gradle}")" && ./gradlew build ) || failed=1; done; exit $((failed))
|
||||
# Kill the sleep loop
|
||||
- kill %1
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2018 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -e
|
||||
|
||||
# build flatc on debian once to speed up the test loop below
|
||||
docker build -t build_flatc_debian_stretch -f tests/docker/Dockerfile.testing.build_flatc_debian_stretch .
|
||||
BUILD_CONTAINER_ID=$(docker create --read-only build_flatc_debian_stretch)
|
||||
docker cp ${BUILD_CONTAINER_ID}:/code/flatc flatc_debian_stretch
|
||||
|
||||
for f in $(ls tests/docker/languages | sort)
|
||||
do
|
||||
# docker pull sometimes fails for unknown reasons, probably travisci-related. this retries the pull we need a few times.
|
||||
REQUIRED_BASE_IMAGE=$(cat tests/docker/languages/${f} | head -n 1 | awk ' { print $2 } ')
|
||||
|
||||
set +e
|
||||
n=0
|
||||
until [ $n -ge 5 ]
|
||||
do
|
||||
docker pull $REQUIRED_BASE_IMAGE && break
|
||||
n=$[$n+1]
|
||||
sleep 1
|
||||
done
|
||||
set -e
|
||||
|
||||
docker build -t $(echo ${f} | cut -f 3- -d .) -f tests/docker/languages/${f} .
|
||||
echo "TEST OK: ${f}"
|
||||
done
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2018 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -e
|
||||
|
||||
cd tests
|
||||
./generate_code.sh
|
||||
cd ..
|
||||
|
||||
# TODO: Linux and macos builds produce differences here for some reason.
|
||||
git checkout HEAD -- tests/monster_test.bfbs
|
||||
git checkout HEAD -- tests/arrays_test.bfbs
|
||||
|
||||
if ! git diff --quiet; then
|
||||
echo >&2
|
||||
echo "ERROR: ********************************************************" >&2
|
||||
echo "ERROR: The following differences were found after running the" >&2
|
||||
echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
|
||||
echo "ERROR: it after making changes in a generator or schema?" >&2
|
||||
echo "ERROR: ********************************************************" >&2
|
||||
echo >&2
|
||||
git diff --binary --exit-code
|
||||
fi
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2018 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -e
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
scan_dir="$1"
|
||||
else
|
||||
scan_dir="$( pwd )"
|
||||
fi
|
||||
|
||||
py_checker="$0.py"
|
||||
|
||||
echo "scan root directory = '$scan_dir'"
|
||||
python3 --version
|
||||
# Scan recursively and search all *.cpp and *.h files using regex patterns.
|
||||
# Assume that script running from a root of Flatbuffers working dir.
|
||||
python3 $py_checker "ascii" "$scan_dir/include" "\.h$"
|
||||
python3 $py_checker "ascii" "$scan_dir/src" "\.cpp$"
|
||||
python3 $py_checker "ascii" "$scan_dir/tests" "\.h$"
|
||||
python3 $py_checker "utf-8" "$scan_dir/tests" "\.cpp$"
|
||||
@@ -1,35 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
def check_encoding(encoding, scan_dir, regex_pattern):
|
||||
fname = None
|
||||
try:
|
||||
assert encoding in ['ascii', 'utf-8'], "unexpected encoding"
|
||||
cmp = re.compile(regex_pattern)
|
||||
for root, dirs, files in os.walk(scan_dir):
|
||||
fname = root
|
||||
cmp_list = [f for f in files if cmp.search(f) is not None]
|
||||
for f in cmp_list:
|
||||
fname = os.path.join(root, f)
|
||||
with open(fname, mode='rb') as test_file:
|
||||
btext = test_file.read()
|
||||
# check encoding
|
||||
btext.decode(encoding=encoding, errors="strict")
|
||||
if encoding == "utf-8" and btext.startswith(b'\xEF\xBB\xBF'):
|
||||
raise ValueError("unexpected BOM in file")
|
||||
# check LF line endings
|
||||
LF = btext.count(b'\n')
|
||||
CR = btext.count(b'\r')
|
||||
if CR!=0:
|
||||
raise ValueError("invalid line endings: LF({})/CR({})".format(LF, CR))
|
||||
except Exception as err:
|
||||
print("ERROR with [{}]: {}".format(fname, err))
|
||||
return -1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
# python check-sources.sh.py 'ascii' '.' '.*\.(cpp|h)$'
|
||||
res = check_encoding(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
sys.exit(0 if res == 0 else -1)
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROD_REPOSITORY="https://upload.pypi.org/legacy/"
|
||||
TEST_REPOSITORY="https://test.pypi.org/legacy/"
|
||||
|
||||
twine upload \
|
||||
--username "$PYPI_USERNAME" \
|
||||
--password "$PYPI_PASSWORD" \
|
||||
--repository-url "$PROD_REPOSITORY" \
|
||||
"$DIR/../python/dist/"*
|
||||
|
||||
Vendored
-225
@@ -1,225 +0,0 @@
|
||||
licenses(["notice"])
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
features = [
|
||||
"-layering_check",
|
||||
"-parse_headers",
|
||||
],
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"LICENSE",
|
||||
])
|
||||
|
||||
load(":build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
# Public flatc library to compile flatbuffer files at runtime.
|
||||
cc_library(
|
||||
name = "flatbuffers",
|
||||
srcs = [
|
||||
"src/code_generators.cpp",
|
||||
"src/idl_gen_fbs.cpp",
|
||||
"src/idl_gen_general.cpp",
|
||||
"src/idl_gen_text.cpp",
|
||||
"src/idl_parser.cpp",
|
||||
"src/reflection.cpp",
|
||||
"src/util.cpp",
|
||||
],
|
||||
hdrs = [":public_headers"],
|
||||
includes = ["include/"],
|
||||
linkstatic = 1,
|
||||
)
|
||||
|
||||
# Public C++ headers for the Flatbuffers library.
|
||||
filegroup(
|
||||
name = "public_headers",
|
||||
srcs = [
|
||||
"include/flatbuffers/base.h",
|
||||
"include/flatbuffers/code_generators.h",
|
||||
"include/flatbuffers/flatbuffers.h",
|
||||
"include/flatbuffers/flexbuffers.h",
|
||||
"include/flatbuffers/hash.h",
|
||||
"include/flatbuffers/idl.h",
|
||||
"include/flatbuffers/minireflect.h",
|
||||
"include/flatbuffers/reflection.h",
|
||||
"include/flatbuffers/reflection_generated.h",
|
||||
"include/flatbuffers/stl_emulation.h",
|
||||
"include/flatbuffers/util.h",
|
||||
],
|
||||
)
|
||||
|
||||
# Public flatc compiler library.
|
||||
cc_library(
|
||||
name = "flatc_library",
|
||||
srcs = [
|
||||
"src/code_generators.cpp",
|
||||
"src/flatc.cpp",
|
||||
"src/idl_gen_fbs.cpp",
|
||||
"src/idl_parser.cpp",
|
||||
"src/reflection.cpp",
|
||||
"src/util.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"include/flatbuffers/flatc.h",
|
||||
":public_headers",
|
||||
],
|
||||
includes = [
|
||||
"grpc/",
|
||||
"include/",
|
||||
],
|
||||
)
|
||||
|
||||
# Public flatc compiler.
|
||||
cc_binary(
|
||||
name = "flatc",
|
||||
srcs = [
|
||||
"grpc/src/compiler/config.h",
|
||||
"grpc/src/compiler/cpp_generator.cc",
|
||||
"grpc/src/compiler/cpp_generator.h",
|
||||
"grpc/src/compiler/go_generator.cc",
|
||||
"grpc/src/compiler/go_generator.h",
|
||||
"grpc/src/compiler/java_generator.cc",
|
||||
"grpc/src/compiler/java_generator.h",
|
||||
"grpc/src/compiler/schema_interface.h",
|
||||
"src/flatc_main.cpp",
|
||||
"src/idl_gen_cpp.cpp",
|
||||
"src/idl_gen_dart.cpp",
|
||||
"src/idl_gen_general.cpp",
|
||||
"src/idl_gen_kotlin.cpp",
|
||||
"src/idl_gen_go.cpp",
|
||||
"src/idl_gen_grpc.cpp",
|
||||
"src/idl_gen_js_ts.cpp",
|
||||
"src/idl_gen_json_schema.cpp",
|
||||
"src/idl_gen_lobster.cpp",
|
||||
"src/idl_gen_lua.cpp",
|
||||
"src/idl_gen_php.cpp",
|
||||
"src/idl_gen_python.cpp",
|
||||
"src/idl_gen_rust.cpp",
|
||||
"src/idl_gen_text.cpp",
|
||||
"src/util.cpp",
|
||||
],
|
||||
includes = [
|
||||
"grpc/",
|
||||
"include/",
|
||||
],
|
||||
deps = [
|
||||
":flatc_library",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "runtime_cc",
|
||||
hdrs = [
|
||||
"include/flatbuffers/base.h",
|
||||
"include/flatbuffers/flatbuffers.h",
|
||||
"include/flatbuffers/flexbuffers.h",
|
||||
"include/flatbuffers/stl_emulation.h",
|
||||
"include/flatbuffers/util.h",
|
||||
],
|
||||
includes = ["include/"],
|
||||
linkstatic = 1,
|
||||
)
|
||||
|
||||
# Test binary.
|
||||
cc_test(
|
||||
name = "flatbuffers_test",
|
||||
testonly = 1,
|
||||
srcs = [
|
||||
"include/flatbuffers/minireflect.h",
|
||||
"include/flatbuffers/registry.h",
|
||||
"src/code_generators.cpp",
|
||||
"src/idl_gen_fbs.cpp",
|
||||
"src/idl_gen_general.cpp",
|
||||
"src/idl_gen_text.cpp",
|
||||
"src/idl_parser.cpp",
|
||||
"src/reflection.cpp",
|
||||
"src/util.cpp",
|
||||
"tests/namespace_test/namespace_test1_generated.h",
|
||||
"tests/namespace_test/namespace_test2_generated.h",
|
||||
"tests/native_type_test_impl.h",
|
||||
"tests/native_type_test_impl.cpp",
|
||||
"tests/test.cpp",
|
||||
"tests/test_assert.cpp",
|
||||
"tests/test_assert.h",
|
||||
"tests/test_builder.cpp",
|
||||
"tests/test_builder.h",
|
||||
"tests/union_vector/union_vector_generated.h",
|
||||
":public_headers",
|
||||
],
|
||||
copts = [
|
||||
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
|
||||
"-DBAZEL_TEST_DATA_PATH",
|
||||
],
|
||||
data = [
|
||||
":tests/include_test/include_test1.fbs",
|
||||
":tests/include_test/sub/include_test2.fbs",
|
||||
":tests/monster_test.bfbs",
|
||||
":tests/monster_test.fbs",
|
||||
":tests/monsterdata_test.golden",
|
||||
":tests/monsterdata_test.json",
|
||||
":tests/prototest/imported.proto",
|
||||
":tests/prototest/test.golden",
|
||||
":tests/prototest/test.proto",
|
||||
":tests/prototest/test_union.golden",
|
||||
":tests/unicode_test.json",
|
||||
":tests/union_vector/union_vector.fbs",
|
||||
":tests/union_vector/union_vector.json",
|
||||
":tests/monster_extra.fbs",
|
||||
":tests/monsterdata_extra.json",
|
||||
":tests/arrays_test.bfbs",
|
||||
":tests/arrays_test.fbs",
|
||||
":tests/arrays_test.golden",
|
||||
":tests/native_type_test.fbs",
|
||||
],
|
||||
includes = [
|
||||
"include/",
|
||||
"tests/",
|
||||
],
|
||||
deps = [
|
||||
":monster_extra_cc_fbs",
|
||||
":monster_test_cc_fbs",
|
||||
":arrays_test_cc_fbs",
|
||||
":native_type_test_cc_fbs",
|
||||
],
|
||||
)
|
||||
|
||||
# Test bzl rules
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "monster_test_cc_fbs",
|
||||
srcs = ["tests/monster_test.fbs"],
|
||||
include_paths = ["tests/include_test"],
|
||||
includes = [
|
||||
"tests/include_test/include_test1.fbs",
|
||||
"tests/include_test/sub/include_test2.fbs",
|
||||
],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "monster_extra_cc_fbs",
|
||||
srcs = ["tests/monster_extra.fbs"],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "arrays_test_cc_fbs",
|
||||
srcs = ["tests/arrays_test.fbs"],
|
||||
flatc_args = [
|
||||
"--gen-object-api",
|
||||
"--gen-compare",
|
||||
"--no-includes",
|
||||
"--gen-mutable",
|
||||
"--reflect-names",
|
||||
"--cpp-ptr-type flatbuffers::unique_ptr",
|
||||
"--scoped-enums" ],
|
||||
)
|
||||
|
||||
flatbuffer_cc_library(
|
||||
name = "native_type_test_cc_fbs",
|
||||
srcs = ["tests/native_type_test.fbs"],
|
||||
flatc_args = [
|
||||
"--gen-object-api",
|
||||
"--gen-mutable",
|
||||
"--cpp-ptr-type flatbuffers::unique_ptr" ],
|
||||
)
|
||||
|
||||
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")
|
||||
load("@npm//:defs.bzl", "npm_link_all_packages")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
npm_link_all_packages(name = "node_modules")
|
||||
|
||||
npm_link_package(
|
||||
name = "node_modules/flatbuffers",
|
||||
src = "//ts:flatbuffers",
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"LICENSE",
|
||||
"tsconfig.json",
|
||||
])
|
||||
|
||||
config_setting(
|
||||
name = "platform_freebsd",
|
||||
constraint_values = [
|
||||
"@platforms//os:freebsd",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "platform_openbsd",
|
||||
constraint_values = [
|
||||
"@platforms//os:openbsd",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "distribution",
|
||||
srcs = [
|
||||
"BUILD.bazel",
|
||||
"WORKSPACE",
|
||||
"build_defs.bzl",
|
||||
"typescript.bzl",
|
||||
"//grpc/src/compiler:distribution",
|
||||
"//reflection:distribution",
|
||||
"//src:distribution",
|
||||
"//ts:distribution",
|
||||
] + glob([
|
||||
"include/flatbuffers/*.h",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Public flatc library to compile flatbuffer files at runtime.
|
||||
cc_library(
|
||||
name = "flatbuffers",
|
||||
hdrs = ["//:public_headers"],
|
||||
linkstatic = 1,
|
||||
strip_include_prefix = "/include",
|
||||
deps = ["//src:flatbuffers"],
|
||||
)
|
||||
|
||||
# Public C++ headers for the Flatbuffers library.
|
||||
filegroup(
|
||||
name = "public_headers",
|
||||
srcs = [
|
||||
"include/flatbuffers/allocator.h",
|
||||
"include/flatbuffers/array.h",
|
||||
"include/flatbuffers/base.h",
|
||||
"include/flatbuffers/buffer.h",
|
||||
"include/flatbuffers/buffer_ref.h",
|
||||
"include/flatbuffers/code_generator.h",
|
||||
"include/flatbuffers/code_generators.h",
|
||||
"include/flatbuffers/default_allocator.h",
|
||||
"include/flatbuffers/detached_buffer.h",
|
||||
"include/flatbuffers/file_manager.h",
|
||||
"include/flatbuffers/flatbuffer_builder.h",
|
||||
"include/flatbuffers/flatbuffers.h",
|
||||
"include/flatbuffers/flex_flat_util.h",
|
||||
"include/flatbuffers/flexbuffers.h",
|
||||
"include/flatbuffers/grpc.h",
|
||||
"include/flatbuffers/hash.h",
|
||||
"include/flatbuffers/idl.h",
|
||||
"include/flatbuffers/minireflect.h",
|
||||
"include/flatbuffers/reflection.h",
|
||||
"include/flatbuffers/reflection_generated.h",
|
||||
"include/flatbuffers/registry.h",
|
||||
"include/flatbuffers/stl_emulation.h",
|
||||
"include/flatbuffers/string.h",
|
||||
"include/flatbuffers/struct.h",
|
||||
"include/flatbuffers/table.h",
|
||||
"include/flatbuffers/util.h",
|
||||
"include/flatbuffers/vector.h",
|
||||
"include/flatbuffers/vector_downward.h",
|
||||
"include/flatbuffers/verifier.h",
|
||||
],
|
||||
)
|
||||
|
||||
# Public flatc compiler library.
|
||||
cc_library(
|
||||
name = "flatc_library",
|
||||
linkstatic = 1,
|
||||
deps = [
|
||||
"//src:flatc_library",
|
||||
],
|
||||
)
|
||||
|
||||
# Public flatc compiler.
|
||||
cc_binary(
|
||||
name = "flatc",
|
||||
data = ["//reflection:reflection_fbs_schema"],
|
||||
deps = [
|
||||
"//src:flatc",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "flatc_headers",
|
||||
srcs = [
|
||||
"include/flatbuffers/flatc.h",
|
||||
],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
# Library used by flatbuffer_cc_library rules.
|
||||
cc_library(
|
||||
name = "runtime_cc",
|
||||
hdrs = [
|
||||
"include/flatbuffers/base.h",
|
||||
"include/flatbuffers/flatbuffers.h",
|
||||
"include/flatbuffers/flexbuffers.h",
|
||||
"include/flatbuffers/stl_emulation.h",
|
||||
"include/flatbuffers/util.h",
|
||||
"include/flatbuffers/vector.h",
|
||||
"include/flatbuffers/verifier.h",
|
||||
],
|
||||
linkstatic = 1,
|
||||
strip_include_prefix = "/include",
|
||||
)
|
||||
Vendored
+168
@@ -0,0 +1,168 @@
|
||||
# Flatbuffers Change Log
|
||||
|
||||
All major or breaking changes will be documented in this file, as well as any
|
||||
new features that should be highlighted. Minor fixes or improvements are not
|
||||
necessarily listed.
|
||||
|
||||
## [24.3.25] (March 25 2024)(https://github.com/google/flatbuffers/releases/tag/v24.3.25)
|
||||
|
||||
* Fixed license metadata parsing (#8253)
|
||||
* [C++] Allow string_view in `LookUpByKey` in addition to null-terminated c-style strings (#8203)
|
||||
|
||||
## [24.3.7] (March 7 2024)(https://github.com/google/flatbuffers/releases/tag/v24.3.7)
|
||||
|
||||
* Just to fix some of the CI build issues from the 24.3.6 release.
|
||||
|
||||
## [24.3.6] (March 6 2024)(https://github.com/google/flatbuffers/releases/tag/v24.3.6)
|
||||
|
||||
* Fix typescript object API to allow 0 values for null-default scalars (#7864)
|
||||
|
||||
## [23.5.26 (May 26 2023)](https://github.com/google/flatbuffers/releases/tag/v23.5.26)
|
||||
|
||||
* Mostly bug fixing for 64-bit support
|
||||
* Adds support for specifying underling type of unions in C++ and TS/JS (#7954)
|
||||
|
||||
## [23.5.9 (May 9 2023)](https://github.com/google/flatbuffers/releases/tag/v23.5.9)
|
||||
|
||||
* 64-bit support for C++ (#7935)
|
||||
|
||||
## [23.5.8 (May 8 2023)](https://github.com/google/flatbuffers/releases/tag/v23.5.8)
|
||||
|
||||
* add key_field to compiled tests
|
||||
* Add golden language directory
|
||||
* Rework cmake flatc codegeneration (#7938)
|
||||
* remove defining generated files in test srcs
|
||||
* Add binary schema reflection (#7932)
|
||||
* Migrate from rules_nodejs to rules_js/rules_ts (take 2) (#7928)
|
||||
* `flat_buffers.dart`: mark const variable finals for internal Dart linters
|
||||
* fixed some windows warnings (#7929)
|
||||
* inject no long for FBS generation to remove logs in flattests (#7926)
|
||||
* Revert "Migrate from rules_nodejs to rules_js/rules_ts (#7923)" (#7927)
|
||||
* Migrate from rules_nodejs to rules_js/rules_ts (#7923)
|
||||
* Only generate @kotlin.ExperimentalUnsigned annotation on create*Vector methods having an unsigned array type parameter. (#7881)
|
||||
* additional check for absl::string_view availability (#7897)
|
||||
* Optionally generate Python type annotations (#7858)
|
||||
* Replace deprecated command with environment file (#7921)
|
||||
* drop glibc from runtime dependencies (#7906)
|
||||
* Make JSON supporting advanced union features (#7869)
|
||||
* Allow to use functions from `BuildFlatBuffers.cmake` from a flatbuffers installation installed with CMake. (#7912)
|
||||
* TS/JS: Use TypeError instead of Error when appropriate (#7910)
|
||||
* Go: make generated code more compliant to "go fmt" (#7907)
|
||||
* Support file_identifier in Go (#7904)
|
||||
* Optionally generate type prefixes and suffixes for python code (#7857)
|
||||
* Go: add test for FinishWithFileIdentifier (#7905)
|
||||
* Fix go_sample.sh (#7903)
|
||||
* [TS/JS] Upgrade dependencies (#7889)
|
||||
* Add a FileWriter interface (#7821)
|
||||
* TS/JS: Use minvalue from enum if not found (#7888)
|
||||
* [CS] Verifier (#7850)
|
||||
* README.md: PyPI case typo (#7880)
|
||||
* Update go documentation link to point to root module (#7879)
|
||||
* use Bool for flatbuffers bool instead of Byte (#7876)
|
||||
* fix using null string in vector (#7872)
|
||||
* Add `flatbuffers-64` branch to CI for pushes
|
||||
* made changes to the rust docs so they would compile. new_with_capacity is deprecated should use with_capacity, get_root_as_monster should be root_as_monster (#7871)
|
||||
* Adding comment for code clarification (#7856)
|
||||
* ToCamelCase() when kLowerCamel now converts first char to lower. (#7838)
|
||||
* Fix help output for --java-checkerframework (#7854)
|
||||
* Update filename to README.md and improve formatting (#7855)
|
||||
* Update stale.yml
|
||||
* Updated remaining usages of LICENSE.txt
|
||||
|
||||
## [23.3.3 (Mar 3 2023)](https://github.com/google/flatbuffers/releases/tag/v23.3.3)
|
||||
|
||||
* Refactoring of `flatc` generators to use an interface (#7797).
|
||||
|
||||
* Removed legacy cmake support and set min to 3.8 (#7801).
|
||||
|
||||
## [23.1.21 (Jan 21 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.20)
|
||||
|
||||
* Reworked entry points for Typescript/Javascript and compatibility for single
|
||||
file build (#7510)
|
||||
|
||||
## [23.1.20 (Jan 20 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.20)
|
||||
|
||||
* Removed go.mod files after some versioning issues were being report (#7780).
|
||||
|
||||
## [23.1.4 (Jan 4 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.4)
|
||||
|
||||
* Major release! Just kidding, we are continuing the
|
||||
[versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning) of
|
||||
using a date to signify releases. This results in the first release of the new
|
||||
year to bump the tradition major version field.
|
||||
|
||||
* Go minimum version is now 1.19 (#7720) with the addition of Go modules.
|
||||
|
||||
* Added CI support for Big Endian regression testing (#7707).
|
||||
|
||||
* Fixed `getFullyQualifiedName` in typescript to return name delimited by '.'
|
||||
instead of '_' (#7730).
|
||||
|
||||
* Fixed the versioning scheme to not include leading zeros which are not
|
||||
consistently handled by every package manager. Only the last release
|
||||
(12.12.06) should have suffered from this.
|
||||
|
||||
## [22.12.06 (Dec 06 2022)](https://github.com/google/flatbuffers/releases/tag/v22.12.06)
|
||||
|
||||
* Bug fixing release, no major changes.
|
||||
|
||||
## [22.10.25 (Oct 25 2022)](https://github.com/google/flatbuffers/releases/tag/v22.10.25)
|
||||
|
||||
* Added Nim language support with generator and runtime libraries (#7534).
|
||||
|
||||
## [22.9.29 (Sept 29 2022)](https://github.com/google/flatbuffers/releases/tag/v22.9.29)
|
||||
|
||||
* Rust soundness fixes to avoid the crate from bing labelled unsafe (#7518).
|
||||
|
||||
## [22.9.24 (Sept 24 2022)](https://github.com/google/flatbuffers/releases/tag/v22.9.24)
|
||||
|
||||
* 20 Major releases in a row? Nope, we switched to a new
|
||||
[versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning)
|
||||
that is based on date.
|
||||
|
||||
* Python supports fixed size arrays now (#7529).
|
||||
|
||||
* Behavior change in how C++ object API uses `UnPackTo`. The original intent of
|
||||
this was to reduce allocations by reusing an existing object to pack data
|
||||
into. At some point, this logic started to merge the states of the two objects
|
||||
instead of clearing the state of the packee. This change goes back to the
|
||||
original intention, the packed object is cleared when getting data packed into
|
||||
it (#7527).
|
||||
|
||||
* Fixed a bug in C++ alignment that was using `sizeof()` instead of the intended
|
||||
`AlignOf()` for structs (#7520).
|
||||
|
||||
* C# has an
|
||||
[official Nuget package](https://www.nuget.org/packages/Google.FlatBuffers)
|
||||
now (#7496).
|
||||
|
||||
## 2.0.8 (Aug 29 2022)
|
||||
|
||||
* Fix for `--keep-prefix` the was generating the wrong include statements for
|
||||
C++ (#7469). The bug was introduced in 2.0.7.
|
||||
|
||||
* Added the `Verifier::Options` option struct to allow specifying runtime
|
||||
configuration settings for the verifier (#7489). This allows to skip verifying
|
||||
nested flatbuffers, a on-by-default change that was introduced in 2.0.7. This
|
||||
deprecates the existing `Verifier` constructor, which may be removed in a
|
||||
future version.
|
||||
|
||||
* Refactor of `tests/test.cpp` that lead to ~10% speedup in compilation of the
|
||||
entire project (#7487).
|
||||
|
||||
## 2.0.7 (Aug 22 2022)
|
||||
|
||||
* This is the first version with an explicit change log, so all the previous
|
||||
features will not be listed.
|
||||
|
||||
* Verifier now checks that buffers are at least the minimum size required to be
|
||||
a flatbuffers (12 bytes). This includes nested flatbuffers, which previously
|
||||
could be declared valid at size 0.
|
||||
|
||||
* Annotated binaries. Given a flatbuffer binary and a schema (or binary schema)
|
||||
one can generate an annotated flatbuffer (.afb) to describe each byte in the
|
||||
binary with schema metadata and value.
|
||||
|
||||
* First binary schema generator (Lua) to generate Lua code via a .bfbs file.
|
||||
This is mostly an implementation detail of flatc internals, but will be slowly
|
||||
applied to the other language generators.
|
||||
@@ -59,6 +59,9 @@ function(build_flatbuffers flatbuffers_schemas
|
||||
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
||||
set(FLATC_TARGET "")
|
||||
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
||||
elseif(TARGET flatbuffers::flatc)
|
||||
set(FLATC_TARGET flatbuffers::flatc)
|
||||
set(FLATC flatbuffers::flatc)
|
||||
else()
|
||||
set(FLATC_TARGET flatc)
|
||||
set(FLATC flatc)
|
||||
@@ -150,3 +153,297 @@ function(build_flatbuffers flatbuffers_schemas
|
||||
${copy_text_schemas_dir})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Creates a target that can be linked against that generates flatbuffer headers.
|
||||
#
|
||||
# This function takes a target name and a list of schemas. You can also specify
|
||||
# other flagc flags using the FLAGS option to change the behavior of the flatc
|
||||
# tool.
|
||||
#
|
||||
# When the target_link_libraries is done within a different directory than
|
||||
# flatbuffers_generate_headers is called, then the target should also be dependent
|
||||
# the custom generation target called GENERATE_<TARGET>.
|
||||
#
|
||||
# Arguments:
|
||||
# TARGET: The name of the target to generate.
|
||||
# SCHEMAS: The list of schema files to generate code for.
|
||||
# BINARY_SCHEMAS_DIR: Optional. The directory in which to generate binary
|
||||
# schemas. Binary schemas will only be generated if a path is provided.
|
||||
# INCLUDE: Optional. Search for includes in the specified paths. (Use this
|
||||
# instead of "-I <path>" and the FLAGS option so that CMake is aware of
|
||||
# the directories that need to be searched).
|
||||
# INCLUDE_PREFIX: Optional. The directory in which to place the generated
|
||||
# files. Use this instead of the --include-prefix option.
|
||||
# FLAGS: Optional. A list of any additional flags that you would like to pass
|
||||
# to flatc.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# flatbuffers_generate_headers(
|
||||
# TARGET my_generated_headers_target
|
||||
# INCLUDE_PREFIX ${MY_INCLUDE_PREFIX}"
|
||||
# SCHEMAS ${MY_SCHEMA_FILES}
|
||||
# BINARY_SCHEMAS_DIR "${MY_BINARY_SCHEMA_DIRECTORY}"
|
||||
# FLAGS --gen-object-api)
|
||||
#
|
||||
# target_link_libraries(MyExecutableTarget
|
||||
# PRIVATE my_generated_headers_target
|
||||
# )
|
||||
#
|
||||
# Optional (only needed within different directory):
|
||||
# add_dependencies(app GENERATE_my_generated_headers_target)
|
||||
function(flatbuffers_generate_headers)
|
||||
# Parse function arguments.
|
||||
set(options)
|
||||
set(one_value_args
|
||||
"TARGET"
|
||||
"INCLUDE_PREFIX"
|
||||
"BINARY_SCHEMAS_DIR")
|
||||
set(multi_value_args
|
||||
"SCHEMAS"
|
||||
"INCLUDE"
|
||||
"FLAGS")
|
||||
cmake_parse_arguments(
|
||||
PARSE_ARGV 0
|
||||
FLATBUFFERS_GENERATE_HEADERS
|
||||
"${options}"
|
||||
"${one_value_args}"
|
||||
"${multi_value_args}")
|
||||
|
||||
# Test if including from FindFlatBuffers
|
||||
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
||||
set(FLATC_TARGET "")
|
||||
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
||||
elseif(TARGET flatbuffers::flatc)
|
||||
set(FLATC_TARGET flatbuffers::flatc)
|
||||
set(FLATC flatbuffers::flatc)
|
||||
else()
|
||||
set(FLATC_TARGET flatc)
|
||||
set(FLATC flatc)
|
||||
endif()
|
||||
|
||||
set(working_dir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
# Generate the include files parameters.
|
||||
set(include_params "")
|
||||
foreach (include_dir ${FLATBUFFERS_GENERATE_HEADERS_INCLUDE})
|
||||
set(include_params -I ${include_dir} ${include_params})
|
||||
endforeach()
|
||||
|
||||
# Create a directory to place the generated code.
|
||||
set(generated_target_dir "${CMAKE_CURRENT_BINARY_DIR}/${FLATBUFFERS_GENERATE_HEADERS_TARGET}")
|
||||
set(generated_include_dir "${generated_target_dir}")
|
||||
if (NOT ${FLATBUFFERS_GENERATE_HEADERS_INCLUDE_PREFIX} STREQUAL "")
|
||||
set(generated_include_dir "${generated_include_dir}/${FLATBUFFERS_GENERATE_HEADERS_INCLUDE_PREFIX}")
|
||||
list(APPEND FLATBUFFERS_GENERATE_HEADERS_FLAGS
|
||||
"--include-prefix" ${FLATBUFFERS_GENERATE_HEADERS_INCLUDE_PREFIX})
|
||||
endif()
|
||||
|
||||
set(generated_custom_commands)
|
||||
|
||||
# Create rules to generate the code for each schema.
|
||||
foreach(schema ${FLATBUFFERS_GENERATE_HEADERS_SCHEMAS})
|
||||
get_filename_component(filename ${schema} NAME_WE)
|
||||
set(generated_include "${generated_include_dir}/${filename}_generated.h")
|
||||
|
||||
# Generate files for grpc if needed
|
||||
set(generated_source_file)
|
||||
if("${FLATBUFFERS_GENERATE_HEADERS_FLAGS}" MATCHES "--grpc")
|
||||
# Check if schema file contain a rpc_service definition
|
||||
file(STRINGS ${schema} has_grpc REGEX "rpc_service")
|
||||
if(has_grpc)
|
||||
list(APPEND generated_include "${generated_include_dir}/${filename}.grpc.fb.h")
|
||||
set(generated_source_file "${generated_include_dir}/${filename}.grpc.fb.cc")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_include} ${generated_source_file}
|
||||
COMMAND ${FLATC} ${FLATC_ARGS}
|
||||
-o ${generated_include_dir}
|
||||
${include_params}
|
||||
-c ${schema}
|
||||
${FLATBUFFERS_GENERATE_HEADERS_FLAGS}
|
||||
DEPENDS ${FLATC_TARGET} ${schema}
|
||||
WORKING_DIRECTORY "${working_dir}"
|
||||
COMMENT "Building ${schema} flatbuffers...")
|
||||
list(APPEND all_generated_header_files ${generated_include})
|
||||
list(APPEND all_generated_source_files ${generated_source_file})
|
||||
list(APPEND generated_custom_commands "${generated_include}" "${generated_source_file}")
|
||||
|
||||
# Geneate the binary flatbuffers schemas if instructed to.
|
||||
if (NOT ${FLATBUFFERS_GENERATE_HEADERS_BINARY_SCHEMAS_DIR} STREQUAL "")
|
||||
set(binary_schema
|
||||
"${FLATBUFFERS_GENERATE_HEADERS_BINARY_SCHEMAS_DIR}/${filename}.bfbs")
|
||||
add_custom_command(
|
||||
OUTPUT ${binary_schema}
|
||||
COMMAND ${FLATC} -b --schema
|
||||
-o ${FLATBUFFERS_GENERATE_HEADERS_BINARY_SCHEMAS_DIR}
|
||||
${include_params}
|
||||
${schema}
|
||||
DEPENDS ${FLATC_TARGET} ${schema}
|
||||
WORKING_DIRECTORY "${working_dir}")
|
||||
list(APPEND generated_custom_commands "${binary_schema}")
|
||||
list(APPEND all_generated_binary_files ${binary_schema})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Create an additional target as add_custom_command scope is only within same directory (CMakeFile.txt)
|
||||
set(generate_target GENERATE_${FLATBUFFERS_GENERATE_HEADERS_TARGET})
|
||||
add_custom_target(${generate_target} ALL
|
||||
DEPENDS ${generated_custom_commands}
|
||||
COMMENT "Generating flatbuffer target ${FLATBUFFERS_GENERATE_HEADERS_TARGET}")
|
||||
|
||||
# Set up interface library
|
||||
add_library(${FLATBUFFERS_GENERATE_HEADERS_TARGET} INTERFACE)
|
||||
target_sources(
|
||||
${FLATBUFFERS_GENERATE_HEADERS_TARGET}
|
||||
INTERFACE
|
||||
${all_generated_header_files}
|
||||
${all_generated_binary_files}
|
||||
${all_generated_source_files}
|
||||
${FLATBUFFERS_GENERATE_HEADERS_SCHEMAS})
|
||||
add_dependencies(
|
||||
${FLATBUFFERS_GENERATE_HEADERS_TARGET}
|
||||
${FLATC}
|
||||
${FLATBUFFERS_GENERATE_HEADERS_SCHEMAS})
|
||||
target_include_directories(
|
||||
${FLATBUFFERS_GENERATE_HEADERS_TARGET}
|
||||
INTERFACE ${generated_target_dir})
|
||||
|
||||
# Organize file layout for IDEs.
|
||||
source_group(
|
||||
TREE "${generated_target_dir}"
|
||||
PREFIX "Flatbuffers/Generated/Headers Files"
|
||||
FILES ${all_generated_header_files})
|
||||
source_group(
|
||||
TREE "${generated_target_dir}"
|
||||
PREFIX "Flatbuffers/Generated/Source Files"
|
||||
FILES ${all_generated_source_files})
|
||||
source_group(
|
||||
TREE ${working_dir}
|
||||
PREFIX "Flatbuffers/Schemas"
|
||||
FILES ${FLATBUFFERS_GENERATE_HEADERS_SCHEMAS})
|
||||
if (NOT ${FLATBUFFERS_GENERATE_HEADERS_BINARY_SCHEMAS_DIR} STREQUAL "")
|
||||
source_group(
|
||||
TREE "${FLATBUFFERS_GENERATE_HEADERS_BINARY_SCHEMAS_DIR}"
|
||||
PREFIX "Flatbuffers/Generated/Binary Schemas"
|
||||
FILES ${all_generated_binary_files})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Creates a target that can be linked against that generates flatbuffer binaries
|
||||
# from json files.
|
||||
#
|
||||
# This function takes a target name and a list of schemas and Json files. You
|
||||
# can also specify other flagc flags and options to change the behavior of the
|
||||
# flatc compiler.
|
||||
#
|
||||
# Adding this target to your executable ensurses that the flatbuffer binaries
|
||||
# are compiled before your executable is run.
|
||||
#
|
||||
# Arguments:
|
||||
# TARGET: The name of the target to generate.
|
||||
# JSON_FILES: The list of json files to compile to flatbuffers binaries.
|
||||
# SCHEMA: The flatbuffers schema of the Json files to be compiled.
|
||||
# INCLUDE: Optional. Search for includes in the specified paths. (Use this
|
||||
# instead of "-I <path>" and the FLAGS option so that CMake is aware of
|
||||
# the directories that need to be searched).
|
||||
# OUTPUT_DIR: The directly where the generated flatbuffers binaries should be
|
||||
# placed.
|
||||
# FLAGS: Optional. A list of any additional flags that you would like to pass
|
||||
# to flatc.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# flatbuffers_generate_binary_files(
|
||||
# TARGET my_binary_data
|
||||
# SCHEMA "${MY_SCHEMA_DIR}/my_example_schema.fbs"
|
||||
# JSON_FILES ${MY_JSON_FILES}
|
||||
# OUTPUT_DIR "${MY_BINARY_DATA_DIRECTORY}"
|
||||
# FLAGS --strict-json)
|
||||
#
|
||||
# target_link_libraries(MyExecutableTarget
|
||||
# PRIVATE my_binary_data
|
||||
# )
|
||||
function(flatbuffers_generate_binary_files)
|
||||
# Parse function arguments.
|
||||
set(options)
|
||||
set(one_value_args
|
||||
"TARGET"
|
||||
"SCHEMA"
|
||||
"OUTPUT_DIR")
|
||||
set(multi_value_args
|
||||
"JSON_FILES"
|
||||
"INCLUDE"
|
||||
"FLAGS")
|
||||
cmake_parse_arguments(
|
||||
PARSE_ARGV 0
|
||||
FLATBUFFERS_GENERATE_BINARY_FILES
|
||||
"${options}"
|
||||
"${one_value_args}"
|
||||
"${multi_value_args}")
|
||||
|
||||
# Test if including from FindFlatBuffers
|
||||
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
||||
set(FLATC_TARGET "")
|
||||
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
||||
elseif(TARGET flatbuffers::flatc)
|
||||
set(FLATC_TARGET flatbuffers::flatc)
|
||||
set(FLATC flatbuffers::flatc)
|
||||
else()
|
||||
set(FLATC_TARGET flatc)
|
||||
set(FLATC flatc)
|
||||
endif()
|
||||
|
||||
set(working_dir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
# Generate the include files parameters.
|
||||
set(include_params "")
|
||||
foreach (include_dir ${FLATBUFFERS_GENERATE_BINARY_FILES_INCLUDE})
|
||||
set(include_params -I ${include_dir} ${include_params})
|
||||
endforeach()
|
||||
|
||||
# Create rules to generate the flatbuffers binary for each json file.
|
||||
foreach(json_file ${FLATBUFFERS_GENERATE_BINARY_FILES_JSON_FILES})
|
||||
get_filename_component(filename ${json_file} NAME_WE)
|
||||
set(generated_binary_file "${FLATBUFFERS_GENERATE_BINARY_FILES_OUTPUT_DIR}/${filename}.bin")
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_binary_file}
|
||||
COMMAND ${FLATC} ${FLATC_ARGS}
|
||||
-o ${FLATBUFFERS_GENERATE_BINARY_FILES_OUTPUT_DIR}
|
||||
${include_params}
|
||||
-b ${FLATBUFFERS_GENERATE_BINARY_FILES_SCHEMA} ${json_file}
|
||||
${FLATBUFFERS_GENERATE_BINARY_FILES_FLAGS}
|
||||
DEPENDS ${FLATC_TARGET} ${json_file}
|
||||
WORKING_DIRECTORY "${working_dir}"
|
||||
COMMENT "Building ${json_file} binary flatbuffers...")
|
||||
list(APPEND all_generated_binary_files ${generated_binary_file})
|
||||
endforeach()
|
||||
|
||||
# Set up interface library
|
||||
add_library(${FLATBUFFERS_GENERATE_BINARY_FILES_TARGET} INTERFACE)
|
||||
target_sources(
|
||||
${FLATBUFFERS_GENERATE_BINARY_FILES_TARGET}
|
||||
INTERFACE
|
||||
${all_generated_binary_files}
|
||||
${FLATBUFFERS_GENERATE_BINARY_FILES_JSON_FILES}
|
||||
${FLATBUFFERS_GENERATE_BINARY_FILES_SCHEMA})
|
||||
add_dependencies(
|
||||
${FLATBUFFERS_GENERATE_BINARY_FILES_TARGET}
|
||||
${FLATC})
|
||||
|
||||
# Organize file layout for IDEs.
|
||||
source_group(
|
||||
TREE ${working_dir}
|
||||
PREFIX "Flatbuffers/JSON Files"
|
||||
FILES ${FLATBUFFERS_GENERATE_BINARY_FILES_JSON_FILES})
|
||||
source_group(
|
||||
TREE ${working_dir}
|
||||
PREFIX "Flatbuffers/Schemas"
|
||||
FILES ${FLATBUFFERS_GENERATE_BINARY_FILES_SCHEMA})
|
||||
source_group(
|
||||
TREE ${FLATBUFFERS_GENERATE_BINARY_FILES_OUTPUT_DIR}
|
||||
PREFIX "Flatbuffers/Generated/Binary Files"
|
||||
FILES ${all_generated_binary_files})
|
||||
endfunction()
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
|
||||
find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(flatbuffers
|
||||
find_package_handle_standard_args(FlatBuffers
|
||||
DEFAULT_MSG FLATBUFFERS_FLATC_EXECUTABLE FLATBUFFERS_INCLUDE_DIR)
|
||||
|
||||
if(FLATBUFFERS_FOUND)
|
||||
@@ -58,4 +58,4 @@ else()
|
||||
set(FLATBUFFERS_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
include("${FLATBUFFERS_CMAKE_DIR}/BuildFlatBuffers.cmake")
|
||||
include("${FLATBUFFERS_CMAKE_DIR}/BuildFlatBuffers.cmake")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user