Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ec1652781 | |||
| 3cdcba165b |
@@ -170,7 +170,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 20
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: gcc-13
|
CCOMPILER: gcc-13
|
||||||
CUCUMBER_TIMEOUT: 20000
|
CUCUMBER_TIMEOUT: 20000
|
||||||
@@ -181,7 +180,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 20
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CUCUMBER_TIMEOUT: 20000
|
CUCUMBER_TIMEOUT: 20000
|
||||||
@@ -195,7 +193,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CXXCOMPILER: clang++-18
|
CXXCOMPILER: clang++-18
|
||||||
@@ -206,7 +203,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CXXCOMPILER: clang++-18
|
CXXCOMPILER: clang++-18
|
||||||
@@ -217,7 +213,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: Debug
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CXXCOMPILER: clang++-18
|
CXXCOMPILER: clang++-18
|
||||||
@@ -229,7 +224,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-17
|
CCOMPILER: clang-17
|
||||||
CXXCOMPILER: clang++-17
|
CXXCOMPILER: clang++-17
|
||||||
@@ -240,7 +234,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-16
|
CCOMPILER: clang-16
|
||||||
CXXCOMPILER: clang++-16
|
CXXCOMPILER: clang++-16
|
||||||
@@ -251,7 +244,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CXXCOMPILER: clang++-18
|
CXXCOMPILER: clang++-18
|
||||||
@@ -263,7 +255,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 18
|
node: 18
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: clang-18
|
CCOMPILER: clang-18
|
||||||
CXXCOMPILER: clang++-18
|
CXXCOMPILER: clang++-18
|
||||||
@@ -274,7 +265,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 20
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: gcc-14
|
CCOMPILER: gcc-14
|
||||||
CXXCOMPILER: g++-14
|
CXXCOMPILER: g++-14
|
||||||
@@ -284,7 +274,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 20
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: gcc-13
|
CCOMPILER: gcc-13
|
||||||
CXXCOMPILER: g++-13
|
CXXCOMPILER: g++-13
|
||||||
@@ -294,7 +283,6 @@ jobs:
|
|||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
node: 20
|
node: 20
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
BUILD_TOOLS: ON
|
|
||||||
BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
CCOMPILER: gcc-12
|
CCOMPILER: gcc-12
|
||||||
CXXCOMPILER: g++-12
|
CXXCOMPILER: g++-12
|
||||||
@@ -350,7 +338,6 @@ jobs:
|
|||||||
continue-on-error: ${{ matrix.continue-on-error }}
|
continue-on-error: ${{ matrix.continue-on-error }}
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
env:
|
env:
|
||||||
BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }}
|
|
||||||
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
|
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
|
||||||
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
|
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
|
||||||
CCOMPILER: ${{ matrix.CCOMPILER }}
|
CCOMPILER: ${{ matrix.CCOMPILER }}
|
||||||
@@ -533,7 +520,6 @@ jobs:
|
|||||||
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
||||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||||
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
-DENABLE_LTO=${ENABLE_LTO:-ON} \
|
-DENABLE_LTO=${ENABLE_LTO:-ON} \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
||||||
@@ -550,13 +536,6 @@ jobs:
|
|||||||
echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV
|
echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
- name: Build example
|
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
|
||||||
run: |
|
|
||||||
mkdir example/build && pushd example/build
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
|
||||||
make --jobs=${JOBS}
|
|
||||||
popd
|
|
||||||
- name: Run all tests
|
- name: Run all tests
|
||||||
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
|
||||||
run: |
|
run: |
|
||||||
@@ -564,7 +543,6 @@ jobs:
|
|||||||
|
|
||||||
# macOS SIP strips the linker path. Reset this inside the running shell
|
# macOS SIP strips the linker path. Reset this inside the running shell
|
||||||
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
|
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
|
||||||
./example/build/osrm-example test/data/mld/monaco.osrm
|
|
||||||
|
|
||||||
# All tests assume to be run from the build directory
|
# All tests assume to be run from the build directory
|
||||||
pushd ${OSRM_BUILD_DIR}
|
pushd ${OSRM_BUILD_DIR}
|
||||||
|
|||||||
+1
-2
@@ -43,12 +43,11 @@ Thumbs.db
|
|||||||
#######################
|
#######################
|
||||||
/_build*
|
/_build*
|
||||||
/build/
|
/build/
|
||||||
/example/build/
|
|
||||||
/test/data/monaco.osrm*
|
/test/data/monaco.osrm*
|
||||||
/test/data/ch
|
/test/data/ch
|
||||||
|
/test/data/corech
|
||||||
/test/data/mld
|
/test/data/mld
|
||||||
/cmake/postinst
|
/cmake/postinst
|
||||||
/target
|
|
||||||
|
|
||||||
# Eclipse related files #
|
# Eclipse related files #
|
||||||
#########################
|
#########################
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
- NodeJS:
|
- NodeJS:
|
||||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||||
- Misc:
|
- Misc:
|
||||||
- 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: 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: 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)
|
- CHANGED: Use Link Time Optimisation whenever possible. [#6967](https://github.com/Project-OSRM/osrm-backend/pull/6967)
|
||||||
|
|||||||
+21
-87
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
|
project(OSRM C CXX)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
@@ -10,6 +10,12 @@ Please create a directory and run cmake from there, passing the path to this sou
|
|||||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
message(STATUS "Building on a 64 bit system")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Building on a 32 bit system is not supported")
|
||||||
|
endif()
|
||||||
|
|
||||||
# detect if this is included as subproject and if so expose
|
# detect if this is included as subproject and if so expose
|
||||||
# some variables to its parent scope
|
# some variables to its parent scope
|
||||||
get_directory_property(BUILD_AS_SUBPROJECT PARENT_DIRECTORY)
|
get_directory_property(BUILD_AS_SUBPROJECT PARENT_DIRECTORY)
|
||||||
@@ -22,42 +28,25 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
|
|||||||
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_CONAN "Use conan for dependencies" OFF)
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
|
||||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
|
||||||
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
|
||||||
option(BUILD_ROUTED "Build osrm-routed HTTP server" ON)
|
|
||||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
|
||||||
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
|
||||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
|
||||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
|
||||||
option(ENABLE_LTO "Use Link Time Optimisation" ON)
|
|
||||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
|
||||||
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
|
||||||
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
|
||||||
|
|
||||||
|
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||||
|
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||||
|
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||||
|
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
||||||
|
option(ENABLE_CONAN "Use conan for dependencies" OFF)
|
||||||
|
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||||
|
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
||||||
|
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||||
|
option(ENABLE_LTO "Use Link Time Optimisation" ON)
|
||||||
|
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||||
|
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||||
|
|
||||||
if (ENABLE_CLANG_TIDY)
|
if (ENABLE_CLANG_TIDY)
|
||||||
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy REQUIRED)
|
||||||
if(NOT CLANG_TIDY_COMMAND)
|
|
||||||
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
|
|
||||||
else()
|
|
||||||
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
|
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
|
||||||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*;--header-filter=.*")
|
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*;--header-filter=.*")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
||||||
|
|
||||||
# be compatible with version handling before cmake 3.x
|
|
||||||
if (POLICY CMP0057)
|
|
||||||
cmake_policy(SET CMP0057 NEW)
|
|
||||||
endif()
|
|
||||||
if (POLICY CMP0074)
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
|
||||||
endif()
|
|
||||||
project(OSRM C CXX)
|
|
||||||
|
|
||||||
|
|
||||||
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
|
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
@@ -125,15 +114,8 @@ include(CheckCXXCompilerFlag)
|
|||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
message(STATUS "Building on a 64 bit system")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Building on a 32 bit system is not supported")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_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)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/include)
|
||||||
|
|
||||||
set(BOOST_COMPONENTS date_time iostreams program_options thread unit_test_framework)
|
set(BOOST_COMPONENTS date_time iostreams program_options thread unit_test_framework)
|
||||||
@@ -152,7 +134,6 @@ file(GLOB UpdaterGlob src/updater/*.cpp)
|
|||||||
file(GLOB StorageGlob src/storage/*.cpp)
|
file(GLOB StorageGlob src/storage/*.cpp)
|
||||||
file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp)
|
file(GLOB ServerGlob src/server/*.cpp src/server/**/*.cpp)
|
||||||
file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp)
|
file(GLOB EngineGlob src/engine/*.cpp src/engine/**/*.cpp)
|
||||||
file(GLOB ErrorcodesGlob src/osrm/errorcodes.cpp)
|
|
||||||
|
|
||||||
add_library(UTIL OBJECT ${UtilGlob})
|
add_library(UTIL OBJECT ${UtilGlob})
|
||||||
add_library(EXTRACTOR OBJECT ${ExtractorGlob})
|
add_library(EXTRACTOR OBJECT ${ExtractorGlob})
|
||||||
@@ -163,14 +144,11 @@ add_library(CONTRACTOR OBJECT ${ContractorGlob})
|
|||||||
add_library(UPDATER OBJECT ${UpdaterGlob})
|
add_library(UPDATER OBJECT ${UpdaterGlob})
|
||||||
add_library(STORAGE OBJECT ${StorageGlob})
|
add_library(STORAGE OBJECT ${StorageGlob})
|
||||||
add_library(ENGINE OBJECT ${EngineGlob})
|
add_library(ENGINE OBJECT ${EngineGlob})
|
||||||
|
|
||||||
if (BUILD_ROUTED)
|
|
||||||
add_library(SERVER OBJECT ${ServerGlob})
|
add_library(SERVER OBJECT ${ServerGlob})
|
||||||
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
|
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
|
||||||
add_executable(osrm-extract src/tools/extract.cpp)
|
add_executable(osrm-extract src/tools/extract.cpp)
|
||||||
add_executable(osrm-partition src/tools/partition.cpp)
|
add_executable(osrm-partition src/tools/partition.cpp)
|
||||||
add_executable(osrm-customize src/tools/customize.cpp)
|
add_executable(osrm-customize src/tools/customize.cpp)
|
||||||
@@ -480,9 +458,7 @@ target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|||||||
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
if (BUILD_ROUTED)
|
|
||||||
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
||||||
endif()
|
|
||||||
|
|
||||||
set(EXTRACTOR_LIBRARIES
|
set(EXTRACTOR_LIBRARIES
|
||||||
${BZIP2_LIBRARIES}
|
${BZIP2_LIBRARIES}
|
||||||
@@ -556,18 +532,13 @@ target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES})
|
|||||||
target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store)
|
target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update osrm_store)
|
||||||
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
|
target_link_libraries(osrm_store ${STORAGE_LIBRARIES})
|
||||||
|
|
||||||
# BUILD_COMPONENTS
|
|
||||||
add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-components src/tools/components.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
|
||||||
target_link_libraries(osrm-components ${TBB_LIBRARIES} ${BOOST_BASE_LIBRARIES} ${UTIL_LIBRARIES})
|
target_link_libraries(osrm-components ${TBB_LIBRARIES} ${BOOST_BASE_LIBRARIES} ${UTIL_LIBRARIES})
|
||||||
install(TARGETS osrm-components DESTINATION bin)
|
install(TARGETS osrm-components DESTINATION bin)
|
||||||
|
|
||||||
if(BUILD_TOOLS)
|
|
||||||
message(STATUS "Activating OSRM internal tools")
|
|
||||||
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
||||||
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES})
|
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ENABLE_ASSERTIONS)
|
if (ENABLE_ASSERTIONS)
|
||||||
message(STATUS "Enabling assertions")
|
message(STATUS "Enabling assertions")
|
||||||
@@ -586,47 +557,14 @@ set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|||||||
set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
if (BUILD_ROUTED)
|
|
||||||
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
endif()
|
|
||||||
|
|
||||||
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
|
|
||||||
file(GLOB LibraryGlob include/osrm/*.hpp)
|
|
||||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
|
||||||
set(ApiHeader include/engine/api/base_result.hpp)
|
|
||||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
|
|
||||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/bearing.hpp)
|
|
||||||
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
|
||||||
set(PartitionerHeader include/partitioner/partitioner.hpp include/partitioner/partitioner_config.hpp)
|
|
||||||
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
|
|
||||||
set(StorageHeader include/storage/storage.hpp include/storage/io_config.hpp include/storage/storage_config.hpp)
|
|
||||||
install(FILES ${EngineHeader} DESTINATION include/osrm/engine)
|
|
||||||
install(FILES ${UtilHeader} DESTINATION include/osrm/util)
|
|
||||||
install(FILES ${StorageHeader} DESTINATION include/osrm/storage)
|
|
||||||
install(FILES ${ExtractorHeader} DESTINATION include/osrm/extractor)
|
|
||||||
install(FILES ${PartitionerHeader} DESTINATION include/osrm/partitioner)
|
|
||||||
install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
|
|
||||||
install(FILES ${LibraryGlob} DESTINATION include/osrm)
|
|
||||||
install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
|
|
||||||
install(FILES ${ApiHeader} DESTINATION include/osrm/engine/api)
|
|
||||||
install(FILES ${FlatbuffersGlob} DESTINATION include/flatbuffers)
|
|
||||||
install(TARGETS osrm-extract DESTINATION bin)
|
install(TARGETS osrm-extract DESTINATION bin)
|
||||||
install(TARGETS osrm-partition DESTINATION bin)
|
install(TARGETS osrm-partition DESTINATION bin)
|
||||||
install(TARGETS osrm-customize DESTINATION bin)
|
install(TARGETS osrm-customize DESTINATION bin)
|
||||||
install(TARGETS osrm-contract DESTINATION bin)
|
install(TARGETS osrm-contract DESTINATION bin)
|
||||||
install(TARGETS osrm-datastore DESTINATION bin)
|
install(TARGETS osrm-datastore DESTINATION bin)
|
||||||
if (BUILD_ROUTED)
|
|
||||||
install(TARGETS osrm-routed DESTINATION bin)
|
install(TARGETS osrm-routed DESTINATION bin)
|
||||||
endif()
|
|
||||||
install(TARGETS osrm DESTINATION lib)
|
|
||||||
install(TARGETS osrm_extract DESTINATION lib)
|
|
||||||
install(TARGETS osrm_partition DESTINATION lib)
|
|
||||||
install(TARGETS osrm_customize DESTINATION lib)
|
|
||||||
install(TARGETS osrm_update DESTINATION lib)
|
|
||||||
install(TARGETS osrm_contract DESTINATION lib)
|
|
||||||
install(TARGETS osrm_store DESTINATION lib)
|
|
||||||
install(TARGETS osrm_guidance DESTINATION lib)
|
|
||||||
|
|
||||||
|
|
||||||
# Install profiles and support library to /usr/local/share/osrm/profiles by default
|
# Install profiles and support library to /usr/local/share/osrm/profiles by default
|
||||||
set(DefaultProfilesDir profiles)
|
set(DefaultProfilesDir profiles)
|
||||||
@@ -637,8 +575,6 @@ set(DefaultProfilesDir data)
|
|||||||
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
|
||||||
|
|
||||||
# Setup exporting variables for pkgconfig and subproject
|
# Setup exporting variables for pkgconfig and subproject
|
||||||
#
|
|
||||||
|
|
||||||
if(BUILD_PACKAGE)
|
if(BUILD_PACKAGE)
|
||||||
include(CPackConfig)
|
include(CPackConfig)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
@@ -715,7 +651,6 @@ if (ENABLE_NODE_BINDINGS)
|
|||||||
add_subdirectory(src/nodejs)
|
add_subdirectory(src/nodejs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (ENABLE_FUZZING)
|
if (ENABLE_FUZZING)
|
||||||
# Requires libosrm being built with sanitizers; make configurable and default to ubsan
|
# Requires libosrm being built with sanitizers; make configurable and default to ubsan
|
||||||
set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing")
|
set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing")
|
||||||
@@ -749,4 +684,3 @@ foreach(header ${headers_to_check})
|
|||||||
endforeach()
|
endforeach()
|
||||||
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
|
||||||
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
|
||||||
|
|
||||||
|
|||||||
Generated
-2582
File diff suppressed because it is too large
Load Diff
-37
@@ -1,37 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "osrm-backend"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
cheap-ruler = "0.4.0"
|
|
||||||
chksum-md5 = "0.0.0"
|
|
||||||
clap = "4.5.7"
|
|
||||||
colored = "2.1.0"
|
|
||||||
cucumber = { version = "0.21.1", features = ["tracing"] }
|
|
||||||
flatbuffers = "24.3.25"
|
|
||||||
futures = "0.3.30"
|
|
||||||
geo-types = "0.7.13"
|
|
||||||
help = "0.0.0"
|
|
||||||
log = "0.4.21"
|
|
||||||
reqwest = {version = "0.12.5", features = ["blocking"] }
|
|
||||||
serde = { version = "1.0.203", features = ["serde_derive"] }
|
|
||||||
serde_json = "1.0.118"
|
|
||||||
xml-builder = "0.5.2"
|
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "cucumber"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[profile.bench]
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
[profile.release]
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
flatc-rust = "0.2.0"
|
|
||||||
reqwest = {version = "0.12.5", features = ["blocking"] }
|
|
||||||
serde = { version = "1.0.203", features = ["serde_derive"] }
|
|
||||||
toml = "0.8.14"
|
|
||||||
zip-extract = "0.1.3"
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
use std::env;
|
|
||||||
use std::fmt::Display;
|
|
||||||
use std::io::Cursor;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::{collections::HashMap, path::Path};
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
macro_rules! build_println {
|
|
||||||
($($tokens: tt)*) => {
|
|
||||||
println!("cargo:warning=\r\x1b[32;1m {}", format!($($tokens)*))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
enum OS {
|
|
||||||
Mac,
|
|
||||||
MacIntel,
|
|
||||||
Linux,
|
|
||||||
Windows,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for OS {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
write!(f, "{:?}", self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
#[serde(untagged)]
|
|
||||||
enum DependencyValue {
|
|
||||||
String(String),
|
|
||||||
Object {
|
|
||||||
version: String,
|
|
||||||
features: Vec<String>,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
struct CargoToml {
|
|
||||||
dependencies: HashMap<String, DependencyValue>,
|
|
||||||
}
|
|
||||||
|
|
||||||
let cargo_toml_raw = include_str!("Cargo.toml");
|
|
||||||
let cargo_toml: CargoToml = toml::from_str(cargo_toml_raw).unwrap();
|
|
||||||
|
|
||||||
let version = match cargo_toml
|
|
||||||
.dependencies
|
|
||||||
.get("flatbuffers")
|
|
||||||
.expect("Must have dependency flatbuffers")
|
|
||||||
{
|
|
||||||
DependencyValue::String(s) => s,
|
|
||||||
DependencyValue::Object {
|
|
||||||
version,
|
|
||||||
features: _,
|
|
||||||
} => version,
|
|
||||||
};
|
|
||||||
|
|
||||||
let executable_path = match env::consts::OS {
|
|
||||||
"windows" => "target/flatc.exe",
|
|
||||||
_ => "target/flatc",
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some((platform, compiler)) = match env::consts::OS {
|
|
||||||
"linux" if env::consts::ARCH == "x86_64" => Some((OS::Linux, ".clang++-15")),
|
|
||||||
"macos" if env::consts::ARCH == "x86_64" => Some((OS::MacIntel, "")),
|
|
||||||
"macos" if env::consts::ARCH == "aarch64" => Some((OS::Mac, "")),
|
|
||||||
"windows" if env::consts::ARCH == "x86_64" => Some((OS::Windows, "")),
|
|
||||||
_ => None,
|
|
||||||
} {
|
|
||||||
let url = format!("https://github.com/google/flatbuffers/releases/download/v{version}/{platform}.flatc.binary{compiler}.zip");
|
|
||||||
|
|
||||||
if !Path::new(executable_path).exists() {
|
|
||||||
build_println!("Downloading flatc executable from {url}");
|
|
||||||
let response = match reqwest::blocking::get(url) {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("network error during build: {e}"),
|
|
||||||
};
|
|
||||||
let archive = match response.bytes() {
|
|
||||||
Ok(archive) => archive,
|
|
||||||
Err(e) => panic!("could not retrieve byte stream during build: {e}"),
|
|
||||||
};
|
|
||||||
let target_dir = PathBuf::from("target");
|
|
||||||
zip_extract::extract(Cursor::new(archive), &target_dir, true)
|
|
||||||
.expect("flatc cannot be unpacked")
|
|
||||||
} else {
|
|
||||||
build_println!("cached flatc executable found, not downloading");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
build_println!("unsupported platform: {} {}. 'flatc' binary supporting version {} of the library needs to be in system path", env::consts::OS, env::consts::ARCH, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
let (flatc, location) = match Path::new(executable_path).exists() {
|
|
||||||
true => (flatc_rust::Flatc::from_path(executable_path), "downloaded"),
|
|
||||||
false => (flatc_rust::Flatc::from_env_path(), "locally installed"),
|
|
||||||
};
|
|
||||||
assert!(flatc.check().is_ok());
|
|
||||||
let version = &flatc.version().unwrap();
|
|
||||||
build_println!(
|
|
||||||
"Using {location} flatc v{} to compile schema files ({executable_path})",
|
|
||||||
version.version()
|
|
||||||
);
|
|
||||||
flatc
|
|
||||||
.run(flatc_rust::Args {
|
|
||||||
extra: &["--gen-all"],
|
|
||||||
inputs: &[
|
|
||||||
Path::new("generated/include/engine/api/flatbuffers/position.fbs"),
|
|
||||||
Path::new("generated/include/engine/api/flatbuffers/waypoint.fbs"),
|
|
||||||
Path::new("generated/include/engine/api/flatbuffers/route.fbs"),
|
|
||||||
Path::new("generated/include/engine/api/flatbuffers/table.fbs"),
|
|
||||||
Path::new("generated/include/engine/api/flatbuffers/fbresult.fbs"),
|
|
||||||
],
|
|
||||||
out_dir: Path::new("target/flatbuffers/"),
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
.expect("flatc failed generating files");
|
|
||||||
}
|
|
||||||
@@ -27,11 +27,10 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
|||||||
cd build && \
|
cd build && \
|
||||||
BUILD_TYPE="Release" && \
|
BUILD_TYPE="Release" && \
|
||||||
ENABLE_ASSERTIONS="Off" && \
|
ENABLE_ASSERTIONS="Off" && \
|
||||||
BUILD_TOOLS="Off" && \
|
|
||||||
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
||||||
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On";; esac && \
|
||||||
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
|
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} && \
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=OFF && \
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DENABLE_LTO=OFF && \
|
||||||
make -j${NPROC} install && \
|
make -j${NPROC} install && \
|
||||||
cd ../profiles && \
|
cd ../profiles && \
|
||||||
cp -r * /opt && \
|
cp -r * /opt && \
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
|||||||
cd build && \
|
cd build && \
|
||||||
BUILD_TYPE="Release" && \
|
BUILD_TYPE="Release" && \
|
||||||
ENABLE_ASSERTIONS="Off" && \
|
ENABLE_ASSERTIONS="Off" && \
|
||||||
BUILD_TOOLS="Off" && \
|
|
||||||
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
||||||
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On";; esac && \
|
||||||
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
|
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} && \
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DENABLE_LTO=On && \
|
||||||
make -j${NPROC} install && \
|
make -j${NPROC} install && \
|
||||||
cd ../profiles && \
|
cd ../profiles && \
|
||||||
cp -r * /opt && \
|
cp -r * /opt && \
|
||||||
|
|||||||
+1
-1
@@ -200,7 +200,7 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
|
|||||||
Finds the fastest route between coordinates in the supplied order.
|
Finds the fastest route between coordinates in the supplied order.
|
||||||
|
|
||||||
```endpoint
|
```endpoint
|
||||||
GET /route/v1/{profile}/{coordinates}?alternatives={true|false|number}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false}&continue_straight={default|true|false}
|
GET /route/v1/{profile}/{coordinates}?alternatives={true|false|number}&steps={true|false}&geometries={polyline|polyline6|geojson}&overview={full|simplified|false}&annotations={true|false}
|
||||||
```
|
```
|
||||||
|
|
||||||
In addition to the [general options](#general-options) the following options are supported for this service:
|
In addition to the [general options](#general-options) the following options are supported for this service:
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
## Introduction
|
|
||||||
|
|
||||||
OSRM can be used as a library (libosrm) via C++ instead of using it through the HTTP interface and `osrm-routed`. This allows for fine-tuning OSRM and has much less overhead. Here is a quick introduction into how to use `libosrm` in the upcoming v5 release.
|
|
||||||
|
|
||||||
Take a look at the example code that lives in the [example directory](https://github.com/Project-OSRM/osrm-backend/tree/master/example). Here is all you ever wanted to know about `libosrm`, that is a short description of what the types do and where to find documentation on it:
|
|
||||||
|
|
||||||
## Important interface objects
|
|
||||||
|
|
||||||
- [`EngineConfig`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/engine_config.hpp) - for initializing an OSRM instance we can configure certain properties and constraints. E.g. the storage config is the base path such as `france.osm.osrm` from which we derive and load `france.osm.osrm.*` auxiliary files. This also lets you set constraints such as the maximum number of locations allowed for specific services.
|
|
||||||
|
|
||||||
- [`OSRM`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/osrm/osrm.hpp) - this is the main Routing Machine type with functions such as `Route` and `Table`. You initialize it with a `EngineConfig`. It does all the heavy lifting for you. Each function takes its own parameters, e.g. the `Route` function takes `RouteParameters`, and a out-reference to a JSON result that gets filled. The return value is a `Status`, indicating error or success.
|
|
||||||
|
|
||||||
- [`Status`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/status.hpp) - this is a type wrapping `Error` or `Ok` for indicating error or success, respectively.
|
|
||||||
|
|
||||||
- [`TableParameters`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/table_parameters.hpp) - this is an example of parameter types the Routing Machine functions expect. In this case `Table` expects its own parameters as `TableParameters`. You can see it wrapping two vectors, sources and destinations --- these are indices into your coordinates for the table service to construct a matrix from (empty sources or destinations means: use all of them). If you ask yourself where coordinates come from, you can see `TableParameters` inheriting from `BaseParameters`.
|
|
||||||
|
|
||||||
- [`BaseParameter`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/api/base_parameters.hpp) - this most importantly holds coordinates (and a few other optional properties that you don't need for basic usage); the specific parameter types inherit from `BaseParameters` to get these member attributes. That means your `TableParameters` type has `coordinates`, `sources` and `destination` member attributes (and a few other that we ignore for now).
|
|
||||||
|
|
||||||
- [`Coordinate`](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp) - this is a wrapper around a (longitude, latitude) pair. We really don't care about (lon,lat) vs (lat, lon) but we don't want you to accidentally mix them up, so both latitude and longitude are strictly typed wrappers around integers (fixed notation such as `13423240`) and floating points (floating notation such as `13.42324`).
|
|
||||||
|
|
||||||
- [Parameters for other services](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api) - here are all other `*Parameters` you need for other Routing Machine services.
|
|
||||||
|
|
||||||
- [JSON](https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/json_container.hpp) - this is a sum type resembling JSON. The Routing Machine service functions take a out-ref to a JSON result and fill it accordingly. It is currently implemented using [mapbox/variant](https://github.com/mapbox/variant) which is similar to [Boost.Variant](http://www.boost.org/doc/libs/1_55_0/doc/html/variant.html). There are two ways to work with this sum type: either provide a visitor that acts on each type on visitation or use the `get` function in case you're sure about the structure. The JSON structure is written down in the [HTTP API](#http-api).
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
See [the example folder](https://github.com/Project-OSRM/osrm-backend/tree/master/example) in the OSRM repository.
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
- Create an `OSRM` instance initialized with a `EngineConfig`
|
|
||||||
- Call the service function on the `OSRM` object providing service specific `*Parameters`
|
|
||||||
- Check the return code and use the JSON result
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
|
||||||
|
|
||||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
|
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
|
||||||
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
|
|
||||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(osrm-example C CXX)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
message(STATUS "Building on a 64 bit system")
|
|
||||||
else()
|
|
||||||
message(STATUS "Building on a 32 bit system")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
link_directories(${LibOSRM_LIBRARY_DIRS})
|
|
||||||
add_executable(osrm-example example.cpp)
|
|
||||||
|
|
||||||
find_package(LibOSRM REQUIRED)
|
|
||||||
|
|
||||||
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES})
|
|
||||||
include_directories(SYSTEM ${LibOSRM_INCLUDE_DIRS})
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LibOSRM_CXXFLAGS}")
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
# - Try to find LibOSRM
|
|
||||||
# Once done this will define
|
|
||||||
# LibOSRM_FOUND - System has LibOSRM
|
|
||||||
# LibOSRM_LIBRARIES - The libraries and ldflags needed to use LibOSRM
|
|
||||||
# LibOSRM_DEPENDENT_LIBRARIES - The libraries and ldflags need to link LibOSRM dependencies
|
|
||||||
# LibOSRM_LIBRARY_DIRS - The libraries paths needed to find LibOSRM
|
|
||||||
# LibOSRM_CXXFLAGS - Compiler switches required for using LibOSRM
|
|
||||||
|
|
||||||
find_package(PkgConfig)
|
|
||||||
pkg_search_module(PC_LibOSRM QUIET libosrm)
|
|
||||||
|
|
||||||
function(JOIN VALUES GLUE OUTPUT)
|
|
||||||
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
|
|
||||||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
list(REMOVE_ITEM PC_LibOSRM_CFLAGS " ")
|
|
||||||
JOIN("${PC_LibOSRM_CFLAGS}" " " output)
|
|
||||||
|
|
||||||
set(LibOSRM_CXXFLAGS ${output})
|
|
||||||
set(LibOSRM_LIBRARY_DIRS ${PC_LibOSRM_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
find_path(LibOSRM_INCLUDE_DIR osrm/osrm.hpp
|
|
||||||
PATH_SUFFIXES osrm include/osrm include
|
|
||||||
HINTS ${PC_LibOSRM_INCLUDEDIR} ${PC_LibOSRM_INCLUDE_DIRS}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/opt/local
|
|
||||||
/opt)
|
|
||||||
|
|
||||||
find_library(TEST_LibOSRM_STATIC_LIBRARY Names osrm.lib libosrm.a
|
|
||||||
PATH_SUFFIXES osrm lib/osrm lib
|
|
||||||
HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/opt/local
|
|
||||||
/opt)
|
|
||||||
find_library(TEST_LibOSRM_DYNAMIC_LIBRARY Names libosrm.dylib libosrm.so
|
|
||||||
PATH_SUFFIXES osrm lib/osrm lib
|
|
||||||
HINTS ${PC_LibOSRM_LIBDIR} ${PC_LibOSRM_LIBRARY_DIRS}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/opt/local
|
|
||||||
/opt)
|
|
||||||
|
|
||||||
set(LibOSRM_DEPENDENT_LIBRARIES ${PC_LibOSRM_STATIC_LDFLAGS})
|
|
||||||
set(LibOSRM_LIBRARIES ${PC_LibOSRM_LDFLAGS})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LIBOSRM_FOUND to TRUE
|
|
||||||
# if all listed variables are TRUE
|
|
||||||
find_package_handle_standard_args(LibOSRM DEFAULT_MSG
|
|
||||||
LibOSRM_LIBRARY_DIRS
|
|
||||||
LibOSRM_CXXFLAGS
|
|
||||||
LibOSRM_LIBRARIES
|
|
||||||
LibOSRM_DEPENDENT_LIBRARIES
|
|
||||||
LibOSRM_INCLUDE_DIR)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../cmake/FindTBB.cmake
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#include "osrm/match_parameters.hpp"
|
|
||||||
#include "osrm/nearest_parameters.hpp"
|
|
||||||
#include "osrm/route_parameters.hpp"
|
|
||||||
#include "osrm/table_parameters.hpp"
|
|
||||||
#include "osrm/trip_parameters.hpp"
|
|
||||||
|
|
||||||
#include "osrm/coordinate.hpp"
|
|
||||||
#include "osrm/engine_config.hpp"
|
|
||||||
#include "osrm/json_container.hpp"
|
|
||||||
|
|
||||||
#include "osrm/osrm.hpp"
|
|
||||||
#include "osrm/status.hpp"
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
if (argc < 2)
|
|
||||||
{
|
|
||||||
std::cerr << "Usage: " << argv[0] << " data.osrm\n";
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace osrm;
|
|
||||||
|
|
||||||
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
|
||||||
EngineConfig config;
|
|
||||||
|
|
||||||
config.storage_config = {argv[1]};
|
|
||||||
config.use_shared_memory = false;
|
|
||||||
|
|
||||||
// We support two routing speed up techniques:
|
|
||||||
// - Contraction Hierarchies (CH): requires extract+contract pre-processing
|
|
||||||
// - Multi-Level Dijkstra (MLD): requires extract+partition+customize pre-processing
|
|
||||||
//
|
|
||||||
// config.algorithm = EngineConfig::Algorithm::CH;
|
|
||||||
config.algorithm = EngineConfig::Algorithm::MLD;
|
|
||||||
|
|
||||||
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
|
||||||
const OSRM osrm{config};
|
|
||||||
|
|
||||||
// The following shows how to use the Route service; configure this service
|
|
||||||
RouteParameters params;
|
|
||||||
|
|
||||||
// Route in monaco
|
|
||||||
params.coordinates.push_back({util::FloatLongitude{7.419758}, util::FloatLatitude{43.731142}});
|
|
||||||
params.coordinates.push_back({util::FloatLongitude{7.419505}, util::FloatLatitude{43.736825}});
|
|
||||||
|
|
||||||
// Response is in JSON format
|
|
||||||
engine::api::ResultT result = json::Object();
|
|
||||||
|
|
||||||
// Execute routing request, this does the heavy lifting
|
|
||||||
const auto status = osrm.Route(params, result);
|
|
||||||
|
|
||||||
auto &json_result = std::get<json::Object>(result);
|
|
||||||
if (status == Status::Ok)
|
|
||||||
{
|
|
||||||
auto &routes = std::get<json::Array>(json_result.values["routes"]);
|
|
||||||
|
|
||||||
// Let's just use the first route
|
|
||||||
auto &route = std::get<json::Object>(routes.values.at(0));
|
|
||||||
const auto distance = std::get<json::Number>(route.values["distance"]).value;
|
|
||||||
const auto duration = std::get<json::Number>(route.values["duration"]).value;
|
|
||||||
|
|
||||||
// Warn users if extract does not contain the default coordinates from above
|
|
||||||
if (distance == 0 || duration == 0)
|
|
||||||
{
|
|
||||||
std::cout << "Note: distance or duration is zero. ";
|
|
||||||
std::cout << "You are probably doing a query outside of the OSM extract.\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Distance: " << distance << " meter\n";
|
|
||||||
std::cout << "Duration: " << duration << " seconds\n";
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
else if (status == Status::Error)
|
|
||||||
{
|
|
||||||
const auto code = std::get<json::String>(json_result.values["code"]).value;
|
|
||||||
const auto message = std::get<json::String>(json_result.values["message"]).value;
|
|
||||||
|
|
||||||
std::cout << "Code: " << code << "\n";
|
|
||||||
std::cout << "Message: " << code << "\n";
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -60,5 +60,5 @@ Feature: Car - Handle driving
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | modes | speed | turns |
|
| from | to | route | modes | speed | turns |
|
||||||
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h | depart,new name right,new name left,arrive |
|
| a | g | abc,cde,efg,efg | driving,driving,driving,driving | 7 km/h | depart,new name right,new name left,arrive |
|
||||||
| c | e | cde,cde | driving,driving | 2.4 km/h | depart,arrive |
|
| c | e | cde,cde | driving,driving | 2 km/h | depart,arrive |
|
||||||
| e | c | cde,cde | driving,driving | 2.4 km/h | depart,arrive |
|
| e | c | cde,cde | driving,driving | 2 km/h | depart,arrive |
|
||||||
|
|||||||
@@ -1061,7 +1061,7 @@ Feature: Collapse
|
|||||||
# i
|
# i
|
||||||
# """
|
# """
|
||||||
|
|
||||||
Given the node locations
|
And the node locations
|
||||||
| node | lat | lon | #id |
|
| node | lat | lon | #id |
|
||||||
| a | -33.9644254 | 151.1378673 | 33226063 |
|
| a | -33.9644254 | 151.1378673 | 33226063 |
|
||||||
| b | -33.9644373 | 151.1377172 | 1072787030 |
|
| b | -33.9644373 | 151.1377172 | 1072787030 |
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Feature: Basic Roundabout
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Roundabout exit counting for left sided driving
|
Scenario: Roundabout exit counting for left sided driving
|
||||||
Given a grid size of 10 meters
|
And a grid size of 10 meters
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
a
|
a
|
||||||
@@ -33,7 +33,7 @@ Feature: Basic Roundabout
|
|||||||
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
|
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
|
||||||
|
|
||||||
Scenario: Mixed Entry and Exit
|
Scenario: Mixed Entry and Exit
|
||||||
Given a grid size of 10 meters
|
And a grid size of 10 meters
|
||||||
And the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
c a
|
c a
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class OSRMBaseLoader{
|
|||||||
let retry = (err) => {
|
let retry = (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) {
|
if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) {
|
||||||
const timeoutMs = 10 * Math.pow(1.1, retryCount);
|
const timeoutMs = 10 * Math.pow(this.scope.OSRM_CONNECTION_EXP_BACKOFF_COEF, retryCount);
|
||||||
retryCount++;
|
retryCount++;
|
||||||
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, timeoutMs);
|
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, timeoutMs);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
@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
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
@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,6 +33,10 @@ Feature: osrm-datastore command line options
|
|||||||
When I try to run "osrm-datastore {processed_file} --dataset-name cucumber/only_metric_test --only-metric"
|
When I try to run "osrm-datastore {processed_file} --dataset-name cucumber/only_metric_test --only-metric"
|
||||||
Then it should exit successfully
|
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
|
Scenario: osrm-datastore - Errors on invalid path
|
||||||
When I try to run "osrm-datastore invalid_path.osrm"
|
When I try to run "osrm-datastore invalid_path.osrm"
|
||||||
Then stderr should contain "[error] Config contains invalid file paths."
|
Then stderr should contain "[error] Config contains invalid file paths."
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
@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
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
@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
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
@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
|
@412 @via
|
||||||
Scenario: Avoid weird loops 3
|
Scenario: Avoid weird loops 3
|
||||||
Given the node map
|
And the node map
|
||||||
"""
|
"""
|
||||||
a
|
a
|
||||||
b e
|
b e
|
||||||
|
|||||||
@@ -136,6 +136,22 @@ Feature: Basic Map Matching
|
|||||||
| trace | matchings |
|
| trace | matchings |
|
||||||
| abcbd | abbd |
|
| 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
|
Scenario: Testbot - Map matching with small distortion
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -401,12 +401,12 @@ Feature: Snapping at intersections
|
|||||||
Given the extract extra arguments "--small-component-size=4"
|
Given the extract extra arguments "--small-component-size=4"
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway | # comment |
|
| nodes | oneway |
|
||||||
| ab | no | |
|
| ab | no |
|
||||||
| bc | no | |
|
| bc | no |
|
||||||
| cd | no | |
|
| cd | no |
|
||||||
| fed | no | |
|
| fed | no |
|
||||||
| bg | yes | small SCC |
|
| bg | yes | # small SCC
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| 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"
|
Given the extract extra arguments "--small-component-size=4"
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes | oneway | # comment |
|
| nodes | oneway |
|
||||||
| ab | no | |
|
| ab | no |
|
||||||
| bc | no | |
|
| bc | no |
|
||||||
| cd | no | |
|
| cd | no |
|
||||||
| fed | no | |
|
| fed | no |
|
||||||
| ghi | no | |
|
| ghi | no |
|
||||||
| jkl | no | |
|
| jkl | no |
|
||||||
| bm | yes | small SCC |
|
| bm | yes | # small SCC
|
||||||
|
|
||||||
And the relations
|
And the relations
|
||||||
| type | way:from | way:to | node:via | restriction |
|
| type | way:from | way:to | node:via | restriction |
|
||||||
|
|||||||
@@ -65,6 +65,32 @@ Feature: Via points
|
|||||||
| waypoints | route | turns |
|
| waypoints | route | turns |
|
||||||
| 1,2,3 | cd,ac,ab,bd,cd | depart,new name right,new name right,new name right,arrive |
|
| 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
|
Scenario: Via point at a dead end
|
||||||
Given the node map
|
Given the node map
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,249 +0,0 @@
|
|||||||
// 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_
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
// 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
@@ -1,149 +0,0 @@
|
|||||||
// 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_
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
// 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_
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@ table FBResult {
|
|||||||
data_version: string;
|
data_version: string;
|
||||||
waypoints: [Waypoint]; //Used as 'sources' waypoints for a 'Table' service
|
waypoints: [Waypoint]; //Used as 'sources' waypoints for a 'Table' service
|
||||||
routes: [RouteObject];
|
routes: [RouteObject];
|
||||||
table: TableResult;
|
table: Table;
|
||||||
}
|
}
|
||||||
|
|
||||||
root_type FBResult;
|
root_type FBResult;
|
||||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
include "waypoint.fbs";
|
include "waypoint.fbs";
|
||||||
namespace osrm.engine.api.fbresult;
|
namespace osrm.engine.api.fbresult;
|
||||||
|
|
||||||
table TableResult {
|
table Table {
|
||||||
durations: [float];
|
durations: [float];
|
||||||
rows: ushort;
|
rows: ushort;
|
||||||
cols: ushort;
|
cols: ushort;
|
||||||
@@ -137,7 +137,7 @@ class TableAPI final : public BaseAPI
|
|||||||
speed_cells = MakeEstimatesTable(fb_result, fallback_speed_cells);
|
speed_cells = MakeEstimatesTable(fb_result, fallback_speed_cells);
|
||||||
}
|
}
|
||||||
|
|
||||||
fbresult::TableResultBuilder table(fb_result);
|
fbresult::TableBuilder table(fb_result);
|
||||||
table.add_destinations(destinations);
|
table.add_destinations(destinations);
|
||||||
table.add_rows(number_of_sources);
|
table.add_rows(number_of_sources);
|
||||||
table.add_cols(number_of_destinations);
|
table.add_cols(number_of_destinations);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include "util/query_heap.hpp"
|
#include "util/query_heap.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
|
#include <boost/thread/tss.hpp>
|
||||||
|
|
||||||
namespace osrm::engine
|
namespace osrm::engine
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -43,19 +45,19 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
|||||||
ManyToManyHeapData,
|
ManyToManyHeapData,
|
||||||
util::UnorderedMapStorage<NodeID, int>>;
|
util::UnorderedMapStorage<NodeID, int>>;
|
||||||
|
|
||||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||||
|
|
||||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||||
|
|
||||||
static thread_local SearchEngineHeapPtr forward_heap_1;
|
static SearchEngineHeapPtr forward_heap_1;
|
||||||
static thread_local SearchEngineHeapPtr reverse_heap_1;
|
static SearchEngineHeapPtr reverse_heap_1;
|
||||||
static thread_local SearchEngineHeapPtr forward_heap_2;
|
static SearchEngineHeapPtr forward_heap_2;
|
||||||
static thread_local SearchEngineHeapPtr reverse_heap_2;
|
static SearchEngineHeapPtr reverse_heap_2;
|
||||||
static thread_local SearchEngineHeapPtr forward_heap_3;
|
static SearchEngineHeapPtr forward_heap_3;
|
||||||
static thread_local SearchEngineHeapPtr reverse_heap_3;
|
static SearchEngineHeapPtr reverse_heap_3;
|
||||||
static thread_local ManyToManyHeapPtr many_to_many_heap;
|
static ManyToManyHeapPtr many_to_many_heap;
|
||||||
static thread_local SearchEngineHeapPtr map_matching_forward_heap_1;
|
static SearchEngineHeapPtr map_matching_forward_heap_1;
|
||||||
static thread_local SearchEngineHeapPtr map_matching_reverse_heap_1;
|
static SearchEngineHeapPtr map_matching_reverse_heap_1;
|
||||||
|
|
||||||
void InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes);
|
void InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes);
|
||||||
|
|
||||||
@@ -125,16 +127,16 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
|||||||
MapMatchingMultiLayerDijkstraHeapData,
|
MapMatchingMultiLayerDijkstraHeapData,
|
||||||
util::TwoLevelStorage<NodeID, int>>;
|
util::TwoLevelStorage<NodeID, int>>;
|
||||||
|
|
||||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||||
using MapMatchingHeapPtr = std::unique_ptr<MapMatchingQueryHeap>;
|
using MapMatchingHeapPtr = boost::thread_specific_ptr<MapMatchingQueryHeap>;
|
||||||
|
|
||||||
static thread_local SearchEngineHeapPtr forward_heap_1;
|
static SearchEngineHeapPtr forward_heap_1;
|
||||||
static thread_local SearchEngineHeapPtr reverse_heap_1;
|
static SearchEngineHeapPtr reverse_heap_1;
|
||||||
static thread_local MapMatchingHeapPtr map_matching_forward_heap_1;
|
static MapMatchingHeapPtr map_matching_forward_heap_1;
|
||||||
static thread_local MapMatchingHeapPtr map_matching_reverse_heap_1;
|
static MapMatchingHeapPtr map_matching_reverse_heap_1;
|
||||||
|
|
||||||
static thread_local ManyToManyHeapPtr many_to_many_heap;
|
static ManyToManyHeapPtr many_to_many_heap;
|
||||||
|
|
||||||
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes,
|
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes,
|
||||||
unsigned number_of_boundary_nodes);
|
unsigned number_of_boundary_nodes);
|
||||||
|
|||||||
@@ -15,6 +15,48 @@
|
|||||||
namespace osrm::util
|
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
|
template <typename NodeID, typename Key> class ArrayStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -30,6 +72,29 @@ template <typename NodeID, typename Key> class ArrayStorage
|
|||||||
std::vector<Key> positions;
|
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
|
template <typename NodeID, typename Key> class UnorderedMapStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|||||||
|
|
||||||
SET test_region=monaco
|
SET test_region=monaco
|
||||||
SET test_region_ch=ch\monaco
|
SET test_region_ch=ch\monaco
|
||||||
|
SET test_region_corech=corech\monaco
|
||||||
SET test_region_mld=mld\monaco
|
SET test_region_mld=mld\monaco
|
||||||
SET test_osm=%test_region%.osm.pbf
|
SET test_osm=%test_region%.osm.pbf
|
||||||
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
|
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
|
||||||
@@ -68,13 +69,18 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|||||||
MKDIR ch
|
MKDIR ch
|
||||||
XCOPY %test_region%.osrm.* ch\
|
XCOPY %test_region%.osrm.* 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
|
MKDIR mld
|
||||||
XCOPY %test_region%.osrm.* mld\
|
XCOPY %test_region%.osrm.* mld\
|
||||||
XCOPY %test_region%.osrm mld\
|
XCOPY %test_region%.osrm mld\
|
||||||
%CONFIGURATION%\osrm-contract.exe %test_region_ch%.osrm
|
%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-partition.exe %test_region_mld%.osrm
|
||||||
%CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm
|
%CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm
|
||||||
XCOPY /Y ch\*.* ..\test\data\ch\
|
XCOPY /Y ch\*.* ..\test\data\ch\
|
||||||
|
XCOPY /Y corech\*.* ..\test\data\corech\
|
||||||
XCOPY /Y mld\*.* ..\test\data\mld\
|
XCOPY /Y mld\*.* ..\test\data\mld\
|
||||||
unit_tests\%CONFIGURATION%\library-tests.exe
|
unit_tests\%CONFIGURATION%\library-tests.exe
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ VTZERO_TAG=v1.1.0
|
|||||||
FMT_PATH="fmtlib/fmt"
|
FMT_PATH="fmtlib/fmt"
|
||||||
FMT_TAG=v10.2.1
|
FMT_TAG=v10.2.1
|
||||||
|
|
||||||
FLATBUFFERS_PATH="google/flatbuffers"
|
|
||||||
FLATBUFFERS_TAG=v24.3.25
|
|
||||||
|
|
||||||
function update_subtree () {
|
function update_subtree () {
|
||||||
name=$(echo "$1" | tr '[:lower:]' '[:upper:]')
|
name=$(echo "$1" | tr '[:lower:]' '[:upper:]')
|
||||||
path=$(tmpvar=${name}_PATH && echo ${!tmpvar})
|
path=$(tmpvar=${name}_PATH && echo ${!tmpvar})
|
||||||
@@ -56,6 +53,6 @@ function update_subtree () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
## Update dependencies
|
## Update dependencies
|
||||||
for dep in osmium sol rapidjson microtar protozero vtzero fmt flatbuffers; do
|
for dep in osmium sol rapidjson microtar protozero vtzero fmt; do
|
||||||
update_subtree $dep
|
update_subtree $dep
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -5,18 +5,16 @@ namespace osrm::engine
|
|||||||
|
|
||||||
// CH heaps
|
// CH heaps
|
||||||
using CH = routing_algorithms::ch::Algorithm;
|
using CH = routing_algorithms::ch::Algorithm;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_1;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_1;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_2;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_2;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::forward_heap_3;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::reverse_heap_3;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::map_matching_forward_heap_1;
|
||||||
SearchEngineData<CH>::map_matching_forward_heap_1;
|
SearchEngineData<CH>::SearchEngineHeapPtr SearchEngineData<CH>::map_matching_reverse_heap_1;
|
||||||
thread_local SearchEngineData<CH>::SearchEngineHeapPtr
|
|
||||||
SearchEngineData<CH>::map_matching_reverse_heap_1;
|
|
||||||
|
|
||||||
thread_local SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
|
SearchEngineData<CH>::ManyToManyHeapPtr SearchEngineData<CH>::many_to_many_heap;
|
||||||
|
|
||||||
void SearchEngineData<CH>::InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes)
|
void SearchEngineData<CH>::InitializeOrClearMapMatchingThreadLocalStorage(unsigned number_of_nodes)
|
||||||
{
|
{
|
||||||
@@ -116,13 +114,11 @@ void SearchEngineData<CH>::InitializeOrClearManyToManyThreadLocalStorage(unsigne
|
|||||||
|
|
||||||
// MLD
|
// MLD
|
||||||
using MLD = routing_algorithms::mld::Algorithm;
|
using MLD = routing_algorithms::mld::Algorithm;
|
||||||
thread_local SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::forward_heap_1;
|
||||||
thread_local SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_1;
|
SearchEngineData<MLD>::SearchEngineHeapPtr SearchEngineData<MLD>::reverse_heap_1;
|
||||||
thread_local SearchEngineData<MLD>::MapMatchingHeapPtr
|
SearchEngineData<MLD>::MapMatchingHeapPtr SearchEngineData<MLD>::map_matching_forward_heap_1;
|
||||||
SearchEngineData<MLD>::map_matching_forward_heap_1;
|
SearchEngineData<MLD>::MapMatchingHeapPtr SearchEngineData<MLD>::map_matching_reverse_heap_1;
|
||||||
thread_local SearchEngineData<MLD>::MapMatchingHeapPtr
|
SearchEngineData<MLD>::ManyToManyHeapPtr SearchEngineData<MLD>::many_to_many_heap;
|
||||||
SearchEngineData<MLD>::map_matching_reverse_heap_1;
|
|
||||||
thread_local SearchEngineData<MLD>::ManyToManyHeapPtr SearchEngineData<MLD>::many_to_many_heap;
|
|
||||||
|
|
||||||
void SearchEngineData<MLD>::InitializeOrClearMapMatchingThreadLocalStorage(
|
void SearchEngineData<MLD>::InitializeOrClearMapMatchingThreadLocalStorage(
|
||||||
unsigned number_of_nodes, unsigned number_of_boundary_nodes)
|
unsigned number_of_nodes, unsigned number_of_boundary_nodes)
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "util/json_container.hpp"
|
#include "util/json_container.hpp"
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace osrm::server::service
|
namespace osrm::server::service
|
||||||
{
|
{
|
||||||
@@ -31,11 +30,11 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters)
|
|||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
engine::Status NearestService::RunQuery(std::size_t prefix_length,
|
engine::Status NearestService::RunQuery(std::size_t prefix_length,
|
||||||
std::string &query,
|
std::string &query,
|
||||||
osrm::engine::api::ResultT &result)
|
osrm::engine::api::ResultT &result)
|
||||||
{
|
{
|
||||||
std::cout << "running query: " << query << "\n";
|
|
||||||
result = util::json::Object();
|
result = util::json::Object();
|
||||||
auto &json_result = std::get<util::json::Object>(result);
|
auto &json_result = std::get<util::json::Object>(result);
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -46,7 +46,10 @@ return_code parseArguments(int argc,
|
|||||||
boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
|
boost::program_options::value<unsigned int>(&contractor_config.requested_num_threads)
|
||||||
->default_value(std::thread::hardware_concurrency()),
|
->default_value(std::thread::hardware_concurrency()),
|
||||||
"Number of threads to use")(
|
"Number of threads to use")(
|
||||||
"segment-speed-file",
|
"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>>(
|
boost::program_options::value<std::vector<std::string>>(
|
||||||
&contractor_config.updater_config.segment_speed_lookup_paths)
|
&contractor_config.updater_config.segment_speed_lookup_paths)
|
||||||
->composing(),
|
->composing(),
|
||||||
@@ -56,6 +59,12 @@ return_code parseArguments(int argc,
|
|||||||
&contractor_config.updater_config.turn_penalty_lookup_paths)
|
&contractor_config.updater_config.turn_penalty_lookup_paths)
|
||||||
->composing(),
|
->composing(),
|
||||||
"Lookup files containing from_, to_, via_nodes, and turn penalties to adjust turn weights")(
|
"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",
|
"edge-weight-updates-over-factor",
|
||||||
boost::program_options::value<double>(
|
boost::program_options::value<double>(
|
||||||
&contractor_config.updater_config.log_edge_updates_factor)
|
&contractor_config.updater_config.log_edge_updates_factor)
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
use std::fmt::Display;
|
|
||||||
|
|
||||||
use clap::Parser;
|
|
||||||
|
|
||||||
#[derive(clap::ValueEnum, Clone, Default, Debug)]
|
|
||||||
pub enum LoadMethod {
|
|
||||||
Mmap,
|
|
||||||
#[default]
|
|
||||||
Datastore,
|
|
||||||
Directly,
|
|
||||||
}
|
|
||||||
impl Display for LoadMethod {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
let result = match self {
|
|
||||||
LoadMethod::Mmap => "mmap",
|
|
||||||
LoadMethod::Datastore => "datastore",
|
|
||||||
LoadMethod::Directly => "directly",
|
|
||||||
};
|
|
||||||
write!(f, "{result}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(clap::ValueEnum, Clone, Default, Debug)]
|
|
||||||
pub enum RoutingAlgorithm {
|
|
||||||
#[default]
|
|
||||||
Ch,
|
|
||||||
Mld,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for RoutingAlgorithm {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
let result = match self {
|
|
||||||
RoutingAlgorithm::Ch => "ch",
|
|
||||||
RoutingAlgorithm::Mld => "mld",
|
|
||||||
};
|
|
||||||
write!(f, "{result}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: move to external file
|
|
||||||
#[derive(Parser, Debug)]
|
|
||||||
#[command(version, about, long_about = None)]
|
|
||||||
pub struct Args {
|
|
||||||
// underlying memory storage
|
|
||||||
#[arg(short, default_value_t = LoadMethod::Datastore)]
|
|
||||||
memory: LoadMethod,
|
|
||||||
|
|
||||||
// Number of times to greet
|
|
||||||
#[arg(short, default_value_t = RoutingAlgorithm::Ch)]
|
|
||||||
p: RoutingAlgorithm,
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#[derive(Debug)]
|
|
||||||
pub enum Offset {
|
|
||||||
Absolute(f64),
|
|
||||||
Percentage(f64),
|
|
||||||
}
|
|
||||||
|
|
||||||
// #[cfg(test)]
|
|
||||||
// mod tests {
|
|
||||||
// use crate::extract_number_and_offset;
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn extract_number_and_offset() {
|
|
||||||
// let (value, result) = extract_number_and_offset("m", "300 +- 1m");
|
|
||||||
// assert_eq!(value, 300.);
|
|
||||||
// assert_eq!(offset, 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
use colored::Colorize;
|
|
||||||
use cucumber::{cli, event, parser, Event};
|
|
||||||
use std::{
|
|
||||||
io::{self, Write},
|
|
||||||
time::Instant,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
|
||||||
pub struct DotWriter {
|
|
||||||
scenarios_started: usize,
|
|
||||||
scenarios_failed: usize,
|
|
||||||
scenarios_finished: usize,
|
|
||||||
features_started: usize,
|
|
||||||
features_finished: usize,
|
|
||||||
step_started: usize,
|
|
||||||
step_failed: usize,
|
|
||||||
step_passed: usize,
|
|
||||||
step_skipped: usize,
|
|
||||||
start_time: Option<Instant>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<W: 'static> cucumber::Writer<W> for DotWriter {
|
|
||||||
type Cli = cli::Empty; // we provide no CLI options
|
|
||||||
|
|
||||||
async fn handle_event(&mut self, ev: parser::Result<Event<event::Cucumber<W>>>, _: &Self::Cli) {
|
|
||||||
let green_dot = ".".green();
|
|
||||||
let cyan_dash = "-".cyan();
|
|
||||||
let red_cross = "X".red();
|
|
||||||
match ev {
|
|
||||||
Ok(Event { value, .. }) => match value {
|
|
||||||
event::Cucumber::Feature(_feature, ev) => match ev {
|
|
||||||
event::Feature::Started => {
|
|
||||||
self.features_started += 1;
|
|
||||||
print!("{green_dot}")
|
|
||||||
}
|
|
||||||
event::Feature::Scenario(_scenario, ev) => match ev.event {
|
|
||||||
event::Scenario::Started => {
|
|
||||||
self.scenarios_started += 1;
|
|
||||||
print!("{green_dot}")
|
|
||||||
}
|
|
||||||
event::Scenario::Step(_step, ev) => match ev {
|
|
||||||
event::Step::Started => {
|
|
||||||
self.step_started += 1;
|
|
||||||
print!("{green_dot}")
|
|
||||||
}
|
|
||||||
event::Step::Passed(..) => {
|
|
||||||
self.step_passed += 1;
|
|
||||||
print!("{green_dot}")
|
|
||||||
}
|
|
||||||
event::Step::Skipped => {
|
|
||||||
self.step_skipped += 1;
|
|
||||||
print!("{cyan_dash}")
|
|
||||||
}
|
|
||||||
event::Step::Failed(_, _, _, _err) => {
|
|
||||||
self.step_failed += 1;
|
|
||||||
print!("{red_cross}")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
event::Scenario::Hook(_, _) => {}
|
|
||||||
event::Scenario::Background(_, _) => {}
|
|
||||||
event::Scenario::Log(_) => {}
|
|
||||||
event::Scenario::Finished => {
|
|
||||||
self.scenarios_finished += 1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
event::Feature::Rule(_, _) => {}
|
|
||||||
event::Feature::Finished => {
|
|
||||||
self.features_finished += 1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
event::Cucumber::Finished => {
|
|
||||||
println!();
|
|
||||||
let f = format!("{} failed", self.scenarios_failed).red();
|
|
||||||
let p = format!("{} passed", self.scenarios_finished).green();
|
|
||||||
println!("{} scenarios ({f}, {p})", self.scenarios_started);
|
|
||||||
let f = format!("{} failed", self.step_failed).red();
|
|
||||||
let s = format!("{} skipped", self.step_skipped).cyan();
|
|
||||||
let p = format!("{} passed", self.step_passed).green();
|
|
||||||
println!("{} steps ({f}, {s}, {p})", self.step_started);
|
|
||||||
|
|
||||||
let elapsed = Instant::now() - self.start_time.unwrap();
|
|
||||||
let minutes = elapsed.as_secs() / 60;
|
|
||||||
let seconds = (elapsed.as_millis() % 60_000) as f64 / 1000.;
|
|
||||||
println!("{}m{}s", minutes, seconds);
|
|
||||||
}
|
|
||||||
event::Cucumber::ParsingFinished {
|
|
||||||
features: _,
|
|
||||||
rules: _,
|
|
||||||
scenarios: _,
|
|
||||||
steps: _,
|
|
||||||
parser_errors: _,
|
|
||||||
} => {}
|
|
||||||
event::Cucumber::Started => {
|
|
||||||
self.start_time = Some(Instant::now());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(e) => println!("Error: {e}"),
|
|
||||||
}
|
|
||||||
let _ = io::stdout().flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
use super::comparison::Offset;
|
|
||||||
|
|
||||||
pub fn approx_equal(a: f64, b: f64, dp: u8) -> bool {
|
|
||||||
let p = 10f64.powi(-(dp as i32));
|
|
||||||
(a - b).abs() < p
|
|
||||||
}
|
|
||||||
|
|
||||||
fn aprox_equal_within_percentage_range(actual: f64, expectation: f64, percentage: f64) -> bool {
|
|
||||||
assert!(percentage.is_sign_positive() && percentage <= 100.);
|
|
||||||
let factor = 0.01 * percentage as f64;
|
|
||||||
actual >= expectation - (factor * expectation) && actual <= expectation + (factor * expectation)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn approx_equal_within_offset_range(actual: f64, expectation: f64, offset: f64) -> bool {
|
|
||||||
assert!(offset >= 0., "offset must be positive");
|
|
||||||
actual >= expectation - offset && actual <= expectation + offset
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn approximate_within_range(actual: f64, expectation: f64, offset: &Offset) -> bool {
|
|
||||||
match offset {
|
|
||||||
Offset::Absolute(a) => approx_equal_within_offset_range(actual, expectation, *a),
|
|
||||||
Offset::Percentage(p) => aprox_equal_within_percentage_range(actual, expectation, *p),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
use std::{
|
|
||||||
fs::{self, File},
|
|
||||||
io::Read,
|
|
||||||
path::PathBuf,
|
|
||||||
};
|
|
||||||
|
|
||||||
use log::debug;
|
|
||||||
|
|
||||||
pub fn get_file_as_byte_vec(path: &PathBuf) -> Vec<u8> {
|
|
||||||
debug!("opening {path:?}");
|
|
||||||
let mut f = File::open(path).expect("no file found");
|
|
||||||
let metadata = fs::metadata(path).expect("unable to read metadata");
|
|
||||||
let mut buffer = vec![0; metadata.len() as usize];
|
|
||||||
match f.read(&mut buffer) {
|
|
||||||
Ok(l) => assert_eq!(metadata.len() as usize, l, "data was not completely read"),
|
|
||||||
Err(e) => panic!("Error: {e}"),
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
use std::{env, fs, path::PathBuf};
|
|
||||||
|
|
||||||
use log::debug;
|
|
||||||
|
|
||||||
use crate::common::{
|
|
||||||
file_util::get_file_as_byte_vec, lexicographic_file_walker::LexicographicFileWalker,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn md5_of_osrm_executables() -> chksum_md5::MD5 {
|
|
||||||
// create OSRM digest before any tests are executed since cucumber-rs doesn't have @beforeAll
|
|
||||||
let exe_path = env::current_exe().expect("failed to get current exe path");
|
|
||||||
let path = exe_path
|
|
||||||
.ancestors()
|
|
||||||
.find(|p| p.ends_with("target"))
|
|
||||||
.expect("compiled cucumber test executable resides in a directory tree with the root name 'target'")
|
|
||||||
.parent().unwrap();
|
|
||||||
// TODO: Remove after migration to Rust build dir
|
|
||||||
let build_path = path.join("build");
|
|
||||||
// TODO: Remove after migration to Rust build dir
|
|
||||||
let mut dependencies = Vec::new();
|
|
||||||
|
|
||||||
// FIXME: the following iterator gymnastics port the exact order and behavior of the JavaScript implementation
|
|
||||||
let names = [
|
|
||||||
"osrm-extract",
|
|
||||||
"osrm-contract",
|
|
||||||
"osrm-customize",
|
|
||||||
"osrm-partition",
|
|
||||||
"osrm_extract",
|
|
||||||
"osrm_contract",
|
|
||||||
"osrm_customize",
|
|
||||||
"osrm_partition",
|
|
||||||
];
|
|
||||||
|
|
||||||
let files: Vec<PathBuf> = fs::read_dir(build_path)
|
|
||||||
.unwrap()
|
|
||||||
.filter_map(|e| e.ok())
|
|
||||||
.map(|dir_entry| dir_entry.path())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let iter = names.iter().map(|name| {
|
|
||||||
files
|
|
||||||
.iter()
|
|
||||||
.find(|path_buf| {
|
|
||||||
path_buf
|
|
||||||
.file_stem()
|
|
||||||
.unwrap()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.contains(name)
|
|
||||||
})
|
|
||||||
.cloned()
|
|
||||||
.expect("file exists and is usable")
|
|
||||||
});
|
|
||||||
|
|
||||||
dependencies.extend(iter);
|
|
||||||
|
|
||||||
let profiles_path = path.join("profiles");
|
|
||||||
debug!("{profiles_path:?}");
|
|
||||||
|
|
||||||
dependencies.extend(
|
|
||||||
LexicographicFileWalker::new(&profiles_path)
|
|
||||||
.filter(|pb| !pb.to_str().unwrap().contains("examples"))
|
|
||||||
.filter(|pathbuf| match pathbuf.extension() {
|
|
||||||
Some(ext) => ext.to_str().unwrap() == "lua",
|
|
||||||
None => false,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
let mut md5 = chksum_md5::new();
|
|
||||||
debug!("md5: {}", md5.digest().to_hex_lowercase());
|
|
||||||
|
|
||||||
for path_buf in dependencies {
|
|
||||||
let data = get_file_as_byte_vec(&path_buf);
|
|
||||||
if data.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
md5.update(data);
|
|
||||||
// debug!("md5: {}", md5.digest().to_hex_lowercase());
|
|
||||||
}
|
|
||||||
md5
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// struct to keep state agent, profile, host, etc
|
|
||||||
// functions to make nearest, route, etc calls
|
|
||||||
// fn nearest(arg1, ... argn) -> NearestResponse
|
|
||||||
|
|
||||||
// use std::{path::Path, time::Duration};
|
|
||||||
|
|
||||||
// use ureq::{Agent, AgentBuilder};
|
|
||||||
|
|
||||||
// pub struct HttpRequest {
|
|
||||||
// agent: Agent,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// impl HttpRequest {
|
|
||||||
// // pub fn fetch_to_file(url: &str, output: &Path) -> Result<()> {}
|
|
||||||
|
|
||||||
// pub fn new() -> Self {
|
|
||||||
// let agent = AgentBuilder::new()
|
|
||||||
// .timeout_read(Duration::from_secs(5))
|
|
||||||
// .timeout_write(Duration::from_secs(5))
|
|
||||||
// .build();
|
|
||||||
|
|
||||||
// Self { agent }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
use std::{
|
|
||||||
collections::VecDeque,
|
|
||||||
fs,
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: port into toolbox-rs
|
|
||||||
pub struct LexicographicFileWalker {
|
|
||||||
dirs: VecDeque<PathBuf>,
|
|
||||||
files: VecDeque<PathBuf>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LexicographicFileWalker {
|
|
||||||
pub fn new(path: &Path) -> Self {
|
|
||||||
let mut dirs = VecDeque::new();
|
|
||||||
|
|
||||||
if path.is_dir() {
|
|
||||||
dirs.push_back(path.to_path_buf());
|
|
||||||
}
|
|
||||||
|
|
||||||
Self {
|
|
||||||
dirs,
|
|
||||||
files: VecDeque::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Iterator for LexicographicFileWalker {
|
|
||||||
type Item = PathBuf;
|
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
|
||||||
if self.dirs.is_empty() && self.files.is_empty() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
while self.files.is_empty() && !self.dirs.is_empty() {
|
|
||||||
assert!(!self.dirs.is_empty());
|
|
||||||
let current_dir = self.dirs.pop_front().unwrap();
|
|
||||||
let mut temp_dirs = Vec::new();
|
|
||||||
|
|
||||||
for entry in fs::read_dir(current_dir).unwrap() {
|
|
||||||
let entry = entry.unwrap();
|
|
||||||
let path = entry.path();
|
|
||||||
if path.is_dir() {
|
|
||||||
temp_dirs.push(path.clone());
|
|
||||||
} else {
|
|
||||||
self.files.push_back(path.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.files.make_contiguous().sort();
|
|
||||||
temp_dirs.sort();
|
|
||||||
self.dirs.extend(temp_dirs.into_iter());
|
|
||||||
}
|
|
||||||
self.files.pop_front()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
use std::{
|
|
||||||
io::{BufRead, BufReader},
|
|
||||||
process::{Child, Command, Stdio},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
|
||||||
pub struct LocalTask {
|
|
||||||
ready: bool,
|
|
||||||
command: String,
|
|
||||||
arguments: Vec<String>,
|
|
||||||
child: Option<Child>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LocalTask {
|
|
||||||
pub fn new(command: String) -> Self {
|
|
||||||
Self {
|
|
||||||
ready: false,
|
|
||||||
command: command,
|
|
||||||
arguments: Vec::new(),
|
|
||||||
child: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub fn is_ready(&self) -> bool {
|
|
||||||
// TODO: also check that process is running
|
|
||||||
self.ready
|
|
||||||
}
|
|
||||||
pub fn arg(mut self, argument: &str) -> Self {
|
|
||||||
self.arguments.push(argument.into());
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn spawn_wait_till_ready(&mut self, ready_token: &str) {
|
|
||||||
let mut command = &mut Command::new(&self.command);
|
|
||||||
for argument in &self.arguments {
|
|
||||||
command = command.arg(argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
match command.stdout(Stdio::piped()).spawn() {
|
|
||||||
Ok(o) => self.child = Some(o),
|
|
||||||
Err(e) => panic!("cannot spawn task: {e}"),
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.child.is_none() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(output) = &mut self.child.as_mut().unwrap().stdout {
|
|
||||||
// implement with a timeout
|
|
||||||
let mut reader = BufReader::new(output);
|
|
||||||
let mut line = String::new();
|
|
||||||
while let Ok(_count) = reader.read_line(&mut line) {
|
|
||||||
// println!("count: {count} ->{line}");
|
|
||||||
if line.contains(ready_token) {
|
|
||||||
self.ready = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// impl Drop for LocalTask {
|
|
||||||
// fn drop(&mut self) {
|
|
||||||
// if let Err(e) = self.child.as_mut().expect("can't access child").kill() {
|
|
||||||
// panic!("shutdown failed: {e}");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, Deserialize)]
|
|
||||||
pub struct Location {
|
|
||||||
// Note: The order is important since we derive Deserialize
|
|
||||||
pub longitude: f64,
|
|
||||||
pub latitude: f64,
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
#![allow(clippy::derivable_impls, clippy::all)]
|
|
||||||
extern crate flatbuffers;
|
|
||||||
|
|
||||||
pub mod cli_arguments;
|
|
||||||
pub mod comparison;
|
|
||||||
pub mod dot_writer;
|
|
||||||
pub mod f64_utils;
|
|
||||||
pub mod file_util;
|
|
||||||
pub mod hash_util;
|
|
||||||
pub mod http_request;
|
|
||||||
pub mod lexicographic_file_walker;
|
|
||||||
pub mod local_task;
|
|
||||||
pub mod location;
|
|
||||||
pub mod nearest_response;
|
|
||||||
pub mod osm;
|
|
||||||
pub mod osm_db;
|
|
||||||
pub mod osrm_error;
|
|
||||||
pub mod osrm_world;
|
|
||||||
pub mod route_response;
|
|
||||||
pub mod scenario_id;
|
|
||||||
|
|
||||||
// flatbuffer
|
|
||||||
#[allow(dead_code, unused_imports)]
|
|
||||||
#[path = "../../target/flatbuffers/fbresult_generated.rs"]
|
|
||||||
pub mod fbresult_flatbuffers;
|
|
||||||
#[allow(dead_code, unused_imports)]
|
|
||||||
#[path = "../../target/flatbuffers/position_generated.rs"]
|
|
||||||
pub mod position_flatbuffers;
|
|
||||||
#[allow(dead_code, unused_imports)]
|
|
||||||
#[path = "../../target/flatbuffers/route_generated.rs"]
|
|
||||||
pub mod route_flatbuffers;
|
|
||||||
#[allow(dead_code, unused_imports)]
|
|
||||||
#[path = "../../target/flatbuffers/table_generated.rs"]
|
|
||||||
pub mod table_flatbuffers;
|
|
||||||
#[allow(dead_code, unused_imports)]
|
|
||||||
#[path = "../../target/flatbuffers/waypoint_generated.rs"]
|
|
||||||
pub mod waypoint_flatbuffers;
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
use super::location::Location;
|
|
||||||
use crate::common::fbresult_flatbuffers::osrm::engine::api::fbresult::FBResult;
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
pub struct Waypoint {
|
|
||||||
pub hint: String,
|
|
||||||
pub nodes: Option<Vec<u64>>,
|
|
||||||
pub distance: f32,
|
|
||||||
pub name: String,
|
|
||||||
location: Location,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Waypoint {
|
|
||||||
pub fn location(&self) -> &Location {
|
|
||||||
&self.location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
pub struct NearestResponse {
|
|
||||||
pub code: String,
|
|
||||||
pub waypoints: Vec<Waypoint>,
|
|
||||||
pub data_version: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NearestResponse {
|
|
||||||
// TODO: the from_* functions should be a) into_. or b) implement From<_> trait
|
|
||||||
pub fn from_json_reader(reader: impl std::io::Read) -> Self {
|
|
||||||
let response = match serde_json::from_reader::<_, NearestResponse>(reader) {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("parsing error {e}"),
|
|
||||||
};
|
|
||||||
response
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_flatbuffer(mut reader: impl std::io::Read) -> Self {
|
|
||||||
let mut buffer = Vec::new();
|
|
||||||
if let Err(e) = reader.read_to_end(&mut buffer) {
|
|
||||||
panic!("cannot read from strem: {e}");
|
|
||||||
};
|
|
||||||
let decoded: Result<FBResult, flatbuffers::InvalidFlatbuffer> =
|
|
||||||
flatbuffers::root::<FBResult>(&buffer);
|
|
||||||
let decoded: FBResult = match decoded {
|
|
||||||
Ok(d) => d,
|
|
||||||
Err(e) => panic!("Error during parsing: {e} {:?}", buffer),
|
|
||||||
};
|
|
||||||
let code = match decoded.code() {
|
|
||||||
Some(e) => e.message().expect("code exists but is not unwrappable"),
|
|
||||||
None => "",
|
|
||||||
};
|
|
||||||
let data_version = match decoded.data_version() {
|
|
||||||
Some(s) => s,
|
|
||||||
None => "",
|
|
||||||
};
|
|
||||||
|
|
||||||
let waypoints = decoded
|
|
||||||
.waypoints()
|
|
||||||
.expect("waypoints should be at least an empty list")
|
|
||||||
.iter()
|
|
||||||
.map(|wp| {
|
|
||||||
let hint = wp.hint().expect("hint is missing").to_string();
|
|
||||||
let location = wp.location().expect("waypoint must have a location");
|
|
||||||
let location = Location {
|
|
||||||
latitude: location.latitude() as f64,
|
|
||||||
longitude: location.longitude() as f64,
|
|
||||||
};
|
|
||||||
let nodes = wp.nodes().expect("waypoint mus have nodes");
|
|
||||||
let nodes = Some(vec![nodes.first(), nodes.second()]);
|
|
||||||
let distance = wp.distance();
|
|
||||||
|
|
||||||
Waypoint {
|
|
||||||
hint,
|
|
||||||
nodes,
|
|
||||||
distance,
|
|
||||||
name: "".into(),
|
|
||||||
location,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
Self {
|
|
||||||
code: code.into(),
|
|
||||||
waypoints,
|
|
||||||
data_version: Some(data_version.into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use xml_builder::XMLElement;
|
|
||||||
|
|
||||||
use super::location::Location;
|
|
||||||
|
|
||||||
static OSM_USER: &str = "osrm";
|
|
||||||
static OSM_TIMESTAMP: &str = "2000-01-01T00:00:00Z";
|
|
||||||
static OSM_UID: &str = "1";
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
|
||||||
pub struct OSMNode {
|
|
||||||
pub id: u64,
|
|
||||||
pub location: Location,
|
|
||||||
pub tags: HashMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OSMNode {
|
|
||||||
pub fn add_tag(&mut self, key: &str, value: &str) {
|
|
||||||
if key.is_empty() || value.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.tags.insert(key.into(), value.into());
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn set_id_(&mut self, id: u64) {
|
|
||||||
// self.id = id;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn set_tags(&mut self, tags: HashMap<String, String>) {
|
|
||||||
// self.tags = tags
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn to_xml(&self) -> XMLElement {
|
|
||||||
let mut node = XMLElement::new("node");
|
|
||||||
node.add_attribute("id", &self.id.to_string());
|
|
||||||
node.add_attribute("version", "1");
|
|
||||||
node.add_attribute("uid", OSM_UID);
|
|
||||||
node.add_attribute("user", OSM_USER);
|
|
||||||
node.add_attribute("timestamp", OSM_TIMESTAMP);
|
|
||||||
node.add_attribute("lon", &format!("{:?}", self.location.longitude));
|
|
||||||
node.add_attribute("lat", &format!("{:?}", self.location.latitude));
|
|
||||||
|
|
||||||
if !self.tags.is_empty() {
|
|
||||||
for (key, value) in &self.tags {
|
|
||||||
let mut tags = XMLElement::new("tag");
|
|
||||||
tags.add_attribute("k", key);
|
|
||||||
tags.add_attribute("v", value);
|
|
||||||
node.add_child(tags).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
|
||||||
pub struct OSMWay {
|
|
||||||
pub id: u64,
|
|
||||||
pub tags: HashMap<String, String>,
|
|
||||||
pub nodes: Vec<OSMNode>,
|
|
||||||
pub add_locations: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OSMWay {
|
|
||||||
pub fn add_node(&mut self, node: OSMNode) {
|
|
||||||
self.nodes.push(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn set_tags(&mut self, tags: HashMap<String, String>) {
|
|
||||||
// self.tags = tags;
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn add_tag(&mut self, key: &str, value: &str) {
|
|
||||||
if key.is_empty() || value.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.tags.insert(key.into(), value.into());
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_xml(&self) -> XMLElement {
|
|
||||||
let mut way = XMLElement::new("way");
|
|
||||||
way.add_attribute("id", &self.id.to_string());
|
|
||||||
way.add_attribute("version", "1");
|
|
||||||
way.add_attribute("uid", OSM_UID);
|
|
||||||
way.add_attribute("user", OSM_USER);
|
|
||||||
way.add_attribute("timestamp", OSM_TIMESTAMP);
|
|
||||||
|
|
||||||
assert!(self.nodes.len() >= 2);
|
|
||||||
|
|
||||||
for node in &self.nodes {
|
|
||||||
let mut nd = XMLElement::new("nd");
|
|
||||||
nd.add_attribute("ref", &node.id.to_string());
|
|
||||||
if self.add_locations {
|
|
||||||
nd.add_attribute("lon", &format!("{:?}", node.location.longitude));
|
|
||||||
nd.add_attribute("lat", &format!("{:?}", node.location.latitude));
|
|
||||||
}
|
|
||||||
way.add_child(nd).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.tags.is_empty() {
|
|
||||||
for (key, value) in &self.tags {
|
|
||||||
let mut tags = XMLElement::new("tag");
|
|
||||||
tags.add_attribute("k", key);
|
|
||||||
tags.add_attribute("v", value);
|
|
||||||
way.add_child(tags).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
way
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// #[derive(Clone, Debug)]
|
|
||||||
// struct Member {
|
|
||||||
// id: u64,
|
|
||||||
// member_type: String,
|
|
||||||
// member_role: String,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[derive(Clone, Debug)]
|
|
||||||
// struct OSMRelation {
|
|
||||||
// id: u64,
|
|
||||||
// osm_user: String,
|
|
||||||
// osm_time_stamp: String,
|
|
||||||
// osm_uid: String,
|
|
||||||
// members: Vec<Member>,
|
|
||||||
// tags: HashMap<String, String>,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// impl OSMRelation {
|
|
||||||
// fn add_member(&mut self, member_type: String, id: u64, member_role: String) {
|
|
||||||
// self.members.push(Member {
|
|
||||||
// id,
|
|
||||||
// member_type,
|
|
||||||
// member_role,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn add_tag(&mut self, key: &str, value: &str) {
|
|
||||||
// self.tags.insert(key.into(), value.into());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
use super::osm::{OSMNode, OSMWay};
|
|
||||||
use xml_builder::{XMLBuilder, XMLElement, XMLVersion};
|
|
||||||
|
|
||||||
// TODO: better error handling in XML creation
|
|
||||||
#[derive(Debug, Default)]
|
|
||||||
pub struct OSMDb {
|
|
||||||
nodes: Vec<(String, OSMNode)>,
|
|
||||||
ways: Vec<OSMWay>,
|
|
||||||
// relations: Vec<OSMRelation>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OSMDb {
|
|
||||||
pub fn add_node(&mut self, node: OSMNode) {
|
|
||||||
let name = node.tags.get("name").unwrap();
|
|
||||||
// assert!(
|
|
||||||
// name.len() == 1,
|
|
||||||
// "name needs to be of length 1, but was \"{name}\""
|
|
||||||
// );
|
|
||||||
self.nodes.push((name.clone(), node));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn find_node(&self, search_name: String) -> Option<&(String, OSMNode)> {
|
|
||||||
// TODO: this is a linear search.
|
|
||||||
self.nodes.iter().find(|(name, _node)| search_name == *name)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_way(&mut self, way: OSMWay) {
|
|
||||||
self.ways.push(way);
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn add_relation(&mut self, relation: OSMRelation) {
|
|
||||||
// self.relations.push(relation);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn clear(&mut self) {
|
|
||||||
// self.nodes.clear();
|
|
||||||
// self.ways.clear();
|
|
||||||
// // self.relations.clear();
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn to_xml(&self) -> String {
|
|
||||||
let mut xml = XMLBuilder::new()
|
|
||||||
.version(XMLVersion::XML1_0)
|
|
||||||
.encoding("UTF-8".into())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let mut osm = XMLElement::new("osm");
|
|
||||||
osm.add_attribute("generator", "osrm-test");
|
|
||||||
osm.add_attribute("version", "0.6");
|
|
||||||
|
|
||||||
for (_, node) in &self.nodes {
|
|
||||||
osm.add_child(node.to_xml()).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
for way in &self.ways {
|
|
||||||
osm.add_child(way.to_xml()).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
xml.set_root_element(osm);
|
|
||||||
|
|
||||||
let mut writer: Vec<u8> = Vec::new();
|
|
||||||
xml.generate(&mut writer).unwrap();
|
|
||||||
String::from_utf8(writer).unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn node_len(&self) -> usize {
|
|
||||||
// self.nodes.len()
|
|
||||||
// }
|
|
||||||
// pub fn way_len(&self) -> usize {
|
|
||||||
// self.ways.len()
|
|
||||||
// }
|
|
||||||
// pub fn relation_len(&self) -> usize {
|
|
||||||
// self.relations.len()
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn empty_db_by_default() {
|
|
||||||
use super::*;
|
|
||||||
let osm_db = OSMDb::default();
|
|
||||||
assert_eq!(0, osm_db.node_len());
|
|
||||||
assert_eq!(0, osm_db.way_len());
|
|
||||||
// assert_eq!(0, osm_db.relation_len());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn osm_db_with_single_node() {
|
|
||||||
use super::*;
|
|
||||||
let mut osm_db = OSMDb::default();
|
|
||||||
|
|
||||||
let mut node1 = OSMNode {
|
|
||||||
id: 123,
|
|
||||||
location: Location {
|
|
||||||
longitude: 8.9876,
|
|
||||||
latitude: 50.1234,
|
|
||||||
},
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut node2 = OSMNode {
|
|
||||||
id: 321,
|
|
||||||
location: Location {
|
|
||||||
longitude: 8.9876,
|
|
||||||
latitude: 50.1234,
|
|
||||||
},
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
node1.add_tag("name", "a");
|
|
||||||
node2.add_tag("name", "b");
|
|
||||||
osm_db.add_node(node1.clone());
|
|
||||||
osm_db.add_node(node2.clone());
|
|
||||||
|
|
||||||
let mut way = OSMWay {
|
|
||||||
id: 890,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
way.nodes.push(node1);
|
|
||||||
way.nodes.push(node2);
|
|
||||||
|
|
||||||
osm_db.add_way(way);
|
|
||||||
|
|
||||||
let actual = osm_db.to_xml();
|
|
||||||
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"osrm-test\" version=\"0.6\">\n\t<node id=\"123\" version=\"1.0\" user=\"osrm\" timestamp=\"2000-01-01T00:00:00Z\" lon=\"8.9876\" lat=\"50.1234\">\n\t\t<tag name=\"a\" />\n\t</node>\n\t<node id=\"321\" version=\"1.0\" user=\"osrm\" timestamp=\"2000-01-01T00:00:00Z\" lon=\"8.9876\" lat=\"50.1234\">\n\t\t<tag name=\"b\" />\n\t</node>\n\t<way id=\"890\" version=\"1\" uid=\"1\" user=\"osrm\" timestamp=\"2000-01-01T00:00:00Z\">\n\t\t<nd ref=\"123\" />\n\t\t<nd ref=\"321\" />\n\t</way>\n</osm>\n";
|
|
||||||
|
|
||||||
// println!("{actual}");
|
|
||||||
assert_eq!(actual, expected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize)]
|
|
||||||
pub struct OSRMError {
|
|
||||||
pub code: String,
|
|
||||||
pub message: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OSRMError {
|
|
||||||
pub fn from_json_reader(reader: impl std::io::Read) -> Self {
|
|
||||||
let response = match serde_json::from_reader::<_, Self>(reader) {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("parsing error {e}"),
|
|
||||||
};
|
|
||||||
response
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,335 +0,0 @@
|
|||||||
use super::{
|
|
||||||
nearest_response::NearestResponse,
|
|
||||||
osm::{OSMNode, OSMWay},
|
|
||||||
osm_db::OSMDb,
|
|
||||||
osrm_error::OSRMError,
|
|
||||||
route_response::RouteResponse,
|
|
||||||
};
|
|
||||||
use crate::{common::local_task::LocalTask, Location};
|
|
||||||
use core::panic;
|
|
||||||
use cucumber::World;
|
|
||||||
use log::debug;
|
|
||||||
use reqwest::StatusCode;
|
|
||||||
use std::{
|
|
||||||
collections::HashMap,
|
|
||||||
fs::{create_dir_all, File},
|
|
||||||
io::Write,
|
|
||||||
path::PathBuf,
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
const DEFAULT_ORIGIN: Location = Location {
|
|
||||||
longitude: 1.0f64,
|
|
||||||
latitude: 1.0f64,
|
|
||||||
};
|
|
||||||
const DEFAULT_GRID_SIZE: f64 = 100.;
|
|
||||||
const WAY_SPACING: f64 = 100.;
|
|
||||||
const DEFAULT_PROFILE: &str = "bicycle";
|
|
||||||
|
|
||||||
#[derive(Debug, World)]
|
|
||||||
pub struct OSRMWorld {
|
|
||||||
pub feature_path: Option<PathBuf>,
|
|
||||||
pub scenario_id: String,
|
|
||||||
pub feature_digest: String,
|
|
||||||
pub osrm_digest: String,
|
|
||||||
pub osm_id: u64,
|
|
||||||
pub profile: String,
|
|
||||||
|
|
||||||
pub known_osm_nodes: HashMap<char, Location>,
|
|
||||||
pub known_locations: HashMap<char, Location>,
|
|
||||||
|
|
||||||
pub osm_db: OSMDb,
|
|
||||||
pub extraction_parameters: Vec<String>,
|
|
||||||
|
|
||||||
pub request_with_flatbuffers: bool,
|
|
||||||
pub query_options: HashMap<String, String>,
|
|
||||||
pub request_string: Option<String>,
|
|
||||||
|
|
||||||
pub grid_size: f64,
|
|
||||||
pub origin: Location,
|
|
||||||
pub way_spacing: f64,
|
|
||||||
|
|
||||||
task: LocalTask,
|
|
||||||
client: reqwest::blocking::Client,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for OSRMWorld {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
feature_path: Default::default(),
|
|
||||||
scenario_id: Default::default(),
|
|
||||||
feature_digest: Default::default(),
|
|
||||||
osrm_digest: Default::default(),
|
|
||||||
osm_id: Default::default(),
|
|
||||||
profile: DEFAULT_PROFILE.into(),
|
|
||||||
known_osm_nodes: Default::default(),
|
|
||||||
known_locations: Default::default(),
|
|
||||||
osm_db: Default::default(),
|
|
||||||
extraction_parameters: Default::default(),
|
|
||||||
request_with_flatbuffers: Default::default(),
|
|
||||||
query_options: HashMap::from([
|
|
||||||
// default parameters // TODO: check if necessary
|
|
||||||
("steps".into(), "true".into()),
|
|
||||||
("alternatives".into(), "false".into()),
|
|
||||||
// ("annotations".into(), "true".into()),
|
|
||||||
]),
|
|
||||||
request_string: Default::default(),
|
|
||||||
|
|
||||||
grid_size: DEFAULT_GRID_SIZE,
|
|
||||||
origin: DEFAULT_ORIGIN,
|
|
||||||
way_spacing: WAY_SPACING,
|
|
||||||
task: LocalTask::default(),
|
|
||||||
client: reqwest::blocking::Client::builder()
|
|
||||||
.connect_timeout(Duration::from_secs(5))
|
|
||||||
.no_proxy()
|
|
||||||
.http1_only()
|
|
||||||
.build()
|
|
||||||
.unwrap(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OSRMWorld {
|
|
||||||
pub fn feature_cache_path(&self) -> PathBuf {
|
|
||||||
let full_path = self.feature_path.clone().unwrap();
|
|
||||||
let path = full_path
|
|
||||||
.ancestors()
|
|
||||||
.find(|p| p.ends_with("features"))
|
|
||||||
.expect(".feature files reside in a directory tree with the root name 'features'");
|
|
||||||
|
|
||||||
let suffix = full_path.strip_prefix(path).unwrap();
|
|
||||||
let path = path.parent().unwrap();
|
|
||||||
debug!("suffix: {suffix:?}");
|
|
||||||
let cache_path = path
|
|
||||||
.join("test")
|
|
||||||
.join("cache")
|
|
||||||
.join(suffix)
|
|
||||||
.join(&self.feature_digest);
|
|
||||||
|
|
||||||
debug!("{cache_path:?}");
|
|
||||||
if !cache_path.exists() {
|
|
||||||
create_dir_all(&cache_path).expect("cache path could not be created");
|
|
||||||
} else {
|
|
||||||
debug!("not creating cache dir");
|
|
||||||
}
|
|
||||||
cache_path
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn routed_path(&self) -> PathBuf {
|
|
||||||
let full_path = self.feature_path.clone().unwrap();
|
|
||||||
let path = full_path
|
|
||||||
.ancestors()
|
|
||||||
.find(|p| p.ends_with("features"))
|
|
||||||
.expect(".feature files reside in a directory tree with the root name 'features'");
|
|
||||||
let routed_path = path
|
|
||||||
.parent()
|
|
||||||
.expect("cannot get parent path")
|
|
||||||
.join("build")
|
|
||||||
.join("osrm-routed");
|
|
||||||
assert!(routed_path.exists(), "osrm-routed binary not found");
|
|
||||||
routed_path
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_scenario_specific_paths_and_digests(&mut self, path: Option<PathBuf>) {
|
|
||||||
self.feature_path.clone_from(&path);
|
|
||||||
|
|
||||||
let file = File::open(path.clone().unwrap())
|
|
||||||
.unwrap_or_else(|_| panic!("filesystem broken? can't open file {:?}", path));
|
|
||||||
self.feature_digest = chksum_md5::chksum(file)
|
|
||||||
.expect("md5 could not be computed")
|
|
||||||
.to_hex_lowercase();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn make_osm_id(&mut self) -> u64 {
|
|
||||||
// number implicitly starts a 1. This is in line with previous implementations
|
|
||||||
self.osm_id += 1;
|
|
||||||
self.osm_id
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_osm_node(&mut self, name: char, location: Location, id: Option<u64>) {
|
|
||||||
if self.known_osm_nodes.contains_key(&name) {
|
|
||||||
panic!("duplicate node: {name}");
|
|
||||||
}
|
|
||||||
let id = match id {
|
|
||||||
Some(id) => id,
|
|
||||||
None => self.make_osm_id(),
|
|
||||||
};
|
|
||||||
let node = OSMNode {
|
|
||||||
id,
|
|
||||||
location,
|
|
||||||
tags: HashMap::from([("name".to_string(), name.to_string())]),
|
|
||||||
};
|
|
||||||
|
|
||||||
self.known_osm_nodes.insert(name, location);
|
|
||||||
self.osm_db.add_node(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_osm_way(&mut self, way: OSMWay) {
|
|
||||||
way.nodes.iter().for_each(|node| {
|
|
||||||
self.osm_db.add_node(node.clone());
|
|
||||||
});
|
|
||||||
|
|
||||||
self.osm_db.add_way(way);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_location(&self, name: char) -> Location {
|
|
||||||
*match name {
|
|
||||||
// TODO: move lookup to world
|
|
||||||
'0'..='9' => self
|
|
||||||
.known_locations
|
|
||||||
.get(&name)
|
|
||||||
.expect("test case specifies unknown location: {name}"),
|
|
||||||
'a'..='z' => self
|
|
||||||
.known_osm_nodes
|
|
||||||
.get(&name)
|
|
||||||
.expect("test case specifies unknown osm node: {name}"),
|
|
||||||
_ => unreachable!("nodes have to be name in [0-9][a-z]"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_location(&mut self, name: char, location: Location) {
|
|
||||||
if self.known_locations.contains_key(&name) {
|
|
||||||
panic!("duplicate location: {name}")
|
|
||||||
}
|
|
||||||
self.known_locations.insert(name, location);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn write_osm_file(&self) {
|
|
||||||
let osm_file = self
|
|
||||||
.feature_cache_path()
|
|
||||||
.join(self.scenario_id.clone() + ".osm");
|
|
||||||
if !osm_file.exists() {
|
|
||||||
debug!("writing to osm file: {osm_file:?}");
|
|
||||||
let mut file = File::create(osm_file).expect("could not create OSM file");
|
|
||||||
file.write_all(self.osm_db.to_xml().as_bytes())
|
|
||||||
.expect("could not write OSM file");
|
|
||||||
} else {
|
|
||||||
debug!("not writing to OSM file {osm_file:?}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn extract_osm_file(&self) {
|
|
||||||
let cache_path = self.artefact_cache_path();
|
|
||||||
if cache_path.exists() {
|
|
||||||
debug!("{cache_path:?} exists");
|
|
||||||
} else {
|
|
||||||
unimplemented!("{cache_path:?} does not exist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn artefact_cache_path(&self) -> PathBuf {
|
|
||||||
self.feature_cache_path().join(&self.osrm_digest)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn start_routed(&mut self) {
|
|
||||||
if self.task.is_ready() {
|
|
||||||
// task running already
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let data_path = self
|
|
||||||
.artefact_cache_path()
|
|
||||||
.join(self.scenario_id.to_owned() + ".osrm");
|
|
||||||
|
|
||||||
self.task = LocalTask::new(self.routed_path().to_string_lossy().into())
|
|
||||||
.arg(data_path.to_str().expect("data path unwrappable"));
|
|
||||||
self.task
|
|
||||||
.spawn_wait_till_ready("running and waiting for requests");
|
|
||||||
assert!(self.task.is_ready());
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn nearest(
|
|
||||||
&mut self,
|
|
||||||
query_location: &Location,
|
|
||||||
) -> Result<(u16, NearestResponse), (u16, OSRMError)> {
|
|
||||||
self.start_routed();
|
|
||||||
|
|
||||||
let mut url = format!(
|
|
||||||
"http://localhost:5000/nearest/v1/{}/{:?},{:?}",
|
|
||||||
self.profile, query_location.longitude, query_location.latitude
|
|
||||||
);
|
|
||||||
if self.request_with_flatbuffers {
|
|
||||||
url += ".flatbuffers";
|
|
||||||
}
|
|
||||||
|
|
||||||
let response = match self.client.get(url).send() {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("http error: {e}"),
|
|
||||||
};
|
|
||||||
let status = response.status();
|
|
||||||
let bytes = &response.bytes().unwrap()[..];
|
|
||||||
|
|
||||||
match status {
|
|
||||||
StatusCode::OK => {
|
|
||||||
let response = match self.request_with_flatbuffers {
|
|
||||||
true => NearestResponse::from_flatbuffer(bytes),
|
|
||||||
false => NearestResponse::from_json_reader(bytes),
|
|
||||||
};
|
|
||||||
return Ok((status.as_u16(), response));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err((status.as_u16(), OSRMError::from_json_reader(bytes)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn route(
|
|
||||||
&mut self,
|
|
||||||
waypoints: &[Location],
|
|
||||||
) -> Result<(u16, RouteResponse), (u16, OSRMError)> {
|
|
||||||
self.start_routed();
|
|
||||||
|
|
||||||
let waypoint_string = waypoints
|
|
||||||
.iter()
|
|
||||||
.map(|location| format!("{:?},{:?}", location.longitude, location.latitude))
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join(";");
|
|
||||||
|
|
||||||
let url = match &self.request_string {
|
|
||||||
None => {
|
|
||||||
let mut url = format!(
|
|
||||||
"http://127.0.0.1:5000/route/v1/{}/{waypoint_string}",
|
|
||||||
self.profile,
|
|
||||||
);
|
|
||||||
if self.request_with_flatbuffers {
|
|
||||||
url += ".flatbuffers";
|
|
||||||
}
|
|
||||||
if !self.query_options.is_empty() {
|
|
||||||
let options = self
|
|
||||||
.query_options
|
|
||||||
.iter()
|
|
||||||
.map(|(key, value)| format!("{key}={value}"))
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join("&");
|
|
||||||
url += "?";
|
|
||||||
url += &options;
|
|
||||||
}
|
|
||||||
url
|
|
||||||
}
|
|
||||||
Some(request_string) => {
|
|
||||||
let temp = format!("http://127.0.0.1:5000/{}", request_string);
|
|
||||||
temp
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// println!("url: {url}");
|
|
||||||
let response = match self.client.get(url).send() {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("http error: {e}"),
|
|
||||||
};
|
|
||||||
let status = &response.status();
|
|
||||||
|
|
||||||
match *status {
|
|
||||||
StatusCode::OK => {
|
|
||||||
let text = response.text().unwrap();
|
|
||||||
let response = match self.request_with_flatbuffers {
|
|
||||||
true => unimplemented!("RouteResponse::from_flatbuffer(body)"),
|
|
||||||
false => RouteResponse::from_string(&text),
|
|
||||||
};
|
|
||||||
Ok((status.as_u16(), response))
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
let bytes = &response.bytes().unwrap()[..];
|
|
||||||
return Err((status.as_u16(), OSRMError::from_json_reader(bytes)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
use super::{location::Location, nearest_response::Waypoint};
|
|
||||||
|
|
||||||
#[derive(Deserialize, Default, Debug)]
|
|
||||||
pub struct Maneuver {
|
|
||||||
pub bearing_after: u64,
|
|
||||||
pub bearing_before: u64,
|
|
||||||
pub location: Location,
|
|
||||||
pub modifier: Option<String>, // TODO: should be an enum
|
|
||||||
pub r#type: String, // TODO: should be an enum
|
|
||||||
pub exit: Option<u64>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
|
||||||
#[serde(untagged)]
|
|
||||||
pub enum Geometry {
|
|
||||||
A(String),
|
|
||||||
B {
|
|
||||||
coordinates: Vec<Location>,
|
|
||||||
r#type: String,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Geometry {
|
|
||||||
fn default() -> Self {
|
|
||||||
Geometry::A("".to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Deserialize)]
|
|
||||||
pub struct Intersection {
|
|
||||||
pub r#in: Option<u64>,
|
|
||||||
pub out: Option<u64>,
|
|
||||||
pub entry: Vec<bool>,
|
|
||||||
pub bearings: Vec<u64>,
|
|
||||||
pub location: Location,
|
|
||||||
pub classes: Option<Vec<String>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Default, Debug)]
|
|
||||||
pub struct Step {
|
|
||||||
pub geometry: Geometry,
|
|
||||||
pub mode: String,
|
|
||||||
pub maneuver: Maneuver,
|
|
||||||
pub name: String,
|
|
||||||
pub pronunciation: Option<String>,
|
|
||||||
pub rotary_name: Option<String>,
|
|
||||||
pub r#ref: Option<String>,
|
|
||||||
pub duration: f64,
|
|
||||||
pub distance: f64,
|
|
||||||
pub intersections: Vec<Intersection>,
|
|
||||||
}
|
|
||||||
|
|
||||||
// #[derive(Deserialize, Debug)]
|
|
||||||
// pub struct Annotation {
|
|
||||||
// pub nodes: Option<Vec<u64>>,
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize)]
|
|
||||||
pub struct Leg {
|
|
||||||
pub summary: String,
|
|
||||||
pub weight: f64,
|
|
||||||
pub duration: f64,
|
|
||||||
pub steps: Vec<Step>,
|
|
||||||
pub distance: f64,
|
|
||||||
// pub annotation: Option<Vec<Annotation>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Default)]
|
|
||||||
pub struct Route {
|
|
||||||
pub geometry: Geometry,
|
|
||||||
pub weight: f64,
|
|
||||||
pub duration: f64,
|
|
||||||
pub legs: Vec<Leg>,
|
|
||||||
pub weight_name: String,
|
|
||||||
pub distance: f64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize)]
|
|
||||||
pub struct RouteResponse {
|
|
||||||
pub code: String,
|
|
||||||
pub routes: Vec<Route>,
|
|
||||||
pub waypoints: Option<Vec<Waypoint>>,
|
|
||||||
pub data_version: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RouteResponse {
|
|
||||||
pub fn from_json_reader(reader: impl std::io::Read) -> Self {
|
|
||||||
let response = match serde_json::from_reader::<_, Self>(reader) {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("parsing error {e}"),
|
|
||||||
};
|
|
||||||
response
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_string(input: &str) -> Self {
|
|
||||||
// println!("{input}");
|
|
||||||
let response = match serde_json::from_str(input) {
|
|
||||||
Ok(response) => response,
|
|
||||||
Err(e) => panic!("parsing error {e} => {input}"),
|
|
||||||
};
|
|
||||||
response
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
pub fn scenario_id(scenario: &cucumber::gherkin::Scenario) -> String {
|
|
||||||
// ports the following logic:
|
|
||||||
// let name = scenario.getName().toLowerCase().replace(/[/\-'=,():*#]/g, '')
|
|
||||||
// .replace(/\s/g, '_').replace(/__/g, '_').replace(/\.\./g, '.')
|
|
||||||
// .substring(0, 64);
|
|
||||||
let mut s = scenario
|
|
||||||
.name
|
|
||||||
.to_ascii_lowercase()
|
|
||||||
.replace(
|
|
||||||
&['/', '\\', '-', '\'', '=', ',', '(', ')', ':', '*', '#'][..],
|
|
||||||
"",
|
|
||||||
)
|
|
||||||
.chars()
|
|
||||||
.map(|x| match x {
|
|
||||||
' ' => '_',
|
|
||||||
_ => x,
|
|
||||||
})
|
|
||||||
.collect::<String>()
|
|
||||||
.replace('\\', "_")
|
|
||||||
.replace("__", "_")
|
|
||||||
.replace("..", ".");
|
|
||||||
s.truncate(64);
|
|
||||||
format!("{}_{}", scenario.position.line, s)
|
|
||||||
}
|
|
||||||
-1183
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
|||||||
|
:: 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%
|
||||||
+9
-29
@@ -1,38 +1,18 @@
|
|||||||
---
|
---
|
||||||
buildifier: latest
|
buildifier: latest
|
||||||
bazel: 6.4.0
|
|
||||||
platforms:
|
platforms:
|
||||||
|
ubuntu1604:
|
||||||
|
build_targets:
|
||||||
|
- "..."
|
||||||
|
test_targets:
|
||||||
|
- "..."
|
||||||
ubuntu1804:
|
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:
|
build_targets:
|
||||||
- "//..."
|
- "..."
|
||||||
test_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:
|
macos:
|
||||||
xcode_version: "14.2"
|
|
||||||
build_targets:
|
build_targets:
|
||||||
- "//..."
|
- "..."
|
||||||
test_targets:
|
test_targets:
|
||||||
- "//..."
|
- "..."
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
node_modules
|
|
||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
# 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
@@ -1,347 +0,0 @@
|
|||||||
---
|
|
||||||
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,4 +5,3 @@ root = true
|
|||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|||||||
Vendored
-13
@@ -1,13 +0,0 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: [
|
|
||||||
'@typescript-eslint',
|
|
||||||
],
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
]
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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!
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
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
@@ -0,0 +1,18 @@
|
|||||||
|
# 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,13 +1,6 @@
|
|||||||
*_wire.txt
|
*_wire.txt
|
||||||
*_wire.bin
|
*_wire.bin
|
||||||
.DS_Store
|
.DS_Store
|
||||||
**/.build
|
|
||||||
build
|
|
||||||
**/Packages
|
|
||||||
/*.xcodeproj
|
|
||||||
**/xcuserdata/
|
|
||||||
**/xcshareddata/
|
|
||||||
**/.swiftpm/
|
|
||||||
*.o
|
*.o
|
||||||
*.o.d
|
*.o.d
|
||||||
*.class
|
*.class
|
||||||
@@ -46,16 +39,12 @@ project.properties
|
|||||||
proguard-project.txt
|
proguard-project.txt
|
||||||
linklint_results
|
linklint_results
|
||||||
Makefile
|
Makefile
|
||||||
flatbenchmark
|
|
||||||
flatbenchmark.exe
|
|
||||||
flatc
|
flatc
|
||||||
flatc.exe
|
flatc.exe
|
||||||
flathash
|
flathash
|
||||||
flathash.exe
|
flathash.exe
|
||||||
flattests
|
flattests
|
||||||
flattests.exe
|
flattests.exe
|
||||||
flattests_cpp17
|
|
||||||
flattests_cpp17.exe
|
|
||||||
flatsamplebinary
|
flatsamplebinary
|
||||||
flatsamplebinary.exe
|
flatsamplebinary.exe
|
||||||
flatsampletext
|
flatsampletext
|
||||||
@@ -74,11 +63,13 @@ tests/monsterdata_go_wire.mon
|
|||||||
tests/monsterdata_javascript_wire.mon
|
tests/monsterdata_javascript_wire.mon
|
||||||
tests/monsterdata_lobster_wire.mon
|
tests/monsterdata_lobster_wire.mon
|
||||||
tests/monsterdata_rust_wire.mon
|
tests/monsterdata_rust_wire.mon
|
||||||
|
tests/unicode_test.mon
|
||||||
|
tests/ts/
|
||||||
tests/php/
|
tests/php/
|
||||||
CMakeLists.txt.user
|
CMakeLists.txt.user
|
||||||
CMakeScripts/**
|
CMakeScripts/**
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
flatbuffers-config-version.cmake
|
FlatbuffersConfigVersion.cmake
|
||||||
FlatBuffers.cbp
|
FlatBuffers.cbp
|
||||||
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
||||||
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
||||||
@@ -88,7 +79,6 @@ java/*.iml
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
target
|
target
|
||||||
java/target
|
|
||||||
**/*.pyc
|
**/*.pyc
|
||||||
build/VS2010/FlatBuffers.sdf
|
build/VS2010/FlatBuffers.sdf
|
||||||
build/VS2010/FlatBuffers.opensdf
|
build/VS2010/FlatBuffers.opensdf
|
||||||
@@ -106,10 +96,7 @@ android/build/
|
|||||||
samples/android/.externalNativeBuild/
|
samples/android/.externalNativeBuild/
|
||||||
samples/android/.gradle/
|
samples/android/.gradle/
|
||||||
samples/android/build/
|
samples/android/build/
|
||||||
js/**/*.js
|
js/flatbuffers.mjs
|
||||||
js/**/*.d.ts
|
|
||||||
mjs/**/*.js
|
|
||||||
mjs/**/*.d.ts
|
|
||||||
/bazel-bin
|
/bazel-bin
|
||||||
/bazel-flatbuffers
|
/bazel-flatbuffers
|
||||||
/bazel-genfiles
|
/bazel-genfiles
|
||||||
@@ -129,27 +116,3 @@ dart/doc/api/
|
|||||||
Cargo.lock
|
Cargo.lock
|
||||||
.corpus**
|
.corpus**
|
||||||
.seed**
|
.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
@@ -1 +0,0 @@
|
|||||||
hoist=false
|
|
||||||
Vendored
+221
@@ -0,0 +1,221 @@
|
|||||||
|
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
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
#!/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
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/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
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#!/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$"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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)
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/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
@@ -0,0 +1,225 @@
|
|||||||
|
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
@@ -1,139 +0,0 @@
|
|||||||
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
@@ -1,168 +0,0 @@
|
|||||||
# 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,9 +59,6 @@ function(build_flatbuffers flatbuffers_schemas
|
|||||||
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
||||||
set(FLATC_TARGET "")
|
set(FLATC_TARGET "")
|
||||||
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
||||||
elseif(TARGET flatbuffers::flatc)
|
|
||||||
set(FLATC_TARGET flatbuffers::flatc)
|
|
||||||
set(FLATC flatbuffers::flatc)
|
|
||||||
else()
|
else()
|
||||||
set(FLATC_TARGET flatc)
|
set(FLATC_TARGET flatc)
|
||||||
set(FLATC flatc)
|
set(FLATC flatc)
|
||||||
@@ -153,297 +150,3 @@ function(build_flatbuffers flatbuffers_schemas
|
|||||||
${copy_text_schemas_dir})
|
${copy_text_schemas_dir})
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
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()
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
|
|||||||
find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
|
find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(FlatBuffers
|
find_package_handle_standard_args(flatbuffers
|
||||||
DEFAULT_MSG FLATBUFFERS_FLATC_EXECUTABLE FLATBUFFERS_INCLUDE_DIR)
|
DEFAULT_MSG FLATBUFFERS_FLATC_EXECUTABLE FLATBUFFERS_INCLUDE_DIR)
|
||||||
|
|
||||||
if(FLATBUFFERS_FOUND)
|
if(FLATBUFFERS_FOUND)
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersTargets.cmake" OPTIONAL)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersSharedTargets.cmake" OPTIONAL)
|
||||||
|
|
||||||
+16
-2
@@ -17,9 +17,23 @@ if (UNIX)
|
|||||||
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_COMMIT}")
|
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_COMMIT}")
|
||||||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
|
SET(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
|
||||||
|
|
||||||
|
# Derive architecture
|
||||||
|
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||||
|
FIND_PROGRAM(DPKG_CMD dpkg)
|
||||||
|
IF(NOT DPKG_CMD)
|
||||||
|
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
|
||||||
|
ENDIF(NOT DPKG_CMD)
|
||||||
|
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
|
||||||
|
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||||
|
|
||||||
# Package name
|
# Package name
|
||||||
SET(CPACK_DEBIAN_PACKAGE_NAME "flatbuffers")
|
SET(CPACK_DEBIAN_PACKAGE_NAME "flatbuffers")
|
||||||
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
|
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
|
||||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
SET(CPACK_PACKAGE_FILE_NAME
|
||||||
|
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||||
|
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|||||||
+2
-12
@@ -15,14 +15,14 @@ if (UNIX)
|
|||||||
|
|
||||||
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
|
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
|
||||||
|
|
||||||
# Assume this is not a cross compilation build.
|
# Assume this is not a cross complation build.
|
||||||
if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
|
if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
|
||||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
endif(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
|
endif(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
|
||||||
|
|
||||||
set(CPACK_RPM_PACKAGE_VENDOR "Google, Inc.")
|
set(CPACK_RPM_PACKAGE_VENDOR "Google, Inc.")
|
||||||
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
|
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
|
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/CMake/DESCRIPTION.txt)
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/CMake/DESCRIPTION.txt)
|
||||||
|
|
||||||
# This may reduce rpm compatiblity with very old systems.
|
# This may reduce rpm compatiblity with very old systems.
|
||||||
@@ -31,14 +31,4 @@ if (UNIX)
|
|||||||
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
|
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
|
||||||
set(CPACK_PACKAGE_FILE_NAME
|
set(CPACK_PACKAGE_FILE_NAME
|
||||||
"${CPACK_RPM_PACKAGE_NAME}_${CPACK_RPM_PACKAGE_VERSION}_${CPACK_RPM_PACKAGE_ARCHITECTURE}")
|
"${CPACK_RPM_PACKAGE_NAME}_${CPACK_RPM_PACKAGE_VERSION}_${CPACK_RPM_PACKAGE_ARCHITECTURE}")
|
||||||
if(NOT DEFINED ${CPACK_PACKAGING_INSTALL_PREFIX})
|
|
||||||
# Default packaging install prefix on RedHat systems is /usr.
|
|
||||||
# This is the assumed value when this variable is not defined.
|
|
||||||
# There is currently a conflict with
|
|
||||||
# /usr/${CMAKE_INSTALL_LIBDIR}/cmake which is installed by default
|
|
||||||
# by other packages on RedHat (most notably cmake-filesystem). Ensure
|
|
||||||
# that on these systems, flatbuffers does not package this path.
|
|
||||||
# This patch is required for cmake pre-3.17.
|
|
||||||
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/${CMAKE_INSTALL_LIBDIR}/cmake")
|
|
||||||
endif()
|
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|||||||
+1
-29
@@ -1,39 +1,11 @@
|
|||||||
set(VERSION_MAJOR 24)
|
|
||||||
set(VERSION_MINOR 3)
|
|
||||||
set(VERSION_PATCH 25)
|
|
||||||
set(VERSION_COMMIT 0)
|
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
|
||||||
find_program(GIT git)
|
find_program(GIT git)
|
||||||
if(GIT)
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT} describe --tags
|
COMMAND ${GIT} describe
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_DESCRIBE_DIRTY
|
OUTPUT_VARIABLE GIT_DESCRIBE_DIRTY
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
RESULT_VARIABLE GIT_DESCRIBE_RESULT
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(GIT_DESCRIBE_RESULT EQUAL 0)
|
|
||||||
# Test if the most recent Git tag matches the pattern "v<major>.<minor>.<patch>*"
|
|
||||||
if(GIT_DESCRIBE_DIRTY MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+.*")
|
|
||||||
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_DIRTY}")
|
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_DIRTY}")
|
||||||
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_DIRTY}")
|
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_DIRTY}")
|
||||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_DIRTY}")
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_DIRTY}")
|
||||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${GIT_DESCRIBE_DIRTY}")
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${GIT_DESCRIBE_DIRTY}")
|
||||||
# If the tag points to the commit, then only the tag is shown in "git describe"
|
|
||||||
if(VERSION_COMMIT STREQUAL GIT_DESCRIBE_DIRTY)
|
|
||||||
set(VERSION_COMMIT 0)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "\"${GIT_DESCRIBE_DIRTY}\" does not match pattern v<major>.<minor>.<patch>-<commit>")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "git describe failed with exit code: ${GIT_DESCRIBE_RESULT}\nMake sure you cloned with tags or run 'git fetch --tags'.")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "git is not found")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Proceeding with version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_COMMIT}")
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
include("${CMAKE_CURRENT_LIST_DIR}/FlatBuffersTargets.cmake" OPTIONAL)
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL)
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/FlatBuffersSharedTargets.cmake" OPTIONAL)
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/BuildFlatBuffers.cmake" OPTIONAL)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
|
||||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
||||||
|
|
||||||
Name: FlatBuffers
|
|
||||||
Description: Memory Efficient Serialization Library
|
|
||||||
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
|
|
||||||
|
|
||||||
Libs: -L${libdir} -lflatbuffers
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
+191
-427
@@ -1,15 +1,9 @@
|
|||||||
# This is the legacy minimum version flatbuffers supported for a while.
|
cmake_minimum_required(VERSION 2.8)
|
||||||
cmake_minimum_required(VERSION 3.8...3.25.2)
|
|
||||||
|
|
||||||
# Attempt to read the current version of flatbuffers by looking at the latest tag.
|
|
||||||
include(CMake/Version.cmake)
|
|
||||||
|
|
||||||
project(FlatBuffers
|
|
||||||
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
|
||||||
LANGUAGES CXX)
|
|
||||||
|
|
||||||
# generate compile_commands.json
|
# generate compile_commands.json
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
include(CheckCXXSymbolExists)
|
||||||
|
|
||||||
|
project(FlatBuffers)
|
||||||
|
|
||||||
# NOTE: Code coverage only works on Linux & OSX.
|
# NOTE: Code coverage only works on Linux & OSX.
|
||||||
option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF)
|
option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF)
|
||||||
@@ -19,11 +13,7 @@ option(FLATBUFFERS_BUILD_FLATLIB "Enable the build of the flatbuffers library"
|
|||||||
ON)
|
ON)
|
||||||
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler"
|
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler"
|
||||||
ON)
|
ON)
|
||||||
option(FLATBUFFERS_STATIC_FLATC "Build flatbuffers compiler with -static flag"
|
option(FLATBUFFERS_BUILD_FLATHASH "Enable the build of flathash" ON)
|
||||||
OFF)
|
|
||||||
option(FLATBUFFERS_BUILD_FLATHASH "Enable the build of flathash" OFF)
|
|
||||||
option(FLATBUFFERS_BUILD_BENCHMARKS "Enable the build of flatbenchmark."
|
|
||||||
OFF)
|
|
||||||
option(FLATBUFFERS_BUILD_GRPCTEST "Enable the build of grpctest" OFF)
|
option(FLATBUFFERS_BUILD_GRPCTEST "Enable the build of grpctest" OFF)
|
||||||
option(FLATBUFFERS_BUILD_SHAREDLIB
|
option(FLATBUFFERS_BUILD_SHAREDLIB
|
||||||
"Enable the build of the flatbuffers shared library"
|
"Enable the build of the flatbuffers shared library"
|
||||||
@@ -39,47 +29,6 @@ option(FLATBUFFERS_PACKAGE_REDHAT
|
|||||||
option(FLATBUFFERS_PACKAGE_DEBIAN
|
option(FLATBUFFERS_PACKAGE_DEBIAN
|
||||||
"Build an deb using the 'package' target."
|
"Build an deb using the 'package' target."
|
||||||
OFF)
|
OFF)
|
||||||
option(FLATBUFFERS_BUILD_CPP17
|
|
||||||
"Enable the build of c++17 test target. \"
|
|
||||||
Requirements: Clang6, GCC7, MSVC2017 (_MSC_VER >= 1914) or higher."
|
|
||||||
OFF)
|
|
||||||
option(FLATBUFFERS_BUILD_LEGACY
|
|
||||||
"Run C++ code generator with '--cpp-std c++0x' switch."
|
|
||||||
OFF)
|
|
||||||
option(FLATBUFFERS_ENABLE_PCH
|
|
||||||
"Enable precompile headers support for 'flatbuffers' and 'flatc'. \"
|
|
||||||
Only work if CMake supports 'target_precompile_headers'. \"
|
|
||||||
This can speed up compilation time."
|
|
||||||
OFF)
|
|
||||||
option(FLATBUFFERS_SKIP_MONSTER_EXTRA
|
|
||||||
"Skip generating monster_extra.fbs that contains non-supported numerical\"
|
|
||||||
types." OFF)
|
|
||||||
option(FLATBUFFERS_STRICT_MODE
|
|
||||||
"Build flatbuffers with all warnings as errors (-Werror or /WX)."
|
|
||||||
OFF)
|
|
||||||
|
|
||||||
if(NOT DEFINED FLATBUFFERS_CPP_STD)
|
|
||||||
set(FLATBUFFERS_CPP_STD 11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(MSVC_LIKE OFF)
|
|
||||||
if(MSVC OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
|
||||||
set(MSVC_LIKE ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
||||||
set(IS_CLANG ON)
|
|
||||||
else()
|
|
||||||
set(IS_CLANG OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED FLATBUFFERS_COMPILATION_TIMINGS)
|
|
||||||
message("Recording Compilation Timings to ${FLATBUFFERS_COMPILATION_TIMINGS}")
|
|
||||||
file(REMOVE ${FLATBUFFERS_COMPILATION_TIMINGS})
|
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "time -f 'Wall: %E User: %U Sys: %S | %C' -q -a -o ${FLATBUFFERS_COMPILATION_TIMINGS}")
|
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "time -f 'Wall: %E User: %U Sys: %S | %C' -q -a -o ${FLATBUFFERS_COMPILATION_TIMINGS}")
|
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "time -f 'Wall: %E User: %U Sys: %S | %C' -q -a -o ${FLATBUFFERS_COMPILATION_TIMINGS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
||||||
message(WARNING
|
message(WARNING
|
||||||
@@ -95,10 +44,8 @@ endif()
|
|||||||
|
|
||||||
# Auto-detect locale-narrow 'strtod_l' and 'strtoull_l' functions.
|
# Auto-detect locale-narrow 'strtod_l' and 'strtoull_l' functions.
|
||||||
if(NOT DEFINED FLATBUFFERS_LOCALE_INDEPENDENT)
|
if(NOT DEFINED FLATBUFFERS_LOCALE_INDEPENDENT)
|
||||||
include(CheckCXXSymbolExists)
|
|
||||||
|
|
||||||
set(FLATBUFFERS_LOCALE_INDEPENDENT 0)
|
set(FLATBUFFERS_LOCALE_INDEPENDENT 0)
|
||||||
if(MSVC_LIKE)
|
if(MSVC)
|
||||||
check_cxx_symbol_exists(_strtof_l stdlib.h FLATBUFFERS_HAS_STRTOF_L)
|
check_cxx_symbol_exists(_strtof_l stdlib.h FLATBUFFERS_HAS_STRTOF_L)
|
||||||
check_cxx_symbol_exists(_strtoui64_l stdlib.h FLATBUFFERS_HAS_STRTOULL_L)
|
check_cxx_symbol_exists(_strtoui64_l stdlib.h FLATBUFFERS_HAS_STRTOULL_L)
|
||||||
else()
|
else()
|
||||||
@@ -111,41 +58,20 @@ if(NOT DEFINED FLATBUFFERS_LOCALE_INDEPENDENT)
|
|||||||
endif()
|
endif()
|
||||||
add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=$<BOOL:${FLATBUFFERS_LOCALE_INDEPENDENT}>)
|
add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=$<BOOL:${FLATBUFFERS_LOCALE_INDEPENDENT}>)
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
|
|
||||||
if(NOT HAVE_REALPATH)
|
|
||||||
add_definitions(-DFLATBUFFERS_NO_ABSOLUTE_PATH_RESOLUTION)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(FlatBuffers_Library_SRCS
|
set(FlatBuffers_Library_SRCS
|
||||||
include/flatbuffers/allocator.h
|
include/flatbuffers/code_generators.h
|
||||||
include/flatbuffers/array.h
|
|
||||||
include/flatbuffers/base.h
|
include/flatbuffers/base.h
|
||||||
include/flatbuffers/buffer.h
|
|
||||||
include/flatbuffers/buffer_ref.h
|
|
||||||
include/flatbuffers/default_allocator.h
|
|
||||||
include/flatbuffers/detached_buffer.h
|
|
||||||
include/flatbuffers/code_generator.h
|
|
||||||
include/flatbuffers/file_manager.h
|
|
||||||
include/flatbuffers/flatbuffer_builder.h
|
|
||||||
include/flatbuffers/flatbuffers.h
|
include/flatbuffers/flatbuffers.h
|
||||||
include/flatbuffers/flexbuffers.h
|
|
||||||
include/flatbuffers/flex_flat_util.h
|
|
||||||
include/flatbuffers/hash.h
|
include/flatbuffers/hash.h
|
||||||
include/flatbuffers/idl.h
|
include/flatbuffers/idl.h
|
||||||
include/flatbuffers/minireflect.h
|
include/flatbuffers/util.h
|
||||||
include/flatbuffers/reflection.h
|
include/flatbuffers/reflection.h
|
||||||
include/flatbuffers/reflection_generated.h
|
include/flatbuffers/reflection_generated.h
|
||||||
include/flatbuffers/registry.h
|
|
||||||
include/flatbuffers/stl_emulation.h
|
include/flatbuffers/stl_emulation.h
|
||||||
include/flatbuffers/string.h
|
include/flatbuffers/flexbuffers.h
|
||||||
include/flatbuffers/struct.h
|
include/flatbuffers/registry.h
|
||||||
include/flatbuffers/table.h
|
include/flatbuffers/minireflect.h
|
||||||
include/flatbuffers/util.h
|
src/code_generators.cpp
|
||||||
include/flatbuffers/vector.h
|
|
||||||
include/flatbuffers/vector_downward.h
|
|
||||||
include/flatbuffers/verifier.h
|
|
||||||
src/idl_parser.cpp
|
src/idl_parser.cpp
|
||||||
src/idl_gen_text.cpp
|
src/idl_gen_text.cpp
|
||||||
src/reflection.cpp
|
src/reflection.cpp
|
||||||
@@ -154,43 +80,22 @@ set(FlatBuffers_Library_SRCS
|
|||||||
|
|
||||||
set(FlatBuffers_Compiler_SRCS
|
set(FlatBuffers_Compiler_SRCS
|
||||||
${FlatBuffers_Library_SRCS}
|
${FlatBuffers_Library_SRCS}
|
||||||
src/idl_gen_binary.cpp
|
|
||||||
src/idl_gen_text.cpp
|
|
||||||
src/idl_gen_cpp.cpp
|
src/idl_gen_cpp.cpp
|
||||||
src/idl_gen_csharp.cpp
|
|
||||||
src/idl_gen_dart.cpp
|
src/idl_gen_dart.cpp
|
||||||
|
src/idl_gen_general.cpp
|
||||||
src/idl_gen_kotlin.cpp
|
src/idl_gen_kotlin.cpp
|
||||||
src/idl_gen_kotlin_kmp.cpp
|
|
||||||
src/idl_gen_go.cpp
|
src/idl_gen_go.cpp
|
||||||
src/idl_gen_java.cpp
|
src/idl_gen_js_ts.cpp
|
||||||
src/idl_gen_ts.cpp
|
|
||||||
src/idl_gen_php.cpp
|
src/idl_gen_php.cpp
|
||||||
src/idl_gen_python.cpp
|
src/idl_gen_python.cpp
|
||||||
src/idl_gen_lobster.cpp
|
src/idl_gen_lobster.cpp
|
||||||
|
src/idl_gen_lua.cpp
|
||||||
src/idl_gen_rust.cpp
|
src/idl_gen_rust.cpp
|
||||||
src/idl_gen_fbs.cpp
|
src/idl_gen_fbs.cpp
|
||||||
src/idl_gen_grpc.cpp
|
src/idl_gen_grpc.cpp
|
||||||
src/idl_gen_json_schema.cpp
|
src/idl_gen_json_schema.cpp
|
||||||
src/idl_gen_swift.cpp
|
|
||||||
src/file_name_saving_file_manager.cpp
|
|
||||||
src/file_binary_writer.cpp
|
|
||||||
src/file_writer.cpp
|
|
||||||
src/idl_namer.h
|
|
||||||
src/namer.h
|
|
||||||
src/flatc.cpp
|
src/flatc.cpp
|
||||||
src/flatc_main.cpp
|
src/flatc_main.cpp
|
||||||
src/bfbs_gen.h
|
|
||||||
src/bfbs_gen_lua.h
|
|
||||||
src/bfbs_gen_nim.h
|
|
||||||
src/bfbs_namer.h
|
|
||||||
include/flatbuffers/code_generators.h
|
|
||||||
src/binary_annotator.h
|
|
||||||
src/binary_annotator.cpp
|
|
||||||
src/annotated_binary_text_gen.h
|
|
||||||
src/annotated_binary_text_gen.cpp
|
|
||||||
src/bfbs_gen_lua.cpp
|
|
||||||
src/bfbs_gen_nim.cpp
|
|
||||||
src/code_generators.cpp
|
|
||||||
grpc/src/compiler/schema_interface.h
|
grpc/src/compiler/schema_interface.h
|
||||||
grpc/src/compiler/cpp_generator.h
|
grpc/src/compiler/cpp_generator.h
|
||||||
grpc/src/compiler/cpp_generator.cc
|
grpc/src/compiler/cpp_generator.cc
|
||||||
@@ -198,12 +103,6 @@ set(FlatBuffers_Compiler_SRCS
|
|||||||
grpc/src/compiler/go_generator.cc
|
grpc/src/compiler/go_generator.cc
|
||||||
grpc/src/compiler/java_generator.h
|
grpc/src/compiler/java_generator.h
|
||||||
grpc/src/compiler/java_generator.cc
|
grpc/src/compiler/java_generator.cc
|
||||||
grpc/src/compiler/python_generator.h
|
|
||||||
grpc/src/compiler/python_generator.cc
|
|
||||||
grpc/src/compiler/swift_generator.h
|
|
||||||
grpc/src/compiler/swift_generator.cc
|
|
||||||
grpc/src/compiler/ts_generator.h
|
|
||||||
grpc/src/compiler/ts_generator.cc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatHash_SRCS
|
set(FlatHash_SRCS
|
||||||
@@ -214,51 +113,41 @@ set(FlatHash_SRCS
|
|||||||
set(FlatBuffers_Tests_SRCS
|
set(FlatBuffers_Tests_SRCS
|
||||||
${FlatBuffers_Library_SRCS}
|
${FlatBuffers_Library_SRCS}
|
||||||
src/idl_gen_fbs.cpp
|
src/idl_gen_fbs.cpp
|
||||||
tests/evolution_test.cpp
|
|
||||||
tests/flexbuffers_test.cpp
|
|
||||||
tests/fuzz_test.cpp
|
|
||||||
tests/json_test.cpp
|
|
||||||
tests/key_field_test.cpp
|
|
||||||
tests/monster_test.cpp
|
|
||||||
tests/optional_scalars_test.cpp
|
|
||||||
tests/parser_test.cpp
|
|
||||||
tests/proto_test.cpp
|
|
||||||
tests/reflection_test.cpp
|
|
||||||
tests/test.cpp
|
tests/test.cpp
|
||||||
tests/test_assert.h
|
tests/test_assert.h
|
||||||
tests/test_assert.cpp
|
tests/test_assert.cpp
|
||||||
tests/test_builder.h
|
tests/test_builder.h
|
||||||
tests/test_builder.cpp
|
tests/test_builder.cpp
|
||||||
tests/util_test.cpp
|
|
||||||
tests/native_type_test_impl.h
|
tests/native_type_test_impl.h
|
||||||
tests/native_type_test_impl.cpp
|
tests/native_type_test_impl.cpp
|
||||||
tests/alignment_test.h
|
# file generate by running compiler on tests/monster_test.fbs
|
||||||
tests/alignment_test.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
|
||||||
tests/64bit/offset64_test.h
|
# file generate by running compiler on tests/arrays_test.fbs
|
||||||
tests/64bit/offset64_test.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/tests/arrays_test_generated.h
|
||||||
include/flatbuffers/code_generators.h
|
# file generate by running compiler on tests/native_type_test.fbs
|
||||||
src/code_generators.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/tests/native_type_test_generated.h
|
||||||
)
|
|
||||||
|
|
||||||
set(FlatBuffers_Tests_CPP17_SRCS
|
|
||||||
${FlatBuffers_Library_SRCS}
|
|
||||||
tests/test_assert.h
|
|
||||||
tests/test_assert.cpp
|
|
||||||
tests/cpp17/test_cpp17.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatBuffers_Sample_Binary_SRCS
|
set(FlatBuffers_Sample_Binary_SRCS
|
||||||
|
include/flatbuffers/flatbuffers.h
|
||||||
samples/sample_binary.cpp
|
samples/sample_binary.cpp
|
||||||
|
# file generated by running compiler on samples/monster.fbs
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatBuffers_Sample_Text_SRCS
|
set(FlatBuffers_Sample_Text_SRCS
|
||||||
${FlatBuffers_Library_SRCS}
|
${FlatBuffers_Library_SRCS}
|
||||||
samples/sample_text.cpp
|
samples/sample_text.cpp
|
||||||
|
# file generated by running compiler on samples/monster.fbs
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatBuffers_Sample_BFBS_SRCS
|
set(FlatBuffers_Sample_BFBS_SRCS
|
||||||
${FlatBuffers_Library_SRCS}
|
${FlatBuffers_Library_SRCS}
|
||||||
|
src/idl_gen_general.cpp
|
||||||
samples/sample_bfbs.cpp
|
samples/sample_bfbs.cpp
|
||||||
|
# file generated by running compiler on samples/monster.fbs
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatBuffers_GRPCTest_SRCS
|
set(FlatBuffers_GRPCTest_SRCS
|
||||||
@@ -274,25 +163,89 @@ set(FlatBuffers_GRPCTest_SRCS
|
|||||||
tests/test_builder.cpp
|
tests/test_builder.cpp
|
||||||
grpc/tests/grpctest.cpp
|
grpc/tests/grpctest.cpp
|
||||||
grpc/tests/message_builder_test.cpp
|
grpc/tests/message_builder_test.cpp
|
||||||
|
# file generated by running compiler on samples/monster.fbs
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(dbaileychess): Figure out how this would now work. I posted a question on
|
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
|
||||||
# https://stackoverflow.com/questions/71772330/override-target-compile-options-via-cmake-command-line.
|
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
|
||||||
# Append FLATBUFFERS_CXX_FLAGS to CMAKE_CXX_FLAGS.
|
|
||||||
if(DEFINED FLATBUFFERS_CXX_FLAGS)
|
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
|
||||||
message(STATUS "extend CXX_FLAGS with ${FLATBUFFERS_CXX_FLAGS}")
|
# do not apply any global settings if the toolchain
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLATBUFFERS_CXX_FLAGS}")
|
# is being configured externally
|
||||||
|
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
|
||||||
|
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
||||||
|
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
if(CYGWIN)
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||||
|
else(CYGWIN)
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
|
endif(CYGWIN)
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
|
||||||
|
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -faligned-new -Werror=implicit-fallthrough=2")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -Wunused-result -Werror=unused-result -Wunused-parameter -Werror=unused-parameter")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Certain platforms such as ARM do not use signed chars by default
|
||||||
|
# which causes issues with certain bounds checks.
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||||
|
|
||||||
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
|
||||||
|
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
|
||||||
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
|
||||||
|
list(APPEND FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wimplicit-fallthrough" "-Wextra-semi" "-Werror=unused-private-field") # enable warning
|
||||||
|
endif()
|
||||||
|
if(FLATBUFFERS_LIBCXX_WITH_CLANG)
|
||||||
|
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD" OR
|
||||||
|
"${CMAKE_SYSTEM_NAME}" MATCHES "Linux"))
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Certain platforms such as ARM do not use signed chars by default
|
||||||
|
# which causes issues with certain bounds checks.
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||||
|
|
||||||
|
elseif(MSVC)
|
||||||
|
# Visual Studio pedantic build settings
|
||||||
|
# warning C4512: assignment operator could not be generated
|
||||||
|
# warning C4316: object allocated on the heap may not be aligned
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /wd4512 /wd4316")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FLATBUFFERS_CODE_COVERAGE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fprofile-arcs -ftest-coverage")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
||||||
|
|
||||||
function(add_fsanitize_to_target _target _sanitizer)
|
function(add_fsanitize_to_target _target _sanitizer)
|
||||||
if(WIN32)
|
|
||||||
target_compile_definitions(${_target} PRIVATE FLATBUFFERS_MEMORY_LEAK_TRACKING)
|
|
||||||
message(STATUS "Sanitizer MSVC::_CrtDumpMemoryLeaks added to ${_target}")
|
|
||||||
else()
|
|
||||||
# FLATBUFFERS_CODE_SANITIZE: boolean {ON,OFF,YES,NO} or string with list of sanitizer.
|
# FLATBUFFERS_CODE_SANITIZE: boolean {ON,OFF,YES,NO} or string with list of sanitizer.
|
||||||
# List of sanitizer is string starts with '=': "=address,undefined,thread,memory".
|
# List of sanitizer is string starts with '=': "=address,undefined,thread,memory".
|
||||||
if(IS_CLANG OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.9))
|
if((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") OR
|
||||||
|
((${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9"))
|
||||||
|
)
|
||||||
set(_sanitizer_flags "=address,undefined")
|
set(_sanitizer_flags "=address,undefined")
|
||||||
if(_sanitizer MATCHES "=.*")
|
if(_sanitizer MATCHES "=.*")
|
||||||
# override default by user-defined sanitizer list
|
# override default by user-defined sanitizer list
|
||||||
@@ -303,287 +256,117 @@ function(add_fsanitize_to_target _target _sanitizer)
|
|||||||
"-fsanitize${_sanitizer_flags}")
|
"-fsanitize${_sanitizer_flags}")
|
||||||
target_link_libraries(${_target} PRIVATE
|
target_link_libraries(${_target} PRIVATE
|
||||||
"-fsanitize${_sanitizer_flags}")
|
"-fsanitize${_sanitizer_flags}")
|
||||||
set_target_properties(${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
message(STATUS "Sanitizer ${_sanitizer_flags} added to ${_target}")
|
message(STATUS "Sanitizer ${_sanitizer_flags} added to ${_target}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(add_pch_to_target _target _pch_header)
|
if(BIICODE)
|
||||||
# the command is available since cmake 3.16
|
include(biicode/cmake/biicode.cmake)
|
||||||
if(COMMAND target_precompile_headers)
|
return()
|
||||||
target_precompile_headers(${_target} PRIVATE ${_pch_header})
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_source_files_properties(src/util.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
include_directories(grpc)
|
include_directories(grpc)
|
||||||
|
|
||||||
# Creates an interface library that stores the configuration settings that each
|
|
||||||
# target links too. This is a compromise between setting configuration globally
|
|
||||||
# with add_compile_options() and the more targetted target_compile_options().
|
|
||||||
# This way each target in this file can share settings and override them if
|
|
||||||
# needed.
|
|
||||||
add_library(ProjectConfig INTERFACE)
|
|
||||||
target_compile_features(ProjectConfig
|
|
||||||
INTERFACE
|
|
||||||
cxx_std_${FLATBUFFERS_CPP_STD}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Force the standard to be met.
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
# We shouldn't rely on any compiler-extensions to make things work.
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
if(MSVC_LIKE)
|
|
||||||
target_compile_options(ProjectConfig
|
|
||||||
INTERFACE
|
|
||||||
/W4
|
|
||||||
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
|
|
||||||
/WX # Treat all compiler warnings as errors
|
|
||||||
>
|
|
||||||
/wd4512 # C4512: assignment operator could not be generated
|
|
||||||
/wd4316 # C4316: object allocated on the heap may not be aligned
|
|
||||||
/wd4456 # C4456: hides previous local declaration
|
|
||||||
$<$<CXX_COMPILER_ID:Clang>:
|
|
||||||
/D_CRT_SECURE_NO_WARNINGS
|
|
||||||
>
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
target_compile_options(ProjectConfig
|
|
||||||
INTERFACE
|
|
||||||
-Wall
|
|
||||||
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
|
|
||||||
-Werror # Treat all compiler warnings as errors
|
|
||||||
|
|
||||||
-fno-rtti # Disable runtime type information
|
|
||||||
|
|
||||||
$<$<CXX_COMPILER_ID:GNU>:
|
|
||||||
# False positive string overflow
|
|
||||||
# https://github.com/google/flatbuffers/issues/7366
|
|
||||||
-Wno-error=stringop-overflow
|
|
||||||
>
|
|
||||||
>
|
|
||||||
-pedantic
|
|
||||||
-Wextra
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Wold-style-cast
|
|
||||||
-fsigned-char
|
|
||||||
-Wnon-virtual-dtor
|
|
||||||
|
|
||||||
# This isn't working for some reason: $<$<CXX_COMPILER_ID:CLANG>:
|
|
||||||
$<$<BOOL:${IS_CLANG}>:
|
|
||||||
-Wnewline-eof
|
|
||||||
-Wno-unknown-warning-option
|
|
||||||
-Wmissing-declarations
|
|
||||||
-Wzero-as-null-pointer-constant
|
|
||||||
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,3.8>:
|
|
||||||
-Wimplicit-fallthrough
|
|
||||||
-Wextra-semi
|
|
||||||
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
|
|
||||||
-Werror=unused-private-field
|
|
||||||
>
|
|
||||||
>
|
|
||||||
>
|
|
||||||
|
|
||||||
$<$<CXX_COMPILER_ID:GNU>:
|
|
||||||
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.4>:
|
|
||||||
-Wunused-result
|
|
||||||
-Wunused-parameter
|
|
||||||
-Werror=unused-parameter
|
|
||||||
-Wmissing-declarations
|
|
||||||
>
|
|
||||||
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.7>:
|
|
||||||
-Wzero-as-null-pointer-constant
|
|
||||||
>
|
|
||||||
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,7.0>:
|
|
||||||
-faligned-new
|
|
||||||
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
|
|
||||||
-Werror=implicit-fallthrough=2
|
|
||||||
>
|
|
||||||
>
|
|
||||||
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,8.0>:
|
|
||||||
-Wextra-semi
|
|
||||||
>
|
|
||||||
>
|
|
||||||
|
|
||||||
$<$<BOOL:${FLATBUFFERS_CODE_COVERAGE}>:
|
|
||||||
-g
|
|
||||||
-fprofile-arcs
|
|
||||||
-ftest-coverage
|
|
||||||
>
|
|
||||||
)
|
|
||||||
|
|
||||||
if(FLATBUFFERS_CODE_COVERAGE)
|
|
||||||
target_link_options(ProjectConfig
|
|
||||||
INTERFACE
|
|
||||||
-fprofile-arcs
|
|
||||||
-ftest-coverage
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_FLATLIB)
|
if(FLATBUFFERS_BUILD_FLATLIB)
|
||||||
add_library(flatbuffers STATIC ${FlatBuffers_Library_SRCS})
|
add_library(flatbuffers STATIC ${FlatBuffers_Library_SRCS})
|
||||||
|
# CMake > 2.8.11: Attach header directory for when build via add_subdirectory().
|
||||||
# Attach header directory for when build via add_subdirectory().
|
target_include_directories(flatbuffers INTERFACE
|
||||||
target_include_directories(flatbuffers
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
||||||
INTERFACE
|
target_compile_options(flatbuffers PRIVATE "${FLATBUFFERS_PRIVATE_CXX_FLAGS}")
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
||||||
)
|
|
||||||
target_link_libraries(flatbuffers PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
|
||||||
|
|
||||||
if(FLATBUFFERS_ENABLE_PCH)
|
|
||||||
add_pch_to_target(flatbuffers include/flatbuffers/pch/pch.h)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_FLATC)
|
if(FLATBUFFERS_BUILD_FLATC)
|
||||||
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
|
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
|
||||||
if(FLATBUFFERS_ENABLE_PCH)
|
target_compile_options(flatc PRIVATE "${FLATBUFFERS_PRIVATE_CXX_FLAGS}")
|
||||||
add_pch_to_target(flatc include/flatbuffers/pch/flatc_pch.h)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(flatc PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
|
||||||
target_compile_options(flatc
|
|
||||||
PRIVATE
|
|
||||||
$<$<AND:$<BOOL:${MSVC_LIKE}>,$<CONFIG:Release>>:
|
|
||||||
/MT
|
|
||||||
>
|
|
||||||
)
|
|
||||||
|
|
||||||
if(FLATBUFFERS_CODE_SANITIZE AND NOT WIN32)
|
if(FLATBUFFERS_CODE_SANITIZE AND NOT WIN32)
|
||||||
add_fsanitize_to_target(flatc ${FLATBUFFERS_CODE_SANITIZE})
|
add_fsanitize_to_target(flatc ${FLATBUFFERS_CODE_SANITIZE})
|
||||||
endif()
|
endif()
|
||||||
if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
|
if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
|
||||||
set(FLATBUFFERS_FLATC_EXECUTABLE $<TARGET_FILE:flatc>)
|
set(FLATBUFFERS_FLATC_EXECUTABLE $<TARGET_FILE:flatc>)
|
||||||
endif()
|
endif()
|
||||||
if(FLATBUFFERS_STATIC_FLATC AND NOT MSVC)
|
if(MSVC)
|
||||||
target_link_libraries(flatc PRIVATE -static)
|
# Make flatc.exe not depend on runtime dlls for easy distribution.
|
||||||
|
target_compile_options(flatc PUBLIC $<$<CONFIG:Release>:/MT>)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_FLATHASH)
|
if(FLATBUFFERS_BUILD_FLATHASH)
|
||||||
add_executable(flathash ${FlatHash_SRCS})
|
add_executable(flathash ${FlatHash_SRCS})
|
||||||
target_link_libraries(flathash PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_SHAREDLIB)
|
if(FLATBUFFERS_BUILD_SHAREDLIB)
|
||||||
add_library(flatbuffers_shared SHARED ${FlatBuffers_Library_SRCS})
|
add_library(flatbuffers_shared SHARED ${FlatBuffers_Library_SRCS})
|
||||||
target_link_libraries(flatbuffers_shared PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
|
||||||
# FlatBuffers use calendar-based versioning and do not provide any ABI
|
# Shared object version: "major.minor.micro"
|
||||||
# stability guarantees. Therefore, always use the full version as SOVERSION
|
# - micro updated every release when there is no API/ABI changes
|
||||||
# in order to avoid breaking reverse dependencies on upgrades.
|
# - minor updated when there are additions in API/ABI
|
||||||
set(FlatBuffers_Library_SONAME_FULL "${PROJECT_VERSION}")
|
# - major (ABI number) updated when there are changes in ABI (or removals)
|
||||||
set_target_properties(flatbuffers_shared PROPERTIES
|
set(FlatBuffers_Library_SONAME_MAJOR "1")
|
||||||
OUTPUT_NAME flatbuffers
|
set(FlatBuffers_Library_SONAME_FULL "${FlatBuffers_Library_SONAME_MAJOR}.11.0")
|
||||||
SOVERSION "${FlatBuffers_Library_SONAME_FULL}"
|
set_target_properties(flatbuffers_shared PROPERTIES OUTPUT_NAME flatbuffers
|
||||||
|
SOVERSION "${FlatBuffers_Library_SONAME_MAJOR}"
|
||||||
VERSION "${FlatBuffers_Library_SONAME_FULL}")
|
VERSION "${FlatBuffers_Library_SONAME_FULL}")
|
||||||
if(FLATBUFFERS_ENABLE_PCH)
|
|
||||||
add_pch_to_target(flatbuffers_shared include/flatbuffers/pch/pch.h)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(compile_schema SRC_FBS OPT OUT_GEN_FILE)
|
function(compile_flatbuffers_schema_to_cpp_opt SRC_FBS OPT)
|
||||||
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
||||||
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
|
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GEN_HEADER}
|
OUTPUT ${GEN_HEADER}
|
||||||
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --gen-mutable
|
||||||
${OPT}
|
--gen-object-api -o "${SRC_FBS_DIR}"
|
||||||
-o "${SRC_FBS_DIR}"
|
--cpp-ptr-type flatbuffers::unique_ptr # Used to test with C++98 STLs
|
||||||
|
--reflect-names ${OPT}
|
||||||
|
-I "${CMAKE_CURRENT_SOURCE_DIR}/tests/include_test"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
||||||
DEPENDS flatc ${SRC_FBS}
|
DEPENDS flatc)
|
||||||
COMMENT "flatc generation: `${SRC_FBS}` -> `${GEN_HEADER}`"
|
|
||||||
)
|
|
||||||
set(${OUT_GEN_FILE} ${GEN_HEADER} PARENT_SCOPE)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(compile_schema_for_test SRC_FBS OPT)
|
function(compile_flatbuffers_schema_to_cpp SRC_FBS)
|
||||||
compile_schema("${SRC_FBS}" "${OPT}" GEN_FILE)
|
compile_flatbuffers_schema_to_cpp_opt(${SRC_FBS} "--no-includes;--gen-compare")
|
||||||
target_sources(flattests PRIVATE ${GEN_FILE})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(compile_schema_for_samples SRC_FBS OPT)
|
function(compile_flatbuffers_schema_to_binary SRC_FBS)
|
||||||
compile_schema("${SRC_FBS}" "${OPT}" GEN_FILE)
|
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
||||||
target_sources(flatsample PRIVATE ${GEN_FILE})
|
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${GEN_BINARY_SCHEMA}
|
||||||
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -b --schema -o "${SRC_FBS_DIR}"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
||||||
|
DEPENDS flatc)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_TESTS)
|
if(FLATBUFFERS_BUILD_TESTS)
|
||||||
|
compile_flatbuffers_schema_to_cpp(tests/monster_test.fbs)
|
||||||
|
compile_flatbuffers_schema_to_cpp_opt(tests/native_type_test.fbs "")
|
||||||
|
compile_flatbuffers_schema_to_cpp_opt(tests/arrays_test.fbs --scoped-enums)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/tests)
|
||||||
add_executable(flattests ${FlatBuffers_Tests_SRCS})
|
add_executable(flattests ${FlatBuffers_Tests_SRCS})
|
||||||
target_link_libraries(flattests PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
set_property(TARGET flattests
|
||||||
target_include_directories(flattests PUBLIC
|
PROPERTY COMPILE_DEFINITIONS FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
|
||||||
# Ideally everything is fully qualified from the root directories
|
FLATBUFFERS_DEBUG_VERIFICATION_FAILURE=1)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
# TODO(derekbailey): update includes to fully qualify src/ and tests/
|
|
||||||
src
|
|
||||||
tests
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tests
|
|
||||||
)
|
|
||||||
|
|
||||||
# Have tests load data from the source directory, not the build directory.
|
|
||||||
add_definitions(-DFLATBUFFERS_TEST_PATH_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/)
|
|
||||||
|
|
||||||
# The flattest target needs some generated files
|
|
||||||
SET(FLATC_OPT --cpp --gen-mutable --gen-object-api --reflect-names)
|
|
||||||
SET(FLATC_OPT_COMP ${FLATC_OPT};--gen-compare)
|
|
||||||
SET(FLATC_OPT_SCOPED_ENUMS ${FLATC_OPT_COMP};--scoped-enums)
|
|
||||||
|
|
||||||
compile_schema_for_test(tests/alignment_test.fbs "${FLATC_OPT_COMP}")
|
|
||||||
compile_schema_for_test(tests/arrays_test.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
|
||||||
compile_schema_for_test(tests/native_inline_table_test.fbs "${FLATC_OPT_COMP}")
|
|
||||||
compile_schema_for_test(tests/native_type_test.fbs "${FLATC_OPT}")
|
|
||||||
compile_schema_for_test(tests/key_field/key_field_sample.fbs "${FLATC_OPT_COMP}")
|
|
||||||
compile_schema_for_test(tests/64bit/test_64bit.fbs "${FLATC_OPT_COMP};--bfbs-gen-embed")
|
|
||||||
compile_schema_for_test(tests/64bit/evolution/v1.fbs "${FLATC_OPT_COMP}")
|
|
||||||
compile_schema_for_test(tests/64bit/evolution/v2.fbs "${FLATC_OPT_COMP}")
|
|
||||||
compile_schema_for_test(tests/union_underlying_type_test.fbs "${FLATC_OPT_SCOPED_ENUMS}")
|
|
||||||
|
|
||||||
if(FLATBUFFERS_CODE_SANITIZE)
|
if(FLATBUFFERS_CODE_SANITIZE)
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(flattests PRIVATE FLATBUFFERS_MEMORY_LEAK_TRACKING)
|
||||||
|
message(STATUS "Sanitizer MSVC::_CrtDumpMemoryLeaks added to flattests")
|
||||||
|
else()
|
||||||
add_fsanitize_to_target(flattests ${FLATBUFFERS_CODE_SANITIZE})
|
add_fsanitize_to_target(flattests ${FLATBUFFERS_CODE_SANITIZE})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
compile_flatbuffers_schema_to_cpp(samples/monster.fbs)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/samples)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/samples)
|
||||||
|
|
||||||
add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS})
|
add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS})
|
||||||
add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS})
|
add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS})
|
||||||
add_executable(flatsamplebfbs ${FlatBuffers_Sample_BFBS_SRCS})
|
add_executable(flatsamplebfbs ${FlatBuffers_Sample_BFBS_SRCS})
|
||||||
|
|
||||||
# Add a library so there is a single target that the generated samples can
|
|
||||||
# link too.
|
|
||||||
if(MSVC OR ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0")
|
|
||||||
add_library(flatsample INTERFACE)
|
|
||||||
else()
|
|
||||||
add_library(flatsample STATIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Since flatsample has no sources, we have to explicitly set the linker lang.
|
|
||||||
set_target_properties(flatsample PROPERTIES LINKER_LANGUAGE CXX)
|
|
||||||
|
|
||||||
compile_schema_for_samples(samples/monster.fbs "${FLATC_OPT_COMP}")
|
|
||||||
|
|
||||||
target_link_libraries(flatsamplebinary PRIVATE $<BUILD_INTERFACE:ProjectConfig> flatsample)
|
|
||||||
target_link_libraries(flatsampletext PRIVATE $<BUILD_INTERFACE:ProjectConfig> flatsample)
|
|
||||||
target_link_libraries(flatsamplebfbs PRIVATE $<BUILD_INTERFACE:ProjectConfig> flatsample)
|
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_CPP17)
|
|
||||||
add_executable(flattests_cpp17 ${FlatBuffers_Tests_CPP17_SRCS})
|
|
||||||
target_link_libraries(flattests_cpp17 PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
|
|
||||||
target_include_directories(flattests_cpp17 PUBLIC src tests)
|
|
||||||
target_compile_features(flattests_cpp17 PRIVATE cxx_std_17) # requires cmake 3.8
|
|
||||||
|
|
||||||
if(FLATBUFFERS_CODE_SANITIZE)
|
|
||||||
add_fsanitize_to_target(flattests_cpp17 ${FLATBUFFERS_CODE_SANITIZE})
|
|
||||||
endif()
|
|
||||||
endif(FLATBUFFERS_BUILD_CPP17)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_GRPCTEST)
|
if(FLATBUFFERS_BUILD_GRPCTEST)
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-shadow")
|
||||||
|
endif()
|
||||||
if(NOT GRPC_INSTALL_PATH)
|
if(NOT GRPC_INSTALL_PATH)
|
||||||
message(SEND_ERROR "GRPC_INSTALL_PATH variable is not defined. See grpc/README.md")
|
message(SEND_ERROR "GRPC_INSTALL_PATH variable is not defined. See grpc/README.md")
|
||||||
endif()
|
endif()
|
||||||
@@ -592,22 +375,13 @@ if(FLATBUFFERS_BUILD_GRPCTEST)
|
|||||||
endif()
|
endif()
|
||||||
INCLUDE_DIRECTORIES(${GRPC_INSTALL_PATH}/include)
|
INCLUDE_DIRECTORIES(${GRPC_INSTALL_PATH}/include)
|
||||||
INCLUDE_DIRECTORIES(${PROTOBUF_DOWNLOAD_PATH}/src)
|
INCLUDE_DIRECTORIES(${PROTOBUF_DOWNLOAD_PATH}/src)
|
||||||
find_package(Threads REQUIRED)
|
LINK_DIRECTORIES(${GRPC_INSTALL_PATH}/lib)
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${GRPC_INSTALL_PATH})
|
|
||||||
find_package(absl CONFIG REQUIRED)
|
|
||||||
find_package(protobuf CONFIG REQUIRED)
|
|
||||||
find_package(gRPC CONFIG REQUIRED)
|
|
||||||
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
|
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
|
||||||
target_link_libraries(grpctest
|
target_link_libraries(grpctest grpc++_unsecure grpc_unsecure gpr pthread dl)
|
||||||
PRIVATE
|
|
||||||
$<BUILD_INTERFACE:ProjectConfig>
|
|
||||||
gRPC::grpc++_unsecure
|
|
||||||
gRPC::gpr
|
|
||||||
pthread
|
|
||||||
dl
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CMake/Version.cmake)
|
||||||
|
|
||||||
if(FLATBUFFERS_INSTALL)
|
if(FLATBUFFERS_INSTALL)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
@@ -615,24 +389,28 @@ if(FLATBUFFERS_INSTALL)
|
|||||||
|
|
||||||
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
||||||
|
|
||||||
configure_file(CMake/flatbuffers-config-version.cmake.in flatbuffers-config-version.cmake @ONLY)
|
configure_file(CMake/FlatbuffersConfigVersion.cmake.in FlatbuffersConfigVersion.cmake @ONLY)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES "CMake/FlatbuffersConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/FlatbuffersConfigVersion.cmake"
|
||||||
"CMake/flatbuffers-config.cmake"
|
|
||||||
"CMake/BuildFlatBuffers.cmake"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-config-version.cmake"
|
|
||||||
DESTINATION ${FB_CMAKE_DIR}
|
DESTINATION ${FB_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_FLATLIB)
|
if(FLATBUFFERS_BUILD_FLATLIB)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
install(
|
install(
|
||||||
TARGETS flatbuffers EXPORT FlatBuffersTargets
|
TARGETS flatbuffers EXPORT FlatbuffersTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
install(
|
||||||
|
TARGETS flatbuffers EXPORT FlatbuffersTargets
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(EXPORT FlatBuffersTargets
|
install(EXPORT FlatbuffersTargets
|
||||||
FILE FlatBuffersTargets.cmake
|
FILE FlatbuffersTargets.cmake
|
||||||
NAMESPACE flatbuffers::
|
NAMESPACE flatbuffers::
|
||||||
DESTINATION ${FB_CMAKE_DIR}
|
DESTINATION ${FB_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
@@ -653,27 +431,28 @@ if(FLATBUFFERS_INSTALL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_SHAREDLIB)
|
if(FLATBUFFERS_BUILD_SHAREDLIB)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
install(
|
install(
|
||||||
TARGETS flatbuffers_shared EXPORT FlatBuffersSharedTargets
|
TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
install(
|
||||||
|
TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
|
||||||
EXPORT FlatBuffersSharedTargets
|
|
||||||
FILE FlatBuffersSharedTargets.cmake
|
|
||||||
NAMESPACE flatbuffers::
|
|
||||||
DESTINATION ${FB_CMAKE_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_SHAREDLIB OR FLATBUFFERS_BUILD_FLATLIB)
|
|
||||||
configure_file(CMake/flatbuffers.pc.in flatbuffers.pc @ONLY)
|
|
||||||
install(
|
install(
|
||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/flatbuffers.pc"
|
EXPORT FlatbuffersSharedTargets
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
FILE FlatbuffersSharedTargets.cmake
|
||||||
|
NAMESPACE flatbuffers::
|
||||||
|
DESTINATION ${FB_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -681,10 +460,9 @@ endif()
|
|||||||
if(FLATBUFFERS_BUILD_TESTS)
|
if(FLATBUFFERS_BUILD_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
add_test(NAME flattests COMMAND flattests)
|
add_test(NAME flattests COMMAND flattests)
|
||||||
if(FLATBUFFERS_BUILD_CPP17)
|
|
||||||
add_test(NAME flattests_cpp17 COMMAND flattests_cpp17)
|
|
||||||
endif()
|
|
||||||
if(FLATBUFFERS_BUILD_GRPCTEST)
|
if(FLATBUFFERS_BUILD_GRPCTEST)
|
||||||
add_test(NAME grpctest COMMAND grpctest)
|
add_test(NAME grpctest COMMAND grpctest)
|
||||||
endif()
|
endif()
|
||||||
@@ -696,23 +474,9 @@ if(UNIX)
|
|||||||
# Use of CPack only supported on Linux systems.
|
# Use of CPack only supported on Linux systems.
|
||||||
if(FLATBUFFERS_PACKAGE_DEBIAN)
|
if(FLATBUFFERS_PACKAGE_DEBIAN)
|
||||||
include(CMake/PackageDebian.cmake)
|
include(CMake/PackageDebian.cmake)
|
||||||
include(CPack)
|
|
||||||
endif()
|
endif()
|
||||||
if (FLATBUFFERS_PACKAGE_REDHAT)
|
if (FLATBUFFERS_PACKAGE_REDHAT)
|
||||||
include(CMake/PackageRedhat.cmake)
|
include(CMake/PackageRedhat.cmake)
|
||||||
|
endif()
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
# Include for running Google Benchmarks.
|
|
||||||
if(FLATBUFFERS_BUILD_BENCHMARKS)
|
|
||||||
add_subdirectory(benchmarks)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add FlatBuffers::FlatBuffers interface, needed for FetchContent_Declare
|
|
||||||
add_library(FlatBuffers INTERFACE)
|
|
||||||
add_library(FlatBuffers::FlatBuffers ALIAS FlatBuffers)
|
|
||||||
target_include_directories(
|
|
||||||
FlatBuffers
|
|
||||||
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include>)
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user