Compare commits

...

751 Commits

Author SHA1 Message Date
6ab6564d42
fix arch on normal build
Some checks failed
Build and Publish Docker Image / publish (debian) (release) Failing after 21s
Build and Publish Docker Image / publish (alpine) (release) Failing after 3h14m36s
2025-02-15 14:29:51 -05:00
513966056b
remove 2 32bit unsupported arch
Some checks failed
Build and Publish Docker Image / publish (alpine) (release) Failing after 1h38m5s
Build and Publish Docker Image / publish (debian) (release) Failing after 22s
2025-02-15 12:28:08 -05:00
2c91c0c259
update image name
Some checks failed
Build and Publish Docker Image / publish (alpine) (release) Failing after 1m49s
Build and Publish Docker Image / publish (debian) (release) Failing after 21s
2025-02-15 12:21:44 -05:00
Matt Robinson
c59ad69d6a
Correct Docker FromAsCasing warning (#7064) 2025-02-10 19:22:09 +01:00
Alexander Farber
61464fc2bd
Fix no member named 'construct' in 'optional<type-parameter-0-0 &>' error in sol.hpp with Clang 19 (#7098) 2025-01-25 07:09:37 +00:00
Alexander Farber
6f235cca15
Use libtbb-dev/libtbb12 packages in Dockerfile-debian, sort packages alphabetically in both Dockerfiles (#7095)
* - Use libtbb-dev in builder stage and libtbb12 package in the runstage instead of building oneTBB v2021.12.0 from source code
- Remove wget package from builder stage, because it is not used
- Uppercase "FROM ... as" -> "FROM ... AS" to silence a "docker build" warning
- Sort packages alphabetically and put them on separate lines for easier comparison

* - Fix the warning "FromAsCasing: 'as' and 'FROM' keywords' casing do not match"
- Sort packages alphabetically and put them on separate lines for easier comparison

* Revert  -Wno-stringop-overflow

* Update the link to multi staged builds in the comment

* Update alpine:3.20.0 -> alpine:3.20.5
2025-01-12 16:28:56 +00:00
Siarhei Fedartsou
3614af7f64
Use std::string_view for key type in json::Object (#7062) 2024-11-03 18:23:23 +01:00
Siarhei Fedartsou
48e8382785
Remove unused bearing::get function (#7040)
* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function
2024-10-20 19:46:49 +02:00
Frédéric Rodrigo
becfd8a56d
Add optional support of cargo bike exclusion and width to bicyle profile (#7044) 2024-10-01 15:19:44 +03:00
Siarhei Fedartsou
4f1c62a768
Bump version of protozero to 1.7.1 (#6999) 2024-09-28 20:35:20 +02:00
Siarhei Fedartsou
09a716a9e5
Bump osmium to version 2.20.0 (#6997) 2024-09-28 20:35:05 +02:00
Siarhei Fedartsou
676f6d4704
Use std::popcount instead of __builtin_popcount (#7026) 2024-09-28 20:34:39 +02:00
Siarhei Fedartsou
f636dbfd44
Use std::countl_zero instead of __builtin_clzll (#7025) 2024-09-28 20:34:23 +02:00
Siarhei Fedartsou
5f67e715af
Add std::vector<...>::reserve in ContiguousInternalMemoryDataFacadeBase::GetOverridesThatStartAt (#7024) 2024-09-28 20:33:33 +02:00
Siarhei Fedartsou
203314b1aa
Remove unused middle_nodes_table vector (#7012) 2024-08-03 22:32:37 +02:00
Siarhei Fedartsou
e5e25a1aca
Configure self-hosted runner for benchmarks job (#6975) 2024-07-26 21:19:47 +02:00
Siarhei Fedartsou
84f12c7c6d
Add NodeJs bindings benchmarks (#7004) 2024-07-26 19:36:43 +02:00
Siarhei Fedartsou
7802f86bd6
Measure peak RAM in benchmarks (#6995) 2024-07-25 21:27:37 +02:00
Siarhei Fedartsou
43afec3b39
Move flatbuffers non-generated files back to include/engine/api/flatbuffers/ (#6996) 2024-07-13 13:43:56 +02:00
Dennis Luxen
2da7ca5338
Route pedestrians over highway=platform (#6993) 2024-07-12 20:12:19 +02:00
Dennis Luxen
8ae9abaa63
Fix parsing on feature files on other gherkin parser (#6992) 2024-07-12 17:35:44 +02:00
Siarhei Fedartsou
d3638ace59
Use thread_local instead of boost::thread_specific_ptr (#6991) 2024-07-11 23:53:22 +02:00
Siarhei Fedartsou
c2f877eb9d
Remove unused MapStorage and GenerationArrayStorage (#6990) 2024-07-11 23:10:14 +02:00
Siarhei Fedartsou
825132eec7
Bump flatbuffers to v24.3.25 version (#6968) 2024-07-10 20:44:36 +02:00
Dennis Luxen
7436835244
Remove corech options, redundant tests (#6989)
* Remove corech options, redundant tests

* Small fix
2024-07-10 16:28:07 +02:00
Siarhei Fedartsou
5e6fdda16b
Add NOTE: label to comment in stale.yml (#6987) 2024-07-09 21:27:46 +02:00
Siarhei Fedartsou
f5598efcff
Add .reserve(...) to assembleGeometry function (#6983) 2024-07-09 20:12:47 +02:00
Siarhei Fedartsou
ab771c6142
Do not trigger stale bot on each PR (#6986) 2024-07-09 19:58:03 +02:00
Siarhei Fedartsou
f1510b758d
Increase number of GitHub operations allowed in stale bot (#6985) 2024-07-09 19:32:03 +02:00
Siarhei Fedartsou
4930d2ef05
Use clang 18/17/16 instead of 15/14/13 (#6978) 2024-07-03 20:02:44 +02:00
Siarhei Fedartsou
57b792c768
Get rid of boost::optional leftovers (#6977) 2024-07-02 22:37:09 +02:00
Siarhei Fedartsou
d0ed29adb7
Use Link Time Optimisation whenever possible (#6967) 2024-06-30 21:07:49 +02:00
Siarhei Fedartsou
bdc6ed8a53
Use struct instead of tuple to define UnpackedPath (#6974) 2024-06-29 21:34:43 +02:00
Siarhei Fedartsou
93c0e1dab3
Micro performance optimisation in map matching (#6976) 2024-06-29 19:59:08 +02:00
Siarhei Fedartsou
cacb1b23f9
Fix calculation of best ops/sec in benchmarks (#6973) 2024-06-29 10:31:23 +02:00
Siarhei Fedartsou
0e17869e21
Re-use priority queue in StaticRTree (#6952) 2024-06-25 18:58:48 +02:00
Siarhei Fedartsou
5a48ce85b3
Use tmpfs for running benchmarks (#6966) 2024-06-25 17:49:41 +02:00
Siarhei Fedartsou
7d72dfebf7
Optimise encodePolyline function (#6940) 2024-06-22 20:04:32 +02:00
Siarhei Fedartsou
3d01d96036
Avoid reallocations in base64 encoding (#6951) 2024-06-22 08:50:18 +02:00
Siarhei Fedartsou
e8da3d9231
Calculate confidence interval for benchmark measurements (#6950) 2024-06-21 21:43:27 +02:00
Siarhei Fedartsou
d9ce9cf780
Get rid of unused Boost dependencies (#6960) 2024-06-21 19:04:34 +02:00
Siarhei Fedartsou
3285ce3b2f
Configure stale bot (#6963) 2024-06-21 08:51:56 +02:00
Dennis Luxen
f1eabc3ecc
Replace boost::filesystem with std (#6432) 2024-06-20 21:44:28 +02:00
knowname
c3f2a6cdb9
Add CI job for building Alpine-based Docker image (#6959) 2024-06-20 09:08:57 +02:00
knowname
97f676d5a3
add alpine dockerfile (#6958) 2024-06-19 14:15:23 +02:00
Siarhei Fedartsou
7ffc08be28
Bump versions of TBB, Expat and Lua installed via Conan (#6957) 2024-06-19 07:46:56 +02:00
Siarhei Fedartsou
feb9389436
Apply micro-optimisation for Table & Trip APIs (#6949) 2024-06-15 18:57:26 +02:00
Siarhei Fedartsou
a0eda3e7d7
Apply micro-optimisation for Route API (#6948) 2024-06-15 18:56:40 +02:00
Siarhei Fedartsou
7652f6ca6b
Apply micro-optimisation for Match API (#6945) 2024-06-14 16:04:19 +02:00
Siarhei Fedartsou
aa4e6b1cf3
Apply micro-optimisation for Nearest API (#6944) 2024-06-13 18:18:36 +02:00
Siarhei Fedartsou
de2f392960
Avoid copy of intersection in totalTurnAngle (#6938) 2024-06-10 22:40:37 +02:00
Siarhei Fedartsou
0188d2bccd
Use std::unordered_map::emplace instead of operator[] when producing JSONs (#6936) 2024-06-10 21:29:31 +02:00
Siarhei Fedartsou
054161fc7e
Avoid copy of vectors in MakeRoute function (#6939) 2024-06-10 20:06:43 +02:00
Siarhei Fedartsou
89435aa87f
Add new randomized benchmarks (#6929) 2024-06-09 17:03:24 +02:00
Siarhei Fedartsou
0cbb23abe1
Fix Windows CI: update conan.cmake and disable unit tests as temporary workaround for OOM issues (#6930) 2024-06-09 09:24:02 +02:00
Siarhei Fedartsou
a2915f78c5
Make e2e benchmarks more stable (#6927) 2024-06-08 22:27:12 +02:00
Siarhei Fedartsou
99cb17aed3
Fix bugprone-unused-return-value clang-tidy warning (#6934) 2024-06-08 14:33:24 +02:00
Siarhei Fedartsou
8fd8d0c24a
Fix performance-noexcept-move-constructor clang-tidy warning (#6933) 2024-06-08 08:33:54 +02:00
Siarhei Fedartsou
c57b0d28b0
Fix performance-noexcept-swap clang-tidy warning (#6931) 2024-06-07 16:18:10 +02:00
Siarhei Fedartsou
523ee762f0
Upgrade to clang-tidy 18 (#6919) 2024-06-06 22:20:38 +02:00
Siarhei Fedartsou
feeed75cf1
Add simple benchmarks for osrm-* tools (#6925) 2024-06-06 21:01:34 +02:00
Siarhei Fedartsou
c7ee1a59eb
Implement end to end benchmark (#6910) 2024-06-05 21:39:10 +02:00
Dennis Luxen
2725202771
Use Lemire's fast check whether to escape a JSON string (#6923) 2024-05-31 19:58:57 +02:00
Siarhei Fedartsou
42fafdcdfe
Use custom struct instead of std::pair in QueryHeap (#6921) 2024-05-31 07:06:58 +02:00
Siarhei Fedartsou
c8de759cd6
Use std::string_view::starts_with instead of boost::starts_with (#6918) 2024-05-30 21:55:25 +02:00
Siarhei Fedartsou
fb9d1cefcc
Get rid of boost::math::constants::* and M_PI in favor of std::numbers (#6916) 2024-05-30 19:40:56 +02:00
Dennis Luxen
a9b1bd88d3
Remove all core-CH left-overs (#6920)
* Remove all core-CH left-overs

* Fix formatting

* Update CHANGELOG.md
2024-05-30 17:13:44 +02:00
Siarhei Fedartsou
1ff096ac5c
Make constants in PackedVector constexpr (#6917) 2024-05-30 15:12:42 +02:00
Dennis Luxen
0ea757ed02
Remove unused header file (#6913) 2024-05-29 09:13:13 +02:00
Dennis Luxen
42cbca0ff0
Move Sol2 to canonical path (#6912) 2024-05-28 21:23:51 +02:00
Siarhei Fedartsou
c1ed73126d
Use std::variant instead of mapbox::util::variant (#6903) 2024-05-28 18:52:49 +02:00
Siarhei Fedartsou
01b1673c8a
Fix CCache usage in GitHub Actions (#6911) 2024-05-28 08:43:23 +02:00
Siarhei Fedartsou
d4dc297f75
Add CI job with GCC 14 (#6905) 2024-05-27 09:31:13 +02:00
Siarhei Fedartsou
9aaab7a53f
Enable readability-container-contains clang-tidy check (#6909) 2024-05-27 08:33:26 +02:00
Siarhei Fedartsou
1a6f4c44e7
Fix performance-type-promotion-in-math-fn clang-tidy warning (#6908) 2024-05-27 08:33:05 +02:00
Siarhei Fedartsou
163a2cfe3c
Bump rapidjson version (#6906) 2024-05-27 08:31:59 +02:00
Siarhei Fedartsou
667fd198ac
Use the latest Debian version in Dockerfile (#6904) 2024-05-27 08:30:44 +02:00
Siarhei Fedartsou
b7a990d0b5
Use C++20 (#6877) 2024-05-25 18:25:13 +02:00
Dennis Luxen
8306ed8ae3
Remove superflous iostreams include from header files (#6901) 2024-05-25 09:17:45 +02:00
Dennis Luxen
640df69aa1
Remove dead CRC32 processor code (#6900) 2024-05-24 22:43:03 +02:00
Siarhei Fedartsou
8b48e2ccc6
Bump mapbox/variant to version 1.2.0 (#6898) 2024-05-24 20:39:45 +02:00
Dennis Luxen
babdced52f
Replace GCC-specific attribute with [[nodiscard]] attribute (#6899) 2024-05-24 20:34:04 +02:00
Siarhei Fedartsou
21607e0cb2
Optimise getNetworkDistance in MLD even more (#6884) 2024-05-23 20:46:13 +02:00
Dennis Luxen
24646aada9
Remove outdated warnings (#6894) 2024-05-23 19:39:00 +02:00
Dennis Luxen
51b74a99aa
Avoid copy of std::function-based callback in path unpacking (#6895)
* Avoid copy of std::function-based callback in path unpacking

* Fix formatting

* Update CHANGELOG.md
2024-05-23 18:51:51 +02:00
Dennis Luxen
ed5003b502
Upgrade CI actions to latest versions (#6893)
* Upgrade actions

* Update remaining actions

* Update CHANGELOG.md

* Update CHANGELOG.md
2024-05-23 14:40:47 +02:00
Dennis Luxen
46dc660801
Replace boost::hash by std::hash (#6892)
* Replace boost::hash by std::hash

* Fix formatting

* Update CHANGELOG.md
2024-05-23 14:35:56 +02:00
Siarhei Fedartsou
73fb53cf36
Add benchmark for route (#6890) 2024-05-23 14:27:43 +02:00
Mugr Rex
efe6840d08
Replace boost::optional with std::optional (#6611) 2024-05-22 14:58:07 +02:00
Siarhei Fedartsou
d259848456
Optimise R-tree queries in the case of map matching (#6881) 2024-05-20 12:32:40 +02:00
Siarhei Fedartsou
8a82d3929c
Improve map matching benchmark (#6885) 2024-05-20 11:15:55 +02:00
Siarhei Fedartsou
89fce286a7
Fix benchmark script for the case if PR has empty description (#6887) 2024-05-20 09:16:53 +02:00
Siarhei Fedartsou
11c7ddc84d
Fix failing gcc-13 based CI jobs (#6886)
* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs

* Attempt to fix failing CI on gcc-13 jobs
2024-05-19 19:30:24 +02:00
Siarhei Fedartsou
54e50a67a8
Add benchmarks comparison job (#6880) 2024-05-14 17:14:59 +02:00
Bart Louwers
c00c157479
Replace dead link with archive.org link (#6882) 2024-05-14 11:49:49 +02:00
Siarhei Fedartsou
ee8e0f890a
Optimise path distance calculation in MLD map matching (#6876) 2024-05-11 16:30:43 +02:00
Dennis Luxen
1e2ffee97c
Update Makefile: fix typo (#6878) 2024-05-11 09:13:17 +02:00
Michael Bell
ffc39b8ad2
Clarify use of forcing routing steps (#6866)
The change clarifies the conditions for forcing routing steps and
simplifies the codebase to support it.

- Makes explicity  the search runtime condition for forcing a routing
step. Namely, the node is a source of the forward and reverse searches,
and it's one of the pre-identified nodes that requires a step to
be forced.
- Consolidate the two lists of force nodes into one. Not only is there
no algorithmic value in separating the nodes by geometric direction,
the  improvements to via-routes with u-turns mean atleast one of these
lists will be empty for any search.
- Rename 'force loop' to 'force step'. This moves the code away
from the original CH-specific language for checking for self-loops
in the case where this condition is met. MLD does not have loops.

Additional cucumber tests are added to cover the logic related to
negative search weights and forcing routing steps on via-route
paths.
2024-05-10 22:00:24 +01:00
Dennis Luxen
70969186f6
Migrate GCC CI jobs to run on GCC 11, 12, and 13 (#6865) 2024-05-10 20:38:32 +02:00
Dennis Luxen
dff76d31d5
Remove dead code branches (#6875) 2024-05-10 20:21:41 +02:00
Siarhei Fedartsou
3254686933
Use M1 runner to build arm64 macOS builds (#6868) 2024-05-08 21:08:11 +02:00
Siarhei Fedartsou
a6dfff725b
Configure GitHub Actions concurrency (#6870) 2024-05-08 10:06:04 +02:00
Dennis Luxen
10237b8761
Update vendored vtzero dependency to v1.1.0 (#6871) 2024-05-07 22:19:48 +02:00
Dennis Luxen
79de092bb2
Upgrade fmt dependency to v10.2.1 (#6869)
* Put fmt into version agnostic subdir

* Add fmt to dependency update script

* Remove manually added fmt

* Squashed 'third_party/fmt/' content from commit e69e5f977

git-subtree-dir: third_party/fmt
git-subtree-split: e69e5f977d458f2650bb346dadf2ad30c5320281
2024-05-07 20:55:55 +02:00
Dennis Luxen
82aa369db3
Remove dead code modernization script (#6863) 2024-05-06 19:09:10 +02:00
Dennis Luxen
0583582772
Remove include that breaks compilation for Boost v1.85.0 (#6856)
* Remove include that breaks compilation for Boost v1.85.0

* Update CHANGELOG.md

* Fix typo

* Fix issues found by newer clang-tidy version

* Add include to boost filesystem to satisfy Windows compiler
2024-05-06 18:52:40 +02:00
Dennis Luxen
99809e105c
Upgrade clang compiler in CI builds (#6861) 2024-05-06 18:12:17 +02:00
Dennis Luxen
6d361ced41
Set Windows build to quiet (#6862)
The normal flag generates 290 megabytes of log output for a regular build. Setting it to quiet will reduce this and still print errors.
2024-05-06 17:31:58 +02:00
Dennis Luxen
790fa901c7
Remove stale AppVeyor files (#6860)
* Drop left-overs from deprecated AppVeyor CI build

* Update CHANGELOG.md
2024-05-06 13:48:24 +02:00
Dennis Luxen
7f9d591ab7
Upgrade clang-format to version 15 (#6859) 2024-05-06 09:14:46 +02:00
Michael Bell
b503e96a98
Remove force-loop checks for routes with u-turns (#6858)
Each leg of a via-route supporting u-turns does not need to consider
force-loops. Negative weight checks are sufficient to prevent
incorrect results when waypoints are on the same edge.
2024-05-05 21:56:01 +01:00
Dennis Luxen
d691af4860
Remove outdated/deprecated CMake policy (#6854) 2024-05-05 22:08:40 +02:00
Dennis Luxen
befd9dc5ae
Merge pull request #6857 from DennisOSRM/upgrade_js_dependencies
Drop support for NodeJS <= v16
2024-05-05 20:29:16 +02:00
Dennis Luxen
4968d7f9d9 Disable codecov.io upload run since it consistently fails 2024-05-05 16:40:21 +02:00
Dennis Luxen
c26f0612d1 Fix typo 2024-05-05 15:24:56 +02:00
Dennis Luxen
de41299eda Update CHANGELOG.md 2024-05-05 15:03:12 +02:00
Dennis Luxen
c37bbfd07a Migrate GitHub actions from {16, 18} to {28, 20} 2024-05-05 15:01:41 +02:00
Dennis Luxen
0fd1fb2904 Update minimum NodeJS dependency to 18 2024-05-05 14:51:56 +02:00
Matthew Wigginton Bhagat-Conway
7ebd21f39e
pass flags into process_segment (#6658)
* pass flags into process_segment

---------

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-04-06 09:27:42 +01:00
Michael Bell
8ef366e061
Add support for opposite approach request parameter (#6842)
* Added approach on the opposite side of the road.

* Additional test and docs coverage for opposite approach

---------

Co-authored-by: Aleksandrs Saveljevs <Aleksandrs.Saveljevs@gmail.com>
2024-04-03 19:59:15 +01:00
rezashokry
367933fc1a
Fix manuever overrides finding bug (#6739)
* sort manuever overrides vector after partition

---------

Co-authored-by: rshokri <reza.shokri@tapsi.cab>
Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-24 21:48:28 +00:00
Damiaan Twelker
c28ba66039
Increment feature id in tile speed layer (#6726)
* actually increment feature id in tile speed layer

---------

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-24 21:23:36 +00:00
Michael Bell
d0e3e2af23
Extract prerelease/build information from package semver (#6839)
* Extract prerelease/build information from package semver

Currently we only extract the major.minor.patch identifiers from
the semver label stored in package.json.

This leads to version information in executables incorrectly
reporting a release version is running on prereleases and special builds.

This commit is a quickfix to extract this information and report it
in version strings.

CMake regex parsing is not sophisticated enough to handle the full semver
regex, so we might need to explore other CMake modules if we want to
strictly parse the label.
2024-03-24 18:33:07 +00:00
martin
8526cc7d45
Replace deprecated std::is_pod (#6717)
* Replace deprecated std::is_pod
2024-03-17 11:49:55 +00:00
Trivikram Kamat
016440fc7e
Remove unused AWS SDK for JavaScript v2 (#6730) 2024-03-17 11:37:51 +00:00
Monday
6e77d53946
Correctly handle compressed traffic signals (#6724)
Unidirectional traffic signal segments are currently not compressed.
This means traffic signals which are not on turns can be missed and
not applied the correct penalty.

This commit changes this behaviour to correctly handle the graph
compression. Additional tests are added to ensure there is no
regression for other cases (turns, restrictions).

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-17 11:32:10 +00:00
Frédéric Rodrigo
99875b4d24
Set Maxspeed for Philippines (#6776) 2024-03-16 11:35:25 +00:00
Michael Bell
c315a586f7
Delete .github/ISSUE_TEMPLATE/question.md (#6827)
With Discussions now enabled, remove the question issue template to encourage Q&A interaction in the more appropriate place.
2024-03-15 09:35:09 +00:00
Daniel Spasojevic
69c38401bc
Update osrm-backend-docker link to point to github hosted repo (#6831) 2024-03-15 10:29:39 +01:00
Michael Bell
e219eb9442
Pin Conan revisions correctly (#6828)
* Pin Conan revisions correctly

Conan dependencies are not pinned correctly. This means we're
pulling in a newer onetbb recipe that no longer has a shared
library option.

Following other examples of how to pin revisions with cmake
for conan v1, we correctly pin the expected revisions.

Longer term we should look into
- upgrading to conan v2
- defining the conan config separately from cmakelists.txt
- understanding the need for disabling onetbb shared library support

but for the purposes of reviving CI, this will be sufficient.

* Fix macos CI builds
2024-03-15 09:27:59 +00:00
Daniel Patterson
31e31a63d0
Fix some compilation issues on modern macOS systems (#6709)
* Fix various compiler warnings generated by Apple clang 15, and workaround some boost 1.8 bugs

* Fix formatting.
2023-10-12 23:04:39 +02:00
danieldegroot2
b437ce5b33
Update debug_way.lua (#6713) 2023-10-12 23:03:35 +02:00
Frédéric Rodrigo
5723eaaa6a
Added motorway speed limits for Bulgaria (original fix by pl71) (#6698) 2023-09-13 22:01:36 +02:00
Frédéric Rodrigo
0f7b86b099
Install data directory (geojson files) like the profiles directory (#6699) 2023-09-13 22:01:06 +02:00
fenwuyaoji
14dcf91812
add keepalive_timeout flag (#6674)
* add keepalive_timeout flag
2023-08-30 19:06:39 +01:00
Lasse Liehu
d234c7246c
Don't route on proposed ways (#6615) 2023-08-20 10:17:30 +01:00
Whytro
3f9347cfb2
Fix operator overload on RouteParameters (#6646)
* Fix operator overload on RouteParameters
2023-08-19 21:48:15 +01:00
Michael Bell
db7946d762
Add support for disabling feature datasets (#6666)
This change adds support for disabling datasets, such that specific
files are not loaded into memory when running OSRM. This enables users
to not pay the memory cost for features they do not intend to use.

Initially, there are two options:
- ROUTE_GEOMETRY, for disabling overview, steps, annotations and waypoints.
- ROUTE_STEPS, for disabling steps only.

Attempts to query features for which the datasets are disabled will
lead to a DisabledDatasetException being returned.
2023-08-04 18:43:37 +01:00
Michael Bell
522d0f066e
Add 'load directly' mode to default Cucumber test suite (#6664)
Currently `npm test` runs the Cucumber suite with a matrix
configuration for selecting the algorithm (CH, MLD) and data loading
(shared-memory, mmap) options.

However, there is a third data loading option, 'load directly',
which is to directly load the datasets into the osrm-routed process memory.

The code paths for each data loading option are distinct:

Storage::Run + SharedMemoryAllocator
MMapMemoryAllocator
ProcessMemoryAllocator

This commit adds direct data loading as part of the Cucumber
configuration matrix.

This will ensure optional dataset support can be added without any
regressions.
2023-08-01 09:24:51 +01:00
Michael Bell
3bb82ce1e2
Minor fixes (#6655)
* Ensure required file check in osrm-routed is correctly enforced.

The storage module had a stricter check. This keeps the IOConfig
check in sync.

* Correct HTTP docs to reflect summary output dependency on steps parameter.

There is no summary parameter.

* npm audit fix
2023-07-18 20:23:23 +01:00
Debarshi Kundu
62e11fd5db
Corrected README with 'echo' command (#6638) 2023-06-13 10:07:15 +02:00
Brad Smith
503d558e90
Fix building on OpenBSD (#6637)
Only utilize librt if its presence is detected.
2023-06-06 07:04:51 +02:00
Lasse Liehu
af59a9cfae
Fix build with GCC 13 (#6632)
Building with GCC 13 failed because for example std::int32_t
was not found. Porting guide [1] suggested to add explicit includes
for <cstdint> if necessary, so did just that.

[1]: https://gcc.gnu.org/gcc-13/porting_to.html
2023-05-31 07:53:04 +02:00
Whytro
72da455185
Allow -1.0 as unlimited for default_radius value (#6599) 2023-05-31 07:52:35 +02:00
Al
0ca913132a
Added block_counter variable to a preprocessor check, minor bug. (#6596) 2023-04-16 23:22:30 +02:00
Nils
134da91fa8
keep libosrm* (#6602) 2023-04-15 16:27:51 +02:00
Whytro
d51631401e
Add support for a default_bearing_radius flag (#6575) 2023-03-24 16:49:33 +01:00
Matthew Wigginton Bhagat-Conway
d6afe91d8f
print tracebacks and line numbers for Lua runtime errors (#6564)
* print tracebacks and line numbers for Lua runtime errors

* revert format changes

* update changelog with lua traceback, #6564

* revert using protected_function for old GetStringListFromFunction and source_function #6564

* add unit test for line numbers in tracebacks, #6564

* apply clang-format (#6564)

* remove unused test helper function, #6564

* suppress leaksanitizer warnings in extract-tests, #6564

When the extractor encounters a lua runtime error, some osmium objects are not freed. In production this doesn't matter because these errors bring down OSRM. In the tests we catch them to ensure they occur, and the leaksanitizer flags them.
2023-03-23 19:18:58 +01:00
Pratik Rajput
192d077ada
Addressing grammatical nits and fixing typo in testing.md (#6550) 2023-03-15 17:16:51 +01:00
Samuel Brucksch
82b73ed9ab
fix oneway handling in get_forward_backward_by_key (#6569) 2023-03-09 17:48:15 +01:00
Jingchen Ye
0e7c3d8ad4
Move TarjanSCC from extractor to util (#6562) 2023-03-09 17:47:28 +01:00
Pratik Rajput
a63ba91c8f
Fix typo in api.md (#6567)
* Fix typo in api.md

Signed-off-by: Pratik <pratikrajput1199@gmail.com>
Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com>
2023-03-09 17:10:42 +01:00
Patrick Fitzgerald
51e04209e3
Fixing discord link (#6536) 2023-02-10 15:28:34 +01:00
Pratik Rajput
56ed2cb196
Fixed typo in profiles.md (#6538) 2023-02-10 15:28:02 +01:00
zephyr
ebd9ab4548
fix(json_render): json_render is not accurate enough for extremely sm… (#6531) 2023-02-02 18:58:25 +01:00
Siarhei Fedartsou
376282d946
Update README.md (#6529) 2023-01-29 09:56:02 +01:00
Pratik Rajput
53295760ac
Fixed typo and grammatical mistakes in developing.md (#6520) 2023-01-28 00:22:29 +01:00
Jeremiah
e590dae5f6
Fix boost header deprecation warning (#6515) 2023-01-21 08:47:05 +01:00
Samuel Brucksch
d9df33dd0a
fix typo (#6491) 2023-01-11 00:46:42 +01:00
Dennis Luxen
95c4523987
Merge pull request #6480 from Project-OSRM/nested_namespace
Nested namespace
2022-12-21 18:27:13 +01:00
Dennis Luxen
26987f9049 Fix conditionally built tool 2022-12-21 15:52:09 +01:00
Dennis Luxen
7c06726a35 Fix formatting 2022-12-20 18:00:11 +01:00
Dennis Luxen
d7c44f0bc0 Merge remote-tracking branch 'origin/master' into nested_namespace 2022-12-11 10:25:13 +01:00
Dennis Luxen
a4aa153ba4 Use nested namespace
It's a mechanical change to modernize the code base
2022-12-11 10:17:17 +01:00
Dennis Luxen
1204b746d5
Merge pull request #6477 from Project-OSRM/update_cmakelists
Update CMakeLists
2022-12-11 10:15:41 +01:00
Dennis Luxen
076cbd7018
Merge pull request #6479 from Project-OSRM/dl_fix_cmake_warning
Fix CMake warning
2022-12-11 10:15:33 +01:00
Dennis Luxen
afd340da44
Merge pull request #6478 from Project-OSRM/dluxen_less_dependencies
Less dependencies by inner sourcing cheap-ruler
2022-12-11 10:15:14 +01:00
Dennis Luxen
898cbe8da4 Install PkgConfig on Docker build image 2022-12-10 21:50:24 +01:00
Dennis Luxen
16c6f23791 Fix CMake warning
CMake Warning (dev) at /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (Lua).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake-3.24/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  cmake/FindLua.cmake:39 (include)
  CMakeLists.txt:571 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.
2022-12-10 20:50:32 +01:00
Dennis Luxen
612ca82a06 Fix formatting 2022-12-10 20:01:16 +01:00
Dennis Luxen
1215062e4c Port the used bits from CheapRuler, drop dependencies 2022-12-10 19:54:51 +01:00
Dennis Luxen
5292172770 One more place where version is listed 2022-12-10 18:58:25 +01:00
Dennis Luxen
6e5f0d74bd Use cmake 3.18 instead of 3.20 because of debian support 2022-12-10 18:50:37 +01:00
Dennis Luxen
5bab68c737 Update CMakeLists
- remove GOLD linker special case handling
- bump minimum cmake version to 3.20
- simplify LTO detection
- remove outdated way to check for compiler flags
- remove outdated compiler version gates (rely on CXX version)
- remove outdated Apple platform handling
- disable compiler-specific CXX extensions
- require boost 1.70 in all builds
- remove unused variable
2022-12-10 18:25:58 +01:00
Dennis Luxen
152a52bc1a
Merge pull request #6444 from Project-OSRM/dl_using_keyword
[CPP17] Modernize: Replace typedef with using statements
2022-12-10 18:14:43 +01:00
Dennis Luxen
c605b1db38 Fix typo 2022-12-10 16:28:03 +01:00
Dennis Luxen
f4189d9487 Fix formatting 2022-12-10 16:08:22 +01:00
Dennis Luxen
f983d626ac Merge remote-tracking branch 'origin/master' into dl_using_keyword 2022-12-10 16:02:53 +01:00
Siarhei Fedartsou
73b2a86a95
Move vector in CSVFilesParser instead copying it (#6470) 2022-12-03 17:53:56 +01:00
Siarhei Fedartsou
2044398dfd
Add CI job which builds OSRM with gcc 12 (#6455) 2022-11-28 16:29:43 +01:00
Siarhei Fedartsou
095b726a92
Use <boost/iterator/function_output_iterator.hpp> instead of deprecated <boost/function_output_iterator.hpp> (#6458) 2022-11-16 21:09:54 +01:00
Siarhei Fedartsou
18dcd27a9b
Use node-api instead of NAN (#6452) 2022-11-16 15:44:36 +01:00
Frédéric Rodrigo
a1b3efe260
Remove at:urban maxspeed, partial revert of 2bbb347f57 (#6450) 2022-11-11 21:52:54 +01:00
Siarhei Fedartsou
6d10523440
Upgrade to clang-tidy 15 (#6439) 2022-11-06 22:45:35 +01:00
Frédéric Rodrigo
2bbb347f57
Car profile, add new specific country speed limit at:urban, ca-on:rural and es:trunk (#6443) 2022-11-06 21:27:03 +01:00
Siarhei Fedartsou
5f82d0c9ba
Get rid of unused functions in util/json_util.hpp (#6446) 2022-11-06 21:13:04 +01:00
Dennis Luxen
aeaf5e0735
Merge pull request #6433 from Project-OSRM/replace_boost_stringref
Replace boost::string_ref with std::string_view
2022-11-06 15:54:18 +01:00
Siarhei Fedartsou
8a186e6f49
Remove C++14 references from README and package.json (#6438) 2022-11-06 15:20:47 +01:00
Dennis Luxen
2ea168c26c
Merge pull request #6445 from Project-OSRM/dl_drop_gcc7
Drop GCC7 support
2022-11-06 15:08:14 +01:00
Dennis Luxen
a12625afac Drop GCC7 support 2022-11-06 13:33:10 +01:00
Dennis Luxen
8bff55cd85 [CPP17] Modernize: Replace typedef with using statements 2022-11-06 13:21:45 +01:00
Dennis Luxen
bb4fd93fab Fix formatting 2022-11-06 12:26:37 +01:00
Dennis Luxen
b13820f520 Use std::back_inserter 2022-11-06 12:19:32 +01:00
Dennis Luxen
fc12b6c365
Merge pull request #6441 from Project-OSRM/python2_deprecation 2022-11-06 08:21:16 +01:00
Dennis Luxen
cb515ba42f Merge remote-tracking branch 'origin/master' into replace_boost_stringref 2022-11-05 17:31:06 +01:00
Dennis Luxen
634e7fe392 Merge remote-tracking branch 'origin/master' into python2_deprecation 2022-11-05 17:29:57 +01:00
Siarhei Fedartsou
6ab8728807
Apply workaround for Conan installation issue on CI (#6442) 2022-11-05 16:56:16 +01:00
Siarhei Fedartsou
0ae5190937
Fix npm audit warnings in NPM package (#6437) 2022-11-04 12:19:39 +01:00
Dennis Luxen
a1c1fefd6e Fix formatting, pass by value 2022-11-04 11:49:54 +01:00
Dennis Luxen
6fa7bd8abd Upgrade check_tackinfo.py to Python3 2022-11-04 11:47:40 +01:00
Dennis Luxen
7359d6a21b Merge remote-tracking branch 'origin/master' into replace_boost_stringref 2022-11-04 11:43:41 +01:00
Dennis Luxen
5dda33fa88 More efficient toLower implementation 2022-11-04 11:42:37 +01:00
Dennis Luxen
5280ca4e16 Pass string_view by value 2022-11-04 11:41:02 +01:00
Dennis Luxen
2c02d4e5ab Update CHANGELOG.md 2022-11-01 12:10:48 +01:00
Siarhei Fedartsou
54d486ae12
Drop support of Node 12 & 14 (#6431) 2022-11-01 08:23:08 +01:00
Siarhei Fedartsou
afe34456b9
Delete CloudFormation templates (#6435)
There is no need in them - it seems they were needed to manage some Mapbox S3 bucket which we have no access to anyway.
2022-10-31 13:22:13 +01:00
Dennis Luxen
2f75d6f22b
Merge pull request #6429 from Project-OSRM/less_boost_unordered
Replace boost::unordered_{map/set} with std, also remove code duplication
2022-10-30 22:17:48 +01:00
Dennis Luxen
85e6a854aa Fix missing includes (on Windows) 2022-10-30 22:08:29 +01:00
Dennis Luxen
12f49d6f24 Stray whitespace 2022-10-30 20:11:36 +01:00
Dennis Luxen
7149547645 Fix formatting 2022-10-30 20:10:09 +01:00
Dennis Luxen
565959b389 Remove util/string_view header 2022-10-30 20:01:46 +01:00
Dennis Luxen
5c9d0d152c Remove usage of StringView typedef 2022-10-30 19:53:26 +01:00
Dennis Luxen
274dcc58a5 Remove superflous std::hash specialization 2022-10-30 19:21:06 +01:00
Dennis Luxen
d06b23d819 More fixes 2022-10-30 14:08:17 +01:00
Dennis Luxen
91e9623b31 Fix formatting 2022-10-30 14:06:19 +01:00
Dennis Luxen
0021ccef59 Replace boost::string_ref with std::string_view 2022-10-30 13:59:59 +01:00
Dennis Luxen
061f0a1f14 Fix includes 2022-10-30 11:43:28 +01:00
Dennis Luxen
60e283312c
Fix typo historgram -> histogram (#6427) 2022-10-30 08:34:00 +01:00
Dennis Luxen
f97e18d285 Fix formatting 2022-10-29 23:01:38 +02:00
Dennis Luxen
7b73b977ff Replace boost::unordered_{map/set} with std, also remove code duplication 2022-10-29 22:57:14 +02:00
Michael Bell
5d468f2897
Make edge metrics strongly typed (#6421)
This change takes the existing typedefs for weight, duration and
distance, and makes them proper types, using the existing Alias
functionality.

Primarily this is to prevent bugs where the metrics are switched,
but it also adds additional documentation. For example, it now
makes it clear (despite the naming of variables) that most of the
trip algorithm is running on the duration metric.

I've not made any changes to the casts performed between metrics
and numeric types, they now just more explicit.
2022-10-28 15:16:12 +01:00
Siarhei Fedartsou
16685d0de9
Add link to Discord server (#6422) 2022-10-26 11:22:28 +02:00
Siarhei Fedartsou
82897791d1
Update actions/cache to v3 (#6420) 2022-10-24 00:52:15 +02:00
Michael Bell
9ad432c5b2
Fix adding traffic signal penalties during compression (#6419)
Weight and duration penalties are flipped in the lambda function
that applies penalties from traffic signals.

Duration is in deciseconds, whilst weight is multipled by
10^weight_precision, with weight_precision being 1 by default.

Therefore, for default routability profile, the penalties end up
being the same, hence why no tests picked this up.

If distance weight is used however, it will incorrectly apply an
additional penalty to the weight, and not add the traffic signal
delay to the duration in the routing graph.

To confuse things further, in some API responses the values are
correct because they use geometry data instead, but it's still
possible that a sub-optimal route was selected.

However, given the distance weight is in meters, and the additional
penalty per traffic light would be 20, it's unlikely this would
have changed the routing results.

In any case, we correct the function to apply the arguments correctly.
2022-10-23 14:59:12 +01:00
Siarhei Fedartsou
c1d2c15995
Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only (#6417) 2022-10-22 16:49:35 +02:00
Siarhei Fedartsou
fb1bb7a15b
Fix annotations=true handling in NodeJS bindings & libosrm (#6415) 2022-10-19 08:35:18 +02:00
Siarhei Fedartsou
d65e8c7d1e
Fix bindings compilation on latest Node (#6416) 2022-10-18 21:59:39 +02:00
Michael Bell
5e5f1f4add
5.27.1 release (#6409)
* Bookkeeping for 5.27.1 release

* Reset for next release
2022-10-14 23:04:41 +01:00
Siarhei Fedartsou
9d160a9b5d
Revert back to using custom HTTP parser instead of Boost.Beast (#6407) 2022-10-14 14:37:33 +02:00
Siarhei Fedartsou
d143de597d
Fix bug with large HTTP requests leading to Bad Request in osrm-routed. (#6403) 2022-10-13 16:53:49 +02:00
Siarhei Fedartsou
4026ed54c0
Add support for surface=metal,grass_paver,woodchips in bicyle profile (#6395) 2022-10-11 11:09:56 +02:00
Daniel J. H
895e4bf6d5
Adds cucumber scenario for u turn restrictions at intersection (#4484) 2022-10-10 22:27:27 +02:00
Michael Bell
cb90d587be
Release 5.27 (#6392)
* Bookkeeping for 5.27.0 release.

* Prep rc.1

* Final 5.27 release tag

* Reset for next release
2022-10-10 17:54:01 +01:00
Michael Bell
284e110f2e
Actually match the tag naming conventions (#6393)
Wasn't matching on release candidates, nor any of the previous special tags convention.
2022-10-06 22:08:36 +01:00
Michael Bell
ac1edc7675
Prepare scoped Node package (#6386)
In case we're not able to get access to the unscoped credentials.
Scoped packages are also the recommended approach for projects
managed by a team of developers.
2022-10-06 21:05:51 +01:00
Siarhei Fedartsou
7be9039f53
Get rid of Mason (#6387) 2022-10-06 14:13:12 +02:00
Siarhei Fedartsou
52b516e943
Use clang-format from CI base image (#6391) 2022-10-06 12:50:31 +02:00
Nils
f3c03307cb
Add conanbuildinfo.json (#6388) 2022-10-04 18:08:41 +02:00
Siarhei Fedartsou
9a4b4648f4
Improve performance of JSON rendering (#6380) 2022-10-03 21:43:51 +02:00
Michael Bell
41fd947ebd
Update docs to reflect recent build and dependency changes (#6383) 2022-10-02 19:55:59 +01:00
Michael Bell
e328031661
Add issue templates for bug reporting, features, and questions. (#6385)
Primarily to educate bug reporters that demo site != default settings,
but also to help organise and auto-assign new issues.
2022-10-02 17:45:35 +01:00
Michael Bell
b7daa7e641
Gracefully handle no-turn intersections in guidance processing. (#6382)
Badly constructed OSM intersections can create OSRM intersection
views that have no valid turns.
The guidance code for segregated intersections tries to look
ahead to the second intersection to ensure lanes are  announced
intuitively.
Currently, OSRM assumes there are always turns at the second
intersection that we should consider. This commit corrects
this assumption so that it can now handle badly constructed
OSM intersections with no turns.
2022-10-01 14:35:08 +01:00
Siarhei Fedartsou
21888334dd
Do not generate intermediate .osrm file in osrm-extract. (#6354) 2022-09-30 14:29:10 +02:00
Siarhei Fedartsou
395cc6e9df
Add timestamps for logs (#6375) 2022-09-30 14:28:52 +02:00
Siarhei Fedartsou
902bfc7806
Refactor CMake code related to compiler warnings, enable some additional warnings (#6355) 2022-09-30 11:42:36 +02:00
Siarhei Fedartsou
3c5d99b4cb
Improve performance of map matching via getPathDistance optimization (#6378) 2022-09-29 22:27:19 +02:00
Michael Bell
ef8f3d7508
Ensure u-turn exists in intersection view (#6376)
Due to some rather complex logic that tries to calculate intersection
angles by looking further up the road, it's possible to return
an intersection view that is missing a u-turn - something which
is assumed to exist in later guidance calculations.

We apply a fix here by ensuring the u-turn is always included in
the returned view.
2022-09-27 13:49:12 +01:00
Louis
660cea8fcc
Bicycle surface speeds (#6212) 2022-09-23 17:54:55 +02:00
Siarhei Fedartsou
be353630d5
Fix a couple of warnings found by PVS Studio (#6372) 2022-09-22 23:28:12 +02:00
Siarhei Fedartsou
9b834810d5
Build Node bindings on Windows (#6334)
Extends CI to build NodeJS bindings for Windows.
2022-09-20 20:43:13 +01:00
Siarhei Fedartsou
1c65ea2194
Configure cross-compilation for Apple Silicon (#6360)
Adds support for Apple Silicon binaries for NodeJS bindings.
2022-09-17 13:00:53 +01:00
Siarhei Fedartsou
96f5780f06
Update CI to use clang-tidy 14 (#6353) 2022-08-31 23:39:47 +02:00
Siarhei Fedartsou
c003ac1055
Pin revisions of Conan dependencies (#6351) 2022-08-31 09:59:53 +02:00
Siarhei Fedartsou
9a638f3568
Optimize RestrictionParser performance (#6344) 2022-08-30 21:08:52 +02:00
Siarhei Fedartsou
2cf957148b
Support floats for speed value in traffic updates CSV (#6327) 2022-08-30 15:34:46 +02:00
Michael Bell
b17cbb4c47
Support OSM traffic signal directions (#6153)
Currently OSRM parses traffic signal nodes without consideration
for the direction in which the signal applies. This can lead
to duplicated routing penalties, especially when a forward and backward
signal are in close proximity on a way.

This commit adds support for directed signals to the extraction and
graph creation. Signal penalties are only applied in the direction
specified by the OSM tag.

We add the assignment of traffic directions to the lua scripts,
maintaining backwards compatibility with the existing boolean
traffic states.

As part of the changes to the internal structures used for tracking
traffic signals during extraction, we stop serialising/deserialising
signals to the `.osrm` file. The traffic signals are only used by
`osrm-extract` so whilst this is a data format change, it will not
break any existing user processes.
2022-08-30 10:36:49 +01:00
Siarhei Fedartsou
d8b358e810
Use apt-get to install Clang on CI (#6345) 2022-08-30 10:25:53 +02:00
Siarhei Fedartsou
b4142cf1a2
Add Flatbuffers support to NodeJS bindings (#6338) 2022-08-29 22:01:26 +02:00
Siarhei Fedartsou
06719be2b1
Use Lua 5.4 in Docker image (#6346) 2022-08-29 00:03:03 +02:00
Siarhei Fedartsou
18e5faa113
Remove Appveyor status from README.md (#6347) 2022-08-28 23:59:09 +02:00
Siarhei Fedartsou
a46241e45c
Add Node docs for exclude and skip_waypoints options (#6342) 2022-08-28 21:56:09 +02:00
Michael Bell
bfb74c2dad
Fix snapping target locations to ways used in turn restrictions (#6339)
Currently there is an edge-case in the turn restriction implementation,
such that routes can not be found if the target input location snaps
to a way used in a (multi) via restriction.

With the addition of snapping input locations to multiple ways, we
can now also snap to the "duplicate" edges created for the restriction graph,
thereby fixing the problem.
This is achieved by adding the duplicate restriction edges to the
geospatial search RTree.

This does open up the possibility of multiple paths representing exactly
the same route - one using the original edge as a source, the other
using the duplicate restriction graph edge as source. This is fine,
as both edges are represented by the same geometry, so will generate
the same result.
2022-08-27 15:59:44 +01:00
|so
3d5db4511c
Update http.md (#6150)
Fix the typos and some basic grammar mistakes

Co-authored-by: Siarhei Fedartsou <siarhei.fedartsou@gmail.com>
2022-08-27 15:59:02 +01:00
Michael Bell
d74e7b66bd
Support snapping to multiple ways at an input location (#5953)
This PR improves routing results by adding support for snapping to
multiple ways at input locations.

This means all edges at the snapped location can act as source/target
candidates for routing search, ensuring we always find the best route,
and not the one dependent on the edge selected.
2022-08-27 11:36:20 +01:00
Siarhei Fedartsou
bb18a2b428
Fix TBB in case of Conan + NodeJS build (#6333) 2022-08-26 17:09:52 +02:00
Michael Bell
c204360aa0
Fix HTTP compression precedence (#6331)
There is a bug in the deflate compression. Therefore, we do not want
to select this in the default choice for HTTP response compression.
Instead we revert back to the previous precedence, selecting gzip as
the priority.
2022-08-25 17:49:35 +01:00
Siarhei Fedartsou
df3c553f4f
Remove redundant nullptr check. (#6326) 2022-08-25 00:01:56 +02:00
Siarhei Fedartsou
91895604c9
Migrate to modern TBB version (#6300) 2022-08-24 18:13:49 +02:00
Michael Bell
a98074a051
Improvements to maneuver override processing (#6215)
This change unblocks the osrm-extract debug build, which is
currently failing on a maneuver override assertion.

The processing of maneuver overrides currently has three issues
- It assumes the via node(s) can't be compressed (the failing assertion)
- It can't handle via-paths containing incompressible nodes
- It doesn't interop with turn restriction on the same path

Turn restrictions and maneuver overrides both use the same
from-via-to path representation.
Therefore, we can fix these issues by consolidating their
structures and reusing the path representation for
turn restrictions, which already is robust to the above
issues.

This also simplifies some of the codebase by removing maneuver
override specific path processing.

There are ~100 maneuver overrides in the OSM database, so the
impact on processing and routing will be minimal.
2022-08-24 16:19:24 +01:00
Siarhei Fedartsou
8e74b7af9d
Enable performance-move-const-arg clang-tidy check (#6319) 2022-08-23 19:03:41 +02:00
Michael Bell
869b3fae82
Bump CI complete job to ubuntu-22.04 (#6323)
18.04 is being deprecated.
2022-08-22 20:55:28 +01:00
Maciej Bukczynski
32fb8607e4
Add node_osrm support for skip_waypoints parameter (#6060) 2022-08-22 21:47:47 +02:00
Lev Dragunov
928867c520
Add data_version field to responses of all plugins. (#5387) 2022-08-22 21:07:32 +02:00
Michael Bell
972a848094
Lazily generate optional route path data (#6045)
Currently route results are annotated with additional path information,
such as geometries, turn-by-turn steps and other metadata.

These annotations are generated if they are not requested or returned
in the response.
Datasets needed to generate these annotations are loaded and available
to the OSRM process even when unused.

This commit is a first step towards making the loading of these datasets
optional. We refactor the code so that route annotations are only
generated if explicitly requested and needed in the response.

Specifically, we change the following annotations to be lazily generated:
- Turn-by-turn steps
- Route Overview geometry
- Route segment metadata

For example. a /route/v1 request with
steps=false&overview=false&annotations=false
would no longer call the following data facade methods:
- GetOSMNodeIDOfNode
- GetTurnInstructionForEdgeID
- GetNameIndex
- GetNameForID
- GetRefForID
- GetTurnInstructionForEdgeID
- GetClassData
- IsLeftHandDriving
- GetTravelMode
- IsSegregated
- PreTurnBearing
- PostTurnBearing
- HasLaneData
- GetLaneData
- GetEntryClass

Requests that include segment metadata and/or overview geometry
but not turn-by-turn instructions will also benefit from this,
although there is some interdependency with the step instructions
- a call to GetTurnInstructionForEdgeID is still required.
Requests for OSM annotations will understandably still need to
call GetOSMNodeIDOfNode.

Making these changes unlocks the optional loading of data contained in
the following OSRM files:
- osrm.names
- osrm.icd
- osrm.nbg_nodes (partial)
- osrm.ebg_nodes (partial)
- osrm.edges
2022-08-22 12:59:20 +01:00
Michael Bell
3cfd0e8334
Complete support for no_entry and no_exit turn restrictions (#5988)
The internal representation of turn restrictions expects only one
`from` way and only one `to` way.

`no_entry` and `no_exit` turn restrictions can have multiple `from` and
`to` ways respectively. This means they are not fully supported by
OSRM's restriction parser.

We complete support for these turn restriction types by parsing all
ways and converting a valid restriction with multiple `from`/`to` members
into multiple internal restrictions.
2022-08-22 12:58:16 +01:00
Michael Bell
b4b1aea567
Add support for non-round-trips with a single fixed endpoint (#6050)
Currently /trip supports finding round-trip routes where only the
start or end location is fixed. This PR extends this feature to
non-round-trip requests.

We do this by a new table manipulation that simulates non-round-trip
fixed endpoint requests as a round-trip request.
2022-08-22 12:56:47 +01:00
Rafael Guglielmetti
e3c7995b00
Add missing files in exception message (#5360) 2022-08-22 08:32:25 +02:00
Michael Bell
7f014bd616 Clarify identifier types used in data facade
The data facade interface contains numerous methods for looking up
datapoints by identifiers.
Many of the parameters use the NodeID or EdgeID types. However, these two
identifier types are used for representing three different contexts:

1. Node-based graph edges and nodes
2. Edge-based graph edges and nodes
3. Packed geometries

Consider the use of identifier parameters in these examples:

---

GetWeightPenaltyForEdgeID(const EdgeID id)  <- edge-based edge

GetUncompressedForwardWeights(const EdgeID id) <- packed geometry

IsLeftHandDriving(const NodeID id) <- edge-based node

GetBearingClass(const NodeID node) <- node-based node

---

This mixing of contexts within the same interface makes it
difficult to understand the relationships and dependencies between
the OSRM datasets.

For 1. and 2. we continue to use the NodeID and EdgeID types, but
change the interface parameter names to identify them as
edge-based or node-based graph properties.

For 3. we define a new type definition, PackedGeometryID.

These changes are to aid with readability. A next step would be
to strongly type these definitions, leveraging the Alias template
already used for OSM identifiers.
2022-08-21 21:37:39 +02:00
Siarhei Fedartsou
e872f1d6c3
Do not use deprecated Callback::Call overload in Node bindings (#6318) 2022-08-20 17:27:14 +01:00
Siarhei Fedartsou
47e5591ed8
Use the latest node on CI (#6317) 2022-08-20 17:16:05 +01:00
Joonas Paalasmaa
9d4dd2595e
Remove references to project-osrm.wolt.com (#6314)
At Wolt, we are cleaning up subdomains under wolt.com, and project-osrm.wolt.com will go offline soon.
2022-08-20 17:14:38 +01:00
Siarhei Fedartsou
aadc088084
Fix distance calculation consistency. (#6315)
Consolidate great circle distance calculations to use cheap ruler library.
2022-08-19 22:31:40 +01:00
Siarhei Fedartsou
8f0cd5cf7b
Migrate Windows CI to GitHub Actions. (#6312)
It is quite difficult to maintain current Windows CI, because it uses pre-compiled dependencies stored on wolt.com server and there is low chance to find someone who is able to update it.
2022-08-19 18:49:09 +01:00
Siarhei Fedartsou
624fea6d33
Add smoke test for Docker image (#6313)
* Add smoke test for Docker image
2022-08-19 11:32:55 +01:00
Siarhei Fedartsou
9688e48ad1
Update libosmium to 2.18.0. Fix problem with Docker image build. (#6303) 2022-08-16 18:26:21 +01:00
Siarhei Fedartsou
51a8486375
Fix performance issues after migration to sol2 3.3.0 (#6304)
* Fix performance issues after migration to sol2 3.3.0
2022-08-15 23:10:56 +01:00
Siarhei Fedartsou
440c00064e
Remove EXACT from find_package if using Conan (#6299)
* Remove EXACT from find_package if using Conan
2022-08-15 21:21:01 +01:00
Patrick Niklaus
e5450e8c68
Remove highway=bicycle safety bonus (#6296)
* Remove highway=bicycle safety bonus

This removes a bonus for a road class that doesn't exist (cycleway would
be correct), but the code was buggy since safety_bonus is nil and caused
an arithmetic exception. We only caught this 4 (!) years later since
recently a way was tagged with highway=bicycle and made it in our OSM
data leading to preprocessing failures.
2022-08-15 21:14:37 +01:00
Siarhei Fedartsou
f19247a7ca
Pass osm_node_ids by reference in osrm::updater::Updater class (#6298) 2022-08-15 21:12:58 +01:00
Siarhei Fedartsou
e7185b4bcb
Use Boost.Beast to parse HTTP request (#6294) 2022-08-02 21:12:05 +01:00
Siarhei Fedartsou
00816722dd
Configure Undefined Behaviour Sanitizer (#6290) 2022-08-01 22:40:26 +01:00
Siarhei Fedartsou
589becbfec
Use Conan instead of Mason to install code dependencies (#6284)
* Use Conan instead of Mason to install code dependencies
2022-08-01 21:21:20 +01:00
Siarhei Fedartsou
4e8ee288d9
Migrate to C++17. Update sol2 to 3.3.0. (#6279)
* Migrate to C++17. Update sol2 to 3.3.0.
2022-07-31 00:56:17 +01:00
Siarhei Fedartsou
204fdaff6e
Fix bug with reading Set values from Lua scripts. (#6285)
* Fix bug with reading Set values from Lua scripts.

* Add test for foot profile named-road suffixes

Co-authored-by: Michael Bell <michael@mjjbell.com>
2022-07-30 23:14:06 +01:00
Siarhei Fedartsou
1a3d0f7c20
Update macOS CI image to macos-11 (#6286)
* Update macOS CI image to macos-11
2022-07-30 13:40:21 +01:00
Siarhei Fedartsou
06b1b980bb
Enable even more clang-tidy checks (#6273) 2022-07-04 21:46:59 +01:00
Siarhei Fedartsou
19d2ec56b8
Configure CMake to not build flatbuffers tests and samples (#6274)
* Do not build flatbuffers tests and samples
2022-07-03 23:59:54 +01:00
Siarhei Fedartsou
3d2db20777
Enable more clang-tidy checks. (#6270)
* Enable more clang-tidy checks
2022-06-30 14:32:12 +01:00
Siarhei Fedartsou
59953172e8
Configure clang-tidy job on CI (#6261) 2022-06-28 00:14:28 +01:00
John Doe
79d4363d59
Enable arm docker build (#6172)
This issue enables dockerX for multi-arch docker image building. 
Resulting images can be run on x86 and arm processors (for example aws graviton).
2022-03-08 20:02:11 +00:00
John Doe
662a8d0a12
Split build command into two layers (#6175)
* Split build command into two layers

Co-authored-by: nurikk <ainur@yojee.com>
2022-02-16 21:18:28 +00:00
Yuriy Chernyshov
f2e284623e
Do not depend on ADL 2022-01-10 11:28:43 +00:00
Nikolay Mikov
c0b79a8d0e Remove set(CMAKE_OSX_ARCHITECTURES "x86_64") on MacOS 2022-01-09 22:01:34 +00:00
Michael Bell
1e70b645e4 Fix generation of NodeJS API documentation
NodeJS API docs are out of sync with NodeJS C++ wrapper documentation
due to the doc build breaking back in #4043.

The commit fixes the Node dev dependencies such that `npm run docs`
works again and re-enables the check in CI.
2021-12-23 11:10:39 +00:00
Michael Bell
04c2167c2d Fix for_each_indexed util function
- Fix typo in util function name for_each_indexed.
- Use the overloaded functions for_each_indexed and for_each_pair
  with a container argument where possible to improve readability.
2021-12-22 23:40:06 +00:00
Michael Bell
2c81083406 Fix CI 32-bit build
A recent change to the Ubuntu Focal CI worker - either a CMake upgrade,
or default installation of the libexpat-dev library - leads to the
32-bit expat library to not be found by CMake.

FindPackage(EXPAT) finds the library via pkg-config, so the fix is
to explicitly include the i386 pkg-config directory in the
PKG_CONFIG_PATH environment variable list.
2021-12-22 23:25:19 +00:00
Michael Bell
472cce6742 Fix Mason CMake installation
During the CI migration to Github Actions, a bug was introduced
such that Mason CMake is not being added to the PATH environment
variable correctly, so it defaults to the CMake installed in the
OS environment.

Simple fixing the typo fails as the Mason CMake version requires
libssl 1.0 as a dependency, whilst the Ubuntu Focal runners are
on the newer libssl 1.1. Therefore, we also bump the Mason
CMake version to 3.21.2.
2021-12-22 23:25:19 +00:00
Denis Chapligin
ff1af413d6
Merge pull request #6156 from mloskot/ml/fix-msvc-19-28-static-const-member
Fix MSVC 19.28+ issue with ByEdgeOrByMeterValue::by_edge and ByEdgeOrByMeterValue::by_meter definitions
2021-11-13 23:29:08 +02:00
Mateusz Łoskot
ffa4256ad3
Run clang-format to fix formatting 2021-11-12 19:06:33 +01:00
Mateusz Łoskot
3da45c1d92
Fix MSVC 19.28+ issue with ByEdgeOrByMeterValue::by_edge and ByEdgeOrByMeterValue::by_meter definitions
This is a workaround for discrepancy between MSVC 19.27 and 19.28
about static const member definition
https://developercommunity2.visualstudio.com/t/discrepancy-between-msvc-1927-vs-1928-about-static/1255338

We can not use C++17 inline variable as a workaround suggested
in the issue report linked above, because the sol2 does not
seem to compile in C++17 mode:

    third_party/sol2/sol2/sol.hpp: error C2039: 'object_type': is not a member of...
2021-11-12 17:37:19 +01:00
Daniel Patterson
d5cd702242
Enable all unit tests (#5248)
* Add missing profile name to library extract test.

* Support both tzid and TZID properties on timezone geometry.  Improve validation of timezone polygons.

* Missing tzid property wasn't a geojson validation issue, shouldn't have been tested there.

* Use filesystem glob to loop over all test executables so we don't miss any in the future.

Co-authored-by: Michael Bell <michael@mjjbell.com>
2021-10-22 22:10:25 +01:00
Torben Hørup
b120c971a0
Make osrm-routed optional (#6144)
* Make osrm-routed optional

* Updated changelog

* require boost 1.60

* Update CMakeLists.txt

* Update CHANGELOG.md

Co-authored-by: Michael Bell <michael@mjjbell.com>
2021-10-08 17:06:55 +01:00
Michael Bell
eb3bf5cfe3 Upgrade Ubuntu CI builds to use 20.04
Moves Linux CI builds to the latest Ubuntu LTS.
- Bumps the GCC matrix to versions {7,8,9,10,11}, making 9 the default
for testing non-standard builds.
- Bump Node matrix to {12,14,16,LTS,latest} now that 10 is EOL.
- Fixes to CI builds due to library changes on newer distro.
2021-09-30 22:51:12 +01:00
Michael Bell
56a427f839 Upgrade Boost to 1.70, fix inefficient connection handling
A request to osrm-routed can be assigned to a thread which
is currently busy processing another request, even when there
are other threads/cores available. This unnecessarily delays
the response, and can make requests appear to hang when
awaiting CPU intensive requests to finish.

The issue looks like a bug in Boost.Asio multithreaded
networking stack.

osrm-routed server implementation is
heavily influenced by the HTTP server 3 example in the
Boost.Asio docs. By upgrading to Boost 1.70 and updating the
server connections to match the example provided in the 1.70
release, the problem is resolved.

The diff of the changes to the Boost.Asio stack are
vast, so it's difficult to identify the exact cause. However
the implementation change is to push the strand of execution
into the socket (and timer) objects, which suggests it could
fix the type of threading issue we are observing.
2021-09-30 22:51:12 +01:00
Torben Hørup
73a2b91251
Add GH actions script for docker image (#6138)
* Add GH actions script for docker image

* Updated Changelog
2021-09-30 19:45:15 +01:00
Torben Hørup
34877482e6
Use github actions badge in README.md (#6136) 2021-09-27 12:40:28 +01:00
Daniel Patterson
b739658681
Reset for next release. 2021-09-21 14:50:45 -07:00
Michael Bell
37cfc7f99d
Revert "Executables use hyphens" (#6131)
This reverts commit 5bf3c7b659.
2021-09-21 13:28:01 -07:00
Michael Bell
2d1e620429
Fix test cache to consider MLD executable changes (#6129)
* Fix test cache to consider MLD executable changes

Currently the test cache is not invalidated if changes to
osrm-partition or osrm-customize executables. This is problematic
when these executables make breaking changes to the data format.

We fix this by including both in the list of executables that
can invalidate the test cache.

* Executables use hyphens
2021-09-21 12:35:34 -07:00
Michael Bell
f6349a7fbe
Fix metric offset overflow for large MLD partitions (#6124)
Each MLD cell has source and destination nodes.
MLD is keeping a |source| x |destination| sized table
for various metrics (distances, durations, etc) from each
source to all destinations in a cell.

It stores all of the values for a metric in one large array, with
an offset for each cell to find its values. The offset is currently
limited to 32 bit values, which overflows on very large graphs
(e.g. Planet OSM).

We fix this by changing the offsets to be uint64_t types.
2021-09-21 19:25:30 +01:00
Michael Bell
f1f96166c5
Fix MLD level mask generation to support 64-bit masks. (#6123)
The generation of level masks for compactly storing partition cells
supports sizes that can be stored in 64 bits.

The current implementation fails if the total bit sum is 64 bits
exactly. A bit shift mechanism is used that is undefined when the
shift size is equal to the bit size of the underlying type. This
generates an incorrect mask value.

We fix this by adding a special case for a 64 bit offset. Given this
code is called at most |level| times, there will be no effect on
performance. We also update the assertions to reflect 64 bit masks
are now supported.
2021-09-21 18:09:38 +01:00
Ömer Faruk Özdemir
8e100ea1a0
Update api.md (#6054)
* Update api.md

alternatives_count was missing in this document,

Copied from here:
https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint-object
2021-09-04 12:33:10 +01:00
Michael Bell
f1a6056953 Immediately close bad connections to prevent file exhaustion
osrm-routed does not immediately clean up a keep-alive connection
when the client closes it. Instead it waits for five seconds
of inactivity before removing.

Given a setup with low file limits and clients opening and
closing a lot of keep-alive connections, it's possible for
osrm-routed to run out of file descriptors whilst it waits for
the clean-up to trigger.

Furthermore, this causes the connection acceptor loop to exit.
Even after the old connections are cleaned up, new ones
will not be created. Any new requests will block until the
server is restarted.

This commit improves the situation by:

- Immediately closing connections on error. This includes EOF errors
indicating that the client has closed the connection. This releases
resources early (including the open file) and doesn't wait for the
timer.

- Log when the acceptor loop exits. Whilst this means the behaviour
can still occur for reasons other than too many open files,
we will at least have visibility of the cause and can investigate further.
2021-09-04 01:55:36 +01:00
Michael Bell
d413d0639d Fix Boost link flags in pkg-config file.
In newer versions of cmake, FindBoost uses Imported Targets for library
component variables, rather than file paths to the Boost libraries.

cmake uses these targets when linking (e.g. target_link_library) and
knows how to correctly substitute the values. However, the OSRM
pkg-config file that we generate doesn't do this, and ends up writing
the actual target symbols, hence the errors trying to link Boost::<component>.

To fix this for newer cmake versions, we create an intermediate configure step
that references the linker files for the imported targets. This is followed
by a generate step that performs the correct substitution.
See this thread for more details: https://cmake.org/pipermail/cmake/2018-December/068812.html

This is backwards compatible to the existing min cmake version (3.1).
However, building using cmake 3.1 fails with a package.json parsing error,
so this commit also bumps the min version to 3.2.
2021-09-03 23:49:32 +01:00
Michael Bell
9884684701 Fix generation of inefficient MLD partitions
Duplicate restriction nodes in the edge-based-graph are currently
not in included in a mapping (.osrm.cnbg_to_ebg) from
node-based-graph edges to edge-based-graph nodes.
This mapping is used by the MLD partitioner to assign EBG nodes
to partitions.

The omission from the mapping means all restriction nodes are
included in a special 'invalid' partition. This special partition
will break the geolocation properties of the multi-level hierarchy.
The partition and its super levels will have a large number of
border nodes and very few internal paths between them.

Given the partitioner is the only consumer of the mapping, we fix
the issue by including the duplicate restriction nodes in the mapping,
so that they are correctly assigned to a partition.

This has measurable improvement on MLD routing.
For a country-sized routing network, the fix reduces routing and table
request computation time by ~2% and ~6% respectively.
2021-09-03 22:48:10 +01:00
Michael Bell
0911691008 Fix changelog entry 2021-09-03 18:35:01 +02:00
Michael Bell
971f0d3fe2 Format unit_tests 2021-09-03 18:35:01 +02:00
Michael Bell
eb0c089574 Replace Travis with Github Actions for CI builds
Replace Travis for continuous integration with Github Actions.
The Github Actions pipeline is functionally equivalent, with
all the same build permutations supported.
Whilst the Github Actions offering is broadly equivalent to
Travis, a few changes have been made as part of the migration.

- The 'core' and 'optional' Travis stages have been consolidated
into one build matrix. This is due to the current inability in
Github Actions to share build steps between jobs, so this avoids
having to duplicate the steps.
Optional stage jobs will now run in parallel with core jobs,
but they still remain optional in the sense that they don't fail
the build.

- A number of existing Github Action plugins are used to replace
functionality provided by Travis or other tools:
Node setup, caching, Codecov, publishing release artifacts.

- Linux builds are updated to build on Ubuntu 18.04.
MacOS builds are updated to run on 10.15. Similar to the
Travis Xenial upgrade attempt, some changes are required due
to underlying platform and compiler upgrades. This means some
Node 10 toolchains will no longer be supported.

Whilst there is opportunity to upgrade some dependencies and
make the CI steps more idiomatic, I've left this for future changes
and just focussed on functional replication.
2021-09-03 18:35:01 +02:00
Mateusz Konieczny
8af4f700f7 fix link in the changelog 2021-09-03 11:14:22 +02:00
Patrick Niklaus
155ca8b1f1 Update src/server/api/url_parser.cpp
Co-authored-by: Michael Bell <moke.byll@gmail.com>
2021-09-03 10:55:53 +02:00
Patrick Niklaus
03001ff90a Fix ranges 2021-09-03 10:55:53 +02:00
Patrick Niklaus
ba4e7bfa11 Add changelog entry 2021-09-03 10:55:53 +02:00
Patrick Niklaus
38df7d5e05 Fix the URL parser for special chars in profile 2021-09-03 10:55:53 +02:00
ijleesw
dca35dcc86 Add support for lua5.4 in FindLua.cmake 2021-07-20 23:21:49 +01:00
Matt Riggott
f7478ba80f
Process maxspeed tag before surface, smoothness, and tracktype tags (#6002)
* Handle maxspeed tags before surface and smoothness tags

Let's say we have a tertiary road with the following tags:

   highway=tertiary
   maxspeed=60
   surface=gravel
   smoothness=intermediate

While the maxspeed tag tells us the legal speed limit, the surface and
smoothness tags have much more effect on the real-world speed of a car.
We should process the maxspeed tags first, and then update the road's
forwards/backwards speeds according to any surface and smoothness tags.
For our hypothetical road the process in the car.lua profile now goes
like this:

1. Get default speed from profile (tertiary = 40 on line 150 of car.lua)
2. Change speed to 60 using maxspeed tag (WayHandlers.maxspeed function
   in way_handlers.lua, lines 434-447)
3. Change speed to 40 using surface tag (WayHandlers.surface function
   in way_handlers.lua, lines 360-363)
4. Check speed according to smoothness tag --- but because it's higher
   than the speed according to the surface tag, leave the speed
   unchanged (WayHandlers.surface function again, lines 368-371)

<ec36319232/profiles/car.lua (L150)>
<ec36319232/profiles/lib/way_handlers.lua (L354-L372)>

Note in step 3 above the speed's only changed from 60kph to 40kph
because it's a lower value. If the surface speed was higher than than
the previous value, the speed would remain unchanged. Another example:

   highway=tertiary
   maxspeed=60
   surface=compacted
   smoothness=intermediate

Here, although the profile's speed for compacted is 80, it would stay at
the lower value of 60 (see way_handlers.lua, lines 360-363).

<ec36319232/profiles/lib/way_handlers.lua (L360-L363)>
2021-06-03 17:56:57 +01:00
Daniel Patterson
ec36319232
Reset main branch after release. 2021-05-17 14:59:48 -07:00
Daniel Patterson
051e931091
Final 5.25 release prep. 2021-05-17 14:57:10 -07:00
Daniel Patterson
3a029d476c
Try pushing tag again. 2021-05-17 14:16:35 -07:00
Daniel Patterson
d97fe2322d
Prep 5.25.0-rc.1 2021-05-17 12:15:04 -07:00
Michael Bell
baca7b70f1
Use Github Releases for hosting node binaries (#6030)
* Use Github Releases for hosting node binaries

Replaces S3 hosting of node binaries with Github Releases.
`node-pre-gyp publish` works exclusively with S3, so upload step
is now performed by the Travis deployment provider.

The behaviour for the package user should not change.
When building a new version tag, Travis will create a release for the
tag if it does not already exist.

* Switch to the osrm-release-automation machine account rather than personal credentials.

Co-authored-by: Daniel Patterson <danpat@danpat.net>
2021-05-17 11:54:08 -07:00
Michael Bell
50f5a753ea Increase PackedOSMIDs size to 34 bits
OSM node 2^33 was created in early April 2021. This and all
subsequently created IDs will be overflowing OSRM node storage
which only support 33 bit IDs.
Bump the number of bits to 34 to double node ID capacity. This
is a breaking change to the data format as it alters the layout
of .osrm.nbg_nodes.
2021-04-24 23:41:02 +01:00
Michael Bell
4ac827a849 Remove redundant loading of .osrm.cell_metrics
When using process memory, MLD cell metrics are loaded twice from
.osrm.cell_metrics - once when loading static data, and again when
loading updatable data. The former appears to be the mistake,
as .osrm.cell_metrics is only listed in `GetUpdatableFiles`.
2021-04-24 21:19:27 +01:00
Mandeep Sandhu
def699dafd
Remove hardcoded access keys from travis config (#6012) 2021-04-15 22:29:40 -07:00
Michael Bell
41dda32546
Merge pull request #5999 from mjjbell/mbell/barrier_kerb
Add kerb barrier exception to default car profile
2021-03-31 20:24:42 +01:00
Michael Bell
8d3ebc64dc Add kerb barrier exception to default car profile
OSM data contains many mistakes that tag kerbs as highway barriers
when instead they are only describing highway crossings.

This PR updates the default car profile to handle these mistakes
and unblock routing on the affected highways.
2021-03-31 01:17:19 +01:00
Michael Bell
c15b02ecf6
Merge pull request #5994 from wangyoucao577/bugfix/correct-doc
Fix valid field type in doc
2021-03-26 16:32:03 +00:00
Jay Zhang
480807500b docs: changelog 2021-03-26 00:28:08 +00:00
Jay Zhang
e2de71bdcf docs: fix valid field type 2021-03-26 00:25:26 +00:00
Daniel Patterson
574060418a
Update node-pre-gyp to fix Node 12/14 installation problems in some environments. (#5991) 2021-03-23 10:11:46 -07:00
Daniel Patterson
9d81eb327a
Reset master versioning for next release. 2021-01-28 10:31:49 -08:00
Daniel Patterson
677598a8d8
Blank commit to trigger TravisCI. 2021-01-28 09:03:40 -08:00
Daniel Patterson
781a2ad0f8
Release 5.24.0 2021-01-28 06:11:02 -08:00
Karen Shea
a613375460
Validate source/destination indices correctly in nodejs support (#5595)
* validate source/destination indices correctly

Co-authored-by: Denis Chapligin <denis.chaplygin@wolt.com>
Co-authored-by: Daniel Patterson <danpat@danpat.net>
2021-01-28 06:02:01 -08:00
Richard Fairhurst
960269f95a
Merge pull request #5131 from themylogin/master
Fix turn.roads_on_the_left and turn.roads_on_the right for two-way roads
2021-01-28 14:00:17 +00:00
Dane Springmeyer
ed7b1baacc
Don't bundle node-pre-gyp (#5520)
Bundling node-pre-gyp was only needed for node v4 and earlier.

Remove it to avoid errors like:

> npm ERR! enoent ENOENT: no such file or directory, rename '/home/circleci/project/node_modules/node_or_tools/node_modules/abbrev' -> '/home/circleci/project/node_modules/node_or_tools/node_modules/.abbrev.DELETE'

More context: https://github.com/mapbox/node-pre-gyp/issues/260#issuecomment-407222286
2021-01-27 09:19:32 -08:00
Daniel Patterson
d4e7b3d60b
Cleanup node dependencies. (#5945)
* Cleanup node dependencies.
2021-01-27 09:17:15 -08:00
Michael Bell
bd3eb6591e
Undo libosrm API break by adding old interface as method overload (#5861)
Removes the breaking libosrm API change by adding the old interface to
the new. This does not introduce any new breaks.

The downside of this is that it allows for multiple ways to
return JSON responses.
2021-01-27 09:14:44 -08:00
themylogin
b0b8069ab0 clang-format 2021-01-27 13:12:20 +01:00
themylogin
d9d873903f Account merged edges when processing turn legs 2021-01-27 10:53:48 +01:00
themylogin
e7acc9df76 Fix turn.roads_on_the_left and turn.roads_on_the right for two-way roads #5128 2021-01-27 10:53:00 +01:00
Denis Chapligin
b6557b8cac
Merge pull request #5927 from OgreTransporter/master
Bugfix Lua 5.4 not working
2021-01-21 15:23:39 +02:00
Denis Chapligin
a05d7a8f73
Merge pull request #5926 from mjjbell/mbell/parameter_improvements
Reduce copying in API parameter constructors
2021-01-21 15:22:26 +02:00
Transporter
35ff807e1d Bugfix Lua 5.4 not working 2021-01-07 10:48:59 +01:00
Michael Bell
e554624438 Reduce copying in API parameter constructors
When using non-default constructors for the API parameter classes,
vector arguments like coordinates and hints are copied at least once
(twice when passed as lvalue arguments).

Enable perfect forwarding of BaseParameter arguments and
pass-by-value in the constructor that uses the argument. This
ensures we copy at most once (zero for rvalue arguments).
2021-01-06 23:15:35 +00:00
Michael Bell
58ba3fc84f
Avoid copying ManyToMany table results (#5923)
Regardless of any copy elision on the returned pair value, the
duration and distance results are always copied.

Fix this by passing rvalue references to std::make_pair.
2021-01-04 08:46:51 -08:00
Denis Chapligin
dddf83db7b
Merge pull request #5908 from systemed/debug_way
Profile debug script which fetches a way from OSM
2020-12-21 20:14:37 +02:00
Michael Bell
5266ac1635
Add support for multiple via-way restrictions (#5907)
Currently OSRM only supports turn restrictions with a single via-node or one
via-way. OSM allows for multiple via-ways to represent longer and more
complex restrictions.

This PR extends the use of duplicate nodes for representng via-way turn
restrictions to also support multi via-way restrictions. Effectively, this
increases the edge-based graph size by the number of edges in multi via-way
restrictions. However, given the low number of these restrictions it
has little effect on total graph size.

In addition, we add a new step in the extraction phase that constructs
a restriction graph to support more complex relationships between restrictions,
such as nested restrictions and overlapping restrictions.
2020-12-20 13:59:57 -08:00
Denis Chapligin
eb1d399f3b
Merge pull request #5894 from xlaussel/avoid_samelookup_in_heap_map
Avoid samelookup in heap map
2020-12-20 22:17:49 +02:00
Andrey Gurevich
6bf68fb0c6
Update http.md (#5914)
Looks like a mistake in the description of Table api
2020-12-20 08:39:35 -08:00
Alin Mindroc
33b2a193f9
Fix node14 compilation issues (#5918)
* Use Nan:: getters and setters for node 12/14 compatibility
* Drop support for publishing node 8 bindings, add publishing support for node 12, 14

Co-authored-by: Daniel Patterson <danpat@danpat.net>
2020-12-19 15:37:01 -08:00
systemed
158d260cbb Mention new script in changelog 2020-12-15 12:51:28 +00:00
systemed
83b17e664c Update comments 2020-12-15 12:49:52 +00:00
xlaussel
89a9bc9d70 Undo changes to package-json.com :
Revert to master version
2020-12-14 08:38:31 +01:00
Denis Chapligin
b0a4ad92c4
Merge pull request #5887 from dburnsii/upgrade_libsol2_v2.20.6
Upgrade libsol2 v2.20.6
2020-12-13 22:55:44 +02:00
systemed
9a20e8e614 Profile debug script to fetch a way from OSM 2020-12-10 11:02:04 +00:00
Desone Burns II
af5efd2abb Merge branch 'master' of github.com:Project-OSRM/osrm-backend into upgrade_libsol2_v2.20.6 2020-12-03 16:50:35 -07:00
Desone Burns II
9ae9a1f6d7 Fix table checks 2020-12-03 16:42:57 -07:00
Denis Chapligin
370081ec14
Merge pull request #5903 from bxl-forever/maxspeed-brussels
Update car.lua - new maxspeed default speed for Brussels, Belgium
2020-12-03 11:22:42 +02:00
bxl-forever
d340f4eabc
Update car.lua - new maxspeed default speed for Brussels, Belgium
Those new speeds apply by law as from Jan. 1, 2021 within the entire Brussels-Capital Region, one of the 3 regions of Belgium.
2020-12-02 13:32:12 +01:00
Desone Burns II
0e10b94d38 Merge branch 'master' of github.com:Project-OSRM/osrm-backend into HEAD 2020-12-01 19:24:11 -07:00
Desone Burns II
1a5e5df6bd Use table lookup as boolean 2020-12-01 19:23:10 -07:00
Denis Chapligin
18a0f6c1f8
Merge pull request #5891 from mloskot/ml/check-indexed-data-for-empty-values
Avoid dereferencing iterators over empty indexed data values
2020-12-01 15:26:58 +02:00
Desone Burns II
8510d6850a Cast string to number in Lua 2020-11-30 17:25:35 -07:00
Desone Burns II
566cf785f5 Initialize empty Lua object 2020-11-30 14:13:18 -07:00
xlaussel
687a3cdfbe Merge branch 'master' into avoid_samelookup_in_heap_map 2020-11-26 21:29:27 +01:00
Daniel Patterson
50d9632ed7
Upgrade formatting to clang-format 10 (#5895)
* Update formatting tools to clang-format-10

* Reformat using clang-format-10.0.09
2020-11-26 07:21:39 -08:00
xlaussel
f376225080 Changed code failing when compiling asserts 2020-11-25 13:25:04 +01:00
xlaussel
fcb7dd2a21 format code 2020-11-25 12:42:01 +01:00
xlaussel
aa06029801 References removed for extracted heapNode: could lead to bugs because the same was sometimes modified after when relaxing outgoing edges 2020-11-25 11:22:30 +01:00
Desone Burns II
1ce573ef35 Fix lua nil for MacOS 2020-11-24 08:26:24 -07:00
Desone Burns II
cf13a9714d clang-format-3.8 changed files 2020-11-24 08:06:26 -07:00
xlaussel
8697a6b14a Changes and corrections before change request
Cucumber successfull
2020-11-24 12:43:08 +01:00
xlaussel
9a32722634 other improvements.
Variable renaming with better names
2020-11-24 11:05:11 +01:00
Desone Burns II
24d0af6faf clang-format changed file 2020-11-23 17:12:13 -07:00
Desone Burns II
b1646622e6 Changed nil test to empty test 2020-11-23 17:07:10 -07:00
xlaussel
697c2ff88d other improvements.
Variable renaming with better names
2020-11-23 23:11:41 +01:00
xlaussel
e181cb325c other improvements.
Variable renaming with better names
2020-11-23 23:10:22 +01:00
xlaussel
41af9615cd Improvements 2020-11-23 23:00:27 +01:00
xlaussel
13067844ee Changes made 2020-11-23 22:33:08 +01:00
Desone Burns II
ca68518763 Remove context from get_nodes call 2020-11-23 13:24:44 -07:00
Desone Burns II
f6065de494 Added nil check to table conversion 2020-11-23 13:21:55 -07:00
Mateusz Łoskot
58fbda0483
Avoid dereferencing iterators over empty indexed data values
It seems the values can be empty even if size of blocks
is non-zero (e.g. blocks.size()==1)
2020-11-23 21:21:35 +01:00
Desone Burns II
e693b8963a Remove unsigned 0 comparison 2020-11-19 17:15:17 -07:00
Desone Burns II
5b6e82fa9c Revert "Copy nodes to lua table"
This reverts commit a7a088d416.
2020-11-19 17:14:38 -07:00
Desone Burns II
a7a088d416 Copy nodes to lua table 2020-11-19 15:39:31 -07:00
Desone Burns II
43b920bfb5 Merge branch 'master' of https://github.com/Project-OSRM/osrm-backend into upgrade_libsol2_v2.20.6 2020-11-18 17:11:02 -07:00
Desone Burns II
deacc8fb5c Update to sol2 v2.20.6 2020-11-18 17:01:43 -07:00
Denis Chapligin
a3f1c2afb0
Merge pull request #5882 from mjjbell/mbell/windows_contractor
Fix osrm-contract, tests, on Windows
2020-11-18 14:33:57 +02:00
Denis Chapligin
7e4fbaf4a8
Merge pull request #5884 from dburnsii/upgrade_libosmium_v2.15.6
Upgrade libosmium to v2.15.6
2020-11-18 10:41:28 +02:00
Desone Burns II
dfc1bfc27e Upgrade libosmium to v2.15.6 2020-11-17 14:59:06 -07:00
Michael Bell
96acdaf0d5 Fix osrm-contract, tests, on Windows
As part of graph contraction, node renumbering leads to
in-place permuting of graph state, including boolean vector elements.

std::vector<bool> returns proxy objects when referencing individual
bits. To correctly swap bool elements using MSVC, we need to explicitly
apply std::vector<bool>::swap.

Making this change fixes osrm-contract on Windows.

We also correct failing tests and other undefined behaviours
(mainly iterator access outside boundaries) highlighted by MSVC.
2020-11-15 14:22:26 +00:00
Denis Chapligin
98fd17589d
Merge pull request #5868 from wangyoucao577/feature/unify-turn-index-dump
Unify .osrm.turn_penalties_index dump same with turn_weight_penalties/turn_duration_penalties
2020-11-10 11:20:55 +02:00
Denis Chapligin
21444ce7cb
Merge pull request #5878 from mjjbell/mbell/fix_windows_partition
Fix bit-shift overflow in MLD partition step for Windows builds
2020-11-09 11:43:14 +02:00
Michael Bell
b840c0be95 Fix bit-shift overflow in MLD partition step for Windows builds
For very large graphs, generation of MLD level masks fail on Windows
due to bit shift overflow of unsigned long values.

Correct by using unsigned long long literals, which are 64 bit on
all major systems.
2020-11-08 03:51:11 +00:00
Jay Zhang
17eb39d0a9 fix: clangformat 2020-10-26 01:19:17 +00:00
Jay Zhang
c090457f1f docs: changelog 2020-10-23 09:48:21 +00:00
Jay Zhang
7d28b7aa3a feat: unify turn_penalties_index dump same with turn_weight_penalties and turn_duration_penalties 2020-10-23 09:38:56 +00:00
Guannan Du
1ba8aba466
Fix Issue#5864 build errors on mac OS (#5865)
* Fix Issue#5864 build errors on mac OS

Co-authored-by: Guannan Du <guannan.du@Guannans-MacBook-Pro-2.local>
2020-10-21 07:00:55 -07:00
Denis Chapligin
9f80f6d64d
Merge pull request #5859 from akashihi/protozeroupdate
Updated bundled protozero to v1.7.0
2020-10-20 10:45:32 +03:00
Denis Chaplygin
a8362d75b5 Updated bundled protozero to v1.7.0 2020-10-16 10:28:48 +03:00
Daniel Patterson
df3ed43d70
Reset master for next version. 2020-10-14 14:10:33 -07:00
Daniel Patterson
c021cea770
Prepare 5.23.0 release 2020-10-14 14:08:23 -07:00
Daniel Patterson
628784eb7d
Prepare 5.23.0-rc.2 2020-10-08 20:14:10 -06:00
Daniel Patterson
440fb61f8f
Merge branch 'master' into 5.23 2020-10-08 16:27:25 -06:00
Michael Bell
f87a324633
Fix crash in MLD alternative search if source or target are invalid (#5851)
In situations where there is not a valid source or target phantom
node (e.g. when snapping to an edge with a zero weight), a
heap assertion will fail in the MLD alternative search code.

We fix this by checking for empty heaps before proceeding with
the search.
2020-10-08 15:27:02 -07:00
Daniel Patterson
2222ee6a67
Prepare 5.23.0-rc.1 2020-10-07 16:21:00 -06:00
Michael Bell
e033e0b553
Fix table result when source and destination on same one-way segment (#5828)
Fixes #5788

Table queries where source and destination are phantom nodes
on the same one-way segment can fail to find valid routes.

This is due to a bug in the MLD table generation for the
special case where the query can be simplified to a
one-to-many search.
If the destination is before the source on the one-way segment,
it will fail to find a route.

We fix this case by not marking the node as visited at the start,
so that valid paths to this node can be found later in the search.

We also remove redundant initialization for the source
node as the same actions are performed by a search step.
2020-10-07 14:58:13 -07:00
Daniel Patterson
c24f917dcf
Cleanup changelog in master to match current release state. 2020-10-07 14:58:38 -06:00
Denis Chapligin
1e98ae7efe
Merge pull request #5849 from akashihi/leftfeature
Driving side property added to driving_side.geojson
2020-10-06 19:07:12 +03:00
Denis Chaplygin
55b3260cc3 Driving side property added to driving_side.geojson 2020-10-06 09:01:22 +03:00
Daniel Patterson
3451d1ec82
Lock access to facade_factory in data_watchdog to avoid accessing destructed object (#5844)
* Wrap access to facade_factory in a shared lock so it doesn't get changed partway through access which leads to a crash.
2020-09-30 18:45:44 -07:00
Michael Bell
4799b46eeb
Incorrect error message when unable to snap all input coordinates (#5846)
In cases where we are unable to find a phantom node for an input
coordinate, we return an error indicating which coordinate failed.

This would always refer to the coordinate with index equal to the
number of valid phantom nodes found.

We fix this by instead returning the first index for which a
phantom node could not be found.
2020-09-30 18:44:22 -07:00
Denis Chapligin
f6b313e958
Merge pull request #5836 from fofanov/mbell/remove_future
Remove unused future
2020-09-30 18:23:00 +03:00
Michael Bell
d3ab6f1fca Remove unused future
The serialization of the compressed node based graph was changed in
c410c2 to no longer be asynchronous.

This removes the unused future object.
2020-09-22 23:01:06 +01:00
Denis Chapligin
523d9e9c05
Merge pull request #5824 from alistairwoodcock/nodejs-doc-table-annotations
Annotations was missing as part of the table documentation
2020-09-10 10:29:01 +03:00
Alistair Woodcock
8e81034bb2 Annotations was missing as part of the table documentation 2020-09-10 09:23:25 +10:00
Denis Chapligin
4a47267455
Merge pull request #5821 from slavanap/master
Make MMapMemoryAllocator map files in read-only (O_RDONLY) mode
2020-09-09 14:09:31 +03:00
Vyacheslav Napadovsky
f545f2293e Make MMapMemoryAllocator map files in read-only (O_RDONLY) mode. Mapping with O_RDWR will cause copy_up across Docker layers. 2020-09-09 00:51:42 +03:00
Denis Chapligin
78160c0fe4
Merge pull request #5813 from woltapp/tbbdeprecation
Partially fixes use of deprecated TBB features
2020-09-08 11:17:32 +03:00
Denis Chapligin
a35961ca6a
Merge pull request #5814 from woltapp/boostdeprecation
Removed references to obsolete Boost.Test headers.
2020-09-08 11:12:38 +03:00
Denis Chaplygin
933e36190f
Removed catching of obsolete tbb:captured_exception, as TBB now supports C++ native std::exception_ptr inter-thread exception passing mechanism. 2020-09-04 09:33:43 +03:00
Denis Chaplygin
03d9e7a8ce
Deprecated tbb::task_scheduler_init replaced with std::thread and tbb::global_control 2020-09-04 09:33:43 +03:00
Denis Chaplygin
7e24dcfd0a
Removed references to obsolete Boost.Test headers. 2020-09-02 13:16:44 +03:00
Denis Chapligin
cdce2af1c9
Merge pull request #5536 from leighghunt/master
Updating extent of Hong Kong in list of left-hand drive countries
2020-09-02 11:48:36 +03:00
Leigh Hunt
3116734bec Merge branch 'master' of github.com:Project-OSRM/osrm-backend 2020-09-02 09:52:01 +12:00
Denis Chapligin
4d6272b030
Merge pull request #5569 from rdvelazquez/master
Update kCellsAtMostSameBy comment
2020-08-21 12:07:27 +03:00
Denis Chapligin
a7993eebac
Merge pull request #5760 from woltapp/nostxxl
Removed STXXL support.
2020-08-20 13:19:53 +03:00
Denis Chaplygin
2d0b2ca987
Removed STXXL support. 2020-08-20 11:54:02 +03:00
Lev Dragunov
699ca2bbd0
Merge pull request #5758 from woltapp/gcc10
Fixes signed/unsigned comparision spotted by gcc10.
2020-08-20 10:59:23 +03:00
Denis Chapligin
8b40c594be
Merge pull request #5784 from OgreTransporter/bugfix-cmaketbb-5782
Bugfix TBB linking #5782
2020-08-19 12:39:00 +03:00
Denis Chapligin
909570fd7f
Merge pull request #5711 from wingyplus/fix-debug-example
Fix profiles/debug_example.lua cannot interprete by lua
2020-08-19 11:15:06 +03:00
Denis Chapligin
df9fda177d
Merge pull request #5384 from wangyoucao577/clean-comments
correct comments for "compress edge if it crosses a traffic signal"
2020-08-18 17:21:23 +03:00
Jay Zhang
d2e7e6e9e6 improve comment description 2020-08-12 15:18:58 +08:00
Denis Chapligin
b9ebe0c369
Merge pull request #5628 from wangyoucao577/feature/disable-debug-log-compile-time-control
Control release mode debug logging output by ENABLE_DEBUG_LOGGING option
2020-08-11 10:27:27 +03:00
Jeroen Hoek
cd4e6a1fe3
Fix broken path in documentation (#5636)
Replaces references to
`include/extractor/guidance/road_classification.hpp` with
`include/extractor/road_classification.hpp`.

The latter is included in the project.
2020-08-10 08:50:15 -07:00
dburnsii
5cac188711
Update profiles.md (#5795)
Fixed a small typo
2020-08-07 13:44:32 -07:00
Jay Zhang
b7fa2c5981 docs: update changelog 2020-07-29 06:02:19 +00:00
Jay Zhang
106082f6f8 feat: add ENABLE_DEBUG_LOGGING option to control debug logging output 2020-07-29 06:00:47 +00:00
Jay Zhang
36d34073da Revert "chore: remove compile time debug log control"
This reverts commit 1ada466081.
2020-07-29 05:10:12 +00:00
Denis Chapligin
57ed232423
Merge pull request #5783 from OgreTransporter/bugfix-lua-5781
Bugfix Lua 5.4 not working
2020-07-28 15:52:58 +03:00
Denis Chapligin
24f12c9d1b
Merge pull request #5732 from lukasz-jagielski-bolt/lkj/compile_with_node_12
Try to fix node 12 compilation issues
2020-07-28 14:42:04 +03:00
Denis Chapligin
bdf2222f6a
Merge pull request #5729 from akashihi/builddataatwolt
Moved test data files to Wolt provided hosting.
2020-07-28 09:43:40 +03:00
Denis Chaplygin
220ad9fe8c
JS tests temporarily disabled as they fail with OOM. 2020-07-23 11:27:58 +03:00
Denis Chaplygin
ae6326719a
Removed CONSTEXPR requirement for a boost, as we need at least c++14 for rest of the code. 2020-07-23 11:27:58 +03:00
Denis Chaplygin
0503a2fcd3
Appveyor build now uses dependency files hosted at Wolt. 2020-07-23 11:27:57 +03:00
Denis Chaplygin
219f2c3aa9
Added windows dependencies building manual. 2020-07-23 11:27:57 +03:00
Denis Chaplygin
493e821b93
Monaco test map moved to the git repository. 2020-07-23 11:27:56 +03:00
Transporter
9c3eeffe2c Bugfix TBB linking #5782
The query if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug) only works if you call CMake explicitly with the build configuration Debug. But if you generate Debug and Release all libraries are linked to the release version.
2020-07-16 19:14:48 +02:00
Transporter
526191256c Bugfix Lua 5.4 not working #5781
In Lua 5.4 the function lua_resume now has an extra parameter. This out parameter returns the number of values on the top of the stack that were yielded or returned by the coroutine (in previous versions, those values were the entire stack.). The constant LUA_ERRGCMM was removed. Errors in finalizers are never propagated; instead, they generate a warning.
2020-07-16 19:08:37 +02:00
Łukasz Jagielski
9861faa456 nodejs: user worker thread friendly initialization 2020-07-07 09:01:52 +02:00
Denis Chaplygin
919fe74c40
Fixes signed/unsigned comparision spotted by gcc10.
Fixed by moving assertion to the actual point where signed values are used.
2020-06-17 13:18:21 +03:00
张庚昕
365121dac4
add generate_hints parameter info to document (#5754) 2020-06-11 06:43:03 -07:00
Łukasz Jagielski
cbec111eb6 include/nodejs/node_osrm.hpp: clang-format 2020-05-12 15:16:38 +02:00
Łukasz Jagielski
7d369b9ab9 Try to fix node 12 compilation issues 2020-05-05 23:34:26 +02:00
Thanabodee Charoenpiriyakij
2c13f2f735 Fix profiles/debug_example.lua cannot interprete by lua
After run `lua5.1 profiles/debug_example.lua`, I got result:

```
lua5.1: debug_example.lua:41: attempt to call field 'way_function' (a nil value)
stack traceback:
        debug_example.lua:41: in main chunk
        [C]: ?
```

This is because Debug has not way_function in the module. This changes
change it to process_way and it's works!!
2020-04-09 16:05:37 +07:00
Lev Dragunov
15f0ca8dda
Merge pull request #5608 from mariusre/http_parsing_fix
made whitespace between Header-key and value otional
2019-12-18 11:32:00 +03:00
Marius Rescheleit
d59ecb321e
added complete link to issue 2019-12-11 13:28:57 +01:00
Lev Dragunov
404ebb1898
Merge pull request #5624 from arnekaiser/patch-1
Update profiles.md
2019-12-10 10:23:18 +03:00
Jay Zhang
11b0a2e02a docs: update change log 2019-12-09 23:19:37 +08:00
Jay Zhang
1ada466081 chore: remove compile time debug log control 2019-12-09 17:53:28 +08:00
Arne
973722d0ec
Update profiles.md 2019-12-05 17:17:31 +01:00
Marius Rescheleit
ca5d17adab
Update CHANGELOG.md 2019-12-03 12:21:53 +01:00
Lev Dragunov
68dcab7c15
Merge pull request #5622 from jdhoek/bug/bicycle_use_sidepath
Bicycle: treat use_sidepath as no access
2019-12-02 14:32:30 +03:00
Jeroen Hoek
92406da194 Bicycle: treat use_sidepath as no access
Fixes #5557.
2019-12-01 18:34:58 +01:00
marius
6d8cf826d7 modified FSM so that the whitespace between header-key and value is optional 2019-11-19 18:30:21 +01:00
Lev Dragunov
48be5a5622
Merge pull request #5604 from jdesgats/fix-guidance-so
fix: install the osrm_guidance library
2019-11-19 14:41:21 +03:00
Julien Desgats
46ab931c64 fix: install the osrm_guidance library
In the case of a shared object compilation, the resulting binaries need
that library. It was not installed along the others, leading to failures
when running osrm-extract.

Fixes #5603
2019-11-15 10:32:27 +00:00
Lev Dragunov
0b139ff05d
Merge pull request #5572 from Tomonobu3110/tomo_less_memory
Reduce memory usage for raster source handling.
2019-11-14 12:58:59 +03:00
Tomonobu Saito
9da6cf8764 add: comment for RasterCache class 2019-11-13 11:01:07 +09:00
Tomonobu Saito
ee177efe41 fix: remove unused include / add const for necessity portion 2019-11-08 16:15:38 +09:00
Tomonobu Saito
fd0f1b60bb fix by revier comments 2019-11-06 11:06:29 +09:00
Tomonobu Saito
9c1c842b79 update CHANGELOG.md 2019-10-10 12:26:13 +09:00
Tomonobu Saito
17f32f4ca1 fix coding format 2019-10-09 13:35:19 +09:00
Tomonobu Saito
542c3ba872 Add singletone class RasterCache to handle global cache data. 2019-10-09 13:02:59 +09:00
Tomonobu Saito
f36707d1fb revert file mode to 664 2019-10-04 17:39:05 +09:00
Tomonobu Saito
a587b14006 destruct static vector and unorderd_map when last RasterContainer is destructed. 2019-10-04 17:30:35 +09:00
Tomonobu Saito
f9ee74d78e Add x range check to avoid data corruption. 2019-10-04 16:47:31 +09:00
Tomonobu Saito
eef072234e update delim chars 2019-10-04 15:14:20 +09:00
Tomonobu Saito
a9fce74e63 remove unused code (debug code) 2019-10-04 14:02:57 +09:00
Tomonobu Saito
432d49e23d bugfix: support multiple delimitor. 2019-10-04 13:50:13 +09:00
Tomonobu Saito
e4aaf07879 remove unused lines 2019-10-03 17:24:42 +09:00
Tomonobu Saito
d316ff9d41 Improvement of raster source loading to reduce consumed memory size. 2019-10-03 16:44:27 +09:00
Ryan Velazquez
921c2f9482
Update kCellsAtMostSameBy comment 2019-10-02 07:12:42 -04:00
Tomonobu Saito
62c8b70f78 use boost::filesystem::file_size() to get the file size (instead of seeking the file). 2019-10-02 19:04:01 +09:00
Lev Dragunov
f520379419
Merge pull request #5566 from akashihi/flatbuffernosoptional
Flatbuffers is not a boost::optional friendly
2019-10-02 11:12:19 +03:00
Tomonobu.Saito (Desktop PC)
d8d9ac8686 Add assert to check memory allocation 2019-10-02 15:47:16 +09:00
Denis Chaplygin
016c77a4de Flatbuffers is not a boost::optional friendly 2019-10-01 17:26:10 +03:00
Lev Dragunov
0205cbc578
Merge pull request #5561 from peoplestom/pessimistic_move
Removed un-needed calls to std::move
2019-10-01 17:12:39 +03:00
Tom Peoples
28895373fb Fixed flatbufferbuiler copy issues.
Compiling under gcc9.1 we get copy issues.
It appears we shouldn't pass builder classes by value, only ref.
2019-10-01 21:54:00 +10:00
Tom Peoples
018a9bc804 Removed un-needed calls to std::move
These calls were throwing a pessimistic move error and stopping compilation.
2019-09-26 17:55:19 +10:00
Lev Dragunov
71433c67b1
Merge pull request #5556 from akashihi/skipwaypoints
Skipwaypoints
2019-09-26 10:33:43 +03:00
Denis Chaplygin
d25a530942 Added cucumber test for skip_waypoint feature 2019-09-23 11:38:33 +03:00
Denis Chaplygin
a6097cdc01 Changelog updated 2019-09-17 17:56:27 +03:00
Denis Chaplygin
50a1c8a08d Added flatbuffers support to Table service cucumber tests 2019-09-17 17:42:52 +03:00
Denis Chaplygin
6214f16552 Updated http API documentation with skip_waypoints. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
e97ec13064 Formatted the sources 2019-09-17 17:42:52 +03:00
Denis Chaplygin
fa5567e669 Added unit tests for 'skip waypoints' on Trip/Match services 2019-09-17 17:42:52 +03:00
Denis Chaplygin
a9d4e28e38 Added unit test for flatbuffers serialization of Match/Trip responses. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
a5127539eb Added unit tests of 'skip_waypoints' option to the Nearest/Route/Table services. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
660c0cc602 Implemented 'skip_waypoints' for the 'Table' service. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
600f48e15a Implemented 'skip_waypoints' support in 'Route', 'Trip', 'Match' services. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
1b47242a58 Implemented 'skip_waypoints' for the 'Nearest' service.
It actually makes no sence, as the only output on the 'Nearest' service
is a list of wypoints. On the other hand it can be used now as a simple
health check.
2019-09-17 17:42:52 +03:00
Denis Chaplygin
10c1b38139 Added new base parameter 'skip_waypoints' 2019-09-17 17:42:52 +03:00
Lev Dragunov
81071b5af9
Merge pull request #5546 from akashihi/keepaliveclear
clear input/output buffers during keepalive clean-up procedure.
2019-09-10 19:01:42 +03:00
Denis Chaplygin
746b2e94a0 Formatted the code 2019-09-10 15:50:13 +03:00
Denis Chaplygin
43f60bc69c We should check, is connections is still open and gracefully return on connection closed by remote. 2019-09-10 14:32:16 +03:00
Denis Chaplygin
145974bc92 clear input/output buffers during keepalive clean-up procedure.
Should fix #5545
2019-09-09 11:20:47 +03:00
Leigh Hunt
c9bd9a967c
Update driving_side.geojson
Removing copy/paste error
2019-09-04 12:49:41 +12:00
Leigh Hunt
3c607a4570
Update driving_side.geojson
Completely overwriting with latest version from https://github.com/openstreetmap/iD/pull/6827, as per @danpat's suggestion.
2019-09-04 12:48:15 +12:00
Leigh Hunt
6dfcfcb105
Adding entry to change log for #5535 2019-09-03 16:52:30 +12:00
Leigh Hunt
e701243641
Updating extent of Hong Kong
Might be a little rough around Sha Tau Kok
2019-09-03 16:45:50 +12:00
Lev Dragunov
f1a4b70a56
Merge pull request #5513 from akashihi/flatbuffers
Flatbuffers support added
2019-08-29 13:11:24 +03:00
Lev Dragunov
df60947794
Merge pull request #5528 from akashihi/nokeepaliveduplicates
connection's reply needs to be reset before handling next request on …
2019-08-29 12:56:27 +03:00
Denis Chaplygin
cd7229ba06 connection's reply needs to be reset before handling next request on same connection. 2019-08-28 17:22:07 +03:00
Denis Chaplygin
624724031d flatbuffers javascript libraries excluded from linting, as it makes no sene to lint generated code. 2019-08-26 15:29:27 +03:00
Denis Chaplygin
0be87c73cf Fixed typo in flatbuffers: longitute -> longitude. 2019-08-26 14:31:51 +03:00
Denis Chaplygin
b8182dd7ff Replaced 'in' and 'out' at the flatbuffers 'instersection' object
with 'in_bearing' and 'out_bearing' to get flatbuffers schema javascript friendly.

Added a cucumber test for flatbuffers support.
2019-08-26 14:03:29 +03:00
Denis Chaplygin
80e1abba0c Added setting 'data_version' to all flatbuffers response functions. 2019-08-26 11:09:38 +03:00
Denis Chaplygin
ce71e08ef1 Added tests for Nearest/Table/Route flatbuffers serialization. 2019-08-26 11:09:38 +03:00
Denis Chaplygin
97270ae473 Fixed nested offsets inside of the flatbuffers structure 2019-08-26 11:09:38 +03:00
Denis Chaplygin
a9c187c99b Updated changelog entry 2019-08-26 11:09:38 +03:00
Denis Chaplygin
ff46e98d21 Library example now shows, how to use different output formats. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
a196e67e1a Vendored flatbuffers headers should be installed with the libosrm 2019-08-26 11:08:56 +03:00
Denis Chaplygin
1a259ccca0 base_result is a part of public API now, so it needs to be installed 2019-08-26 11:08:56 +03:00
Denis Chaplygin
2a1593fe05 Flatbuffers now uses floats instead of double. We do not use that precision anyway and it make output much smaller. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
5888894787 Added short flatbuffers introduction. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
73f544d4da Slightly changed the serialization order. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
889c82516f Set flatbuffers root type and removed unneded array for rows/cols 2019-08-26 11:08:56 +03:00
Denis Chaplygin
306c047c14 Generalized flatbuffers response generation in 'Route','Trip','Match' services. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
533f1ffc6b Inlined routes and waypoints, as all services are using at least one of those object, so there is no need for another one level of indirection. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
a44a75b211 Unit tests are compatible with new plugin API. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
e26a5cc392 Added flatbuffers compatibility to the Node 2019-08-26 11:08:56 +03:00
Denis Chaplygin
90191c9f34 Added flatbuffers output support to the 'Match' service 2019-08-26 11:08:56 +03:00
Denis Chaplygin
b7e9e5f2c0 Added flatbuffers output support to the 'Trip' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
13287d9970 Optimizing FB schema:
* Replaced Response union with nullable fields
* "Ok" code replaced with a boolean and a separate structure for a error code and message.
* Inlined geometry, thus removing one layer of indirection.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
affa8a4653 Added flatbuffers output support to the 'Route' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
9d7a74445d Added flatbuffers output support to the 'Nearest' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
acd3e81ab4 Removed ineffectivness in the serialization schema. Positions are
structs now and distance/duration matrices are just arrays.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
ea111129dd Added full flatbuffers support to the Table service 2019-08-26 11:08:56 +03:00
Denis Chaplygin
7ddda105a3 Added flatbuffers support to the PluginBase::Error
This changes BREAKS osrm.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
56406e80ce Added flatbuffer support to the server request handler. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
75aadb0f3f Passed ResultT down to engine plugins, so now they can form replies in different formats. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
f6f86b2a52 Added flatbuffers schema. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
3f34c8d88c Flatbuffers library added to the list of third party libraries. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
59a83bd537 Added output format parser to the other services.
Same as for Route service, you can now specify either json or flatbuffers
as output format for the other services (except Tile service, where it
makes no sense).
2019-08-26 11:08:56 +03:00
Denis Chaplygin
59ca7840f4 Added output format parser to the Route service.
It is possible now to choose between json and flatbuffers (not yet implemented) output format.
Only route service is supported atm.
2019-08-26 11:08:56 +03:00
Lev Dragunov
88979d0d86
Merge pull request #5518 from akashihi/keepalive
Keepalive
2019-08-23 14:52:08 +03:00
Denis Chaplygin
2462826c20 Added changelog entry. 2019-08-23 13:07:17 +03:00
Denis Chaplygin
9efcab2108 Receive timeout should only be active for a second and
following requests on a keep-alive connections.
2019-08-23 12:21:54 +03:00
Denis Chaplygin
4fbf58adb3 Documented HTTP server 'keep-alive' support 2019-08-23 12:21:54 +03:00
Denis Chaplygin
a7b7d77e1f Formatted the code. 2019-08-23 12:21:54 +03:00
Denis Chaplygin
22550d078f Added timeout handling for keep-alive operations. 2019-08-23 12:21:54 +03:00
Denis Chaplygin
a0582a3e68 Added keep-alive support to the http server. 2019-08-23 12:21:54 +03:00
Denis Chaplygin
92c7b6fbd1 Added 'Connection' header extraction. 2019-08-23 12:21:54 +03:00
Lev Dragunov
86aebc0812
Merge pull request #5471 from stastnypremysl/master
Solving problem with g++8 and boost libs:
2019-05-28 17:45:06 +03:00
Přemysl Šťastný
b4f849adaa Solved this warning:
In file included from /home/travis/build/Project-OSRM/osrm-backend/include/storage/shared_data_index.hpp:4,
                 from /home/travis/build/Project-OSRM/osrm-backend/include/engine/datafacade/contiguous_block_allocator.hpp:4,
                 from /home/travis/build/Project-OSRM/osrm-backend/include/engine/datafacade/contiguous_internalmem_datafacade.hpp:5,
                 from /home/travis/build/Project-OSRM/osrm-backend/include/engine/plugins/nearest.hpp:5,
                 from /home/travis/build/Project-OSRM/osrm-backend/src/engine/plugins/nearest.cpp:1:
/home/travis/build/Project-OSRM/osrm-backend/include/storage/shared_datatype.hpp:102:26: warning: inline function ‘virtual void* osrm::storage::BaseDataLayout::GetBlockPtr(void*, const string&) const’ used but never defined
     virtual inline void *GetBlockPtr(void *base_ptr, const std::string &name) const = 0;
2019-05-28 12:45:47 +02:00
Přemysl Šťastný
d964d368aa added g++8 to travis; -Wno-cast-function-type flag added because https://github.com/nodejs/nan/issues/807 2019-05-28 12:44:48 +02:00
Přemysl Šťastný
38700e207e Solving problem with g++8 and new boost libs:
osrm-backend/src/storage/io_config.cpp:18:89: error: call of overloaded ‘is_regular_file(<brace-enclosed initializer list>)’ is ambiguous
         if (!boost::filesystem::is_regular_file({base_path.string() + fileName.string()}))
                                                                                         ^
In file included from /usr/local/include/boost/filesystem.hpp:17,
                 from /home/premy/packages/osrm-backend/include/storage/io_config.hpp:8,
                 from /home/premy/packages/osrm-backend/src/storage/io_config.cpp:1:
/usr/local/include/boost/filesystem/operations.hpp:473:8: note: candidate: ‘bool boost::filesystem::is_regular_file(const boost::filesystem::path&)’
   bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
        ^~~~~~~~~~~~~~~
In file included from /usr/local/include/boost/filesystem.hpp:17,
2019-05-28 12:43:27 +02:00
Lev Dragunov
817aeace55
Merge pull request #5417 from TehNrd/node-js-docs
Update nodejs api docs with dataset_name parameter
2019-05-27 15:13:16 +03:00
Lev Dragunov
501e866992
Merge pull request #5389 from gojuno/max_height_decrease
Decrease max height to 2 meters
2019-05-27 14:57:19 +03:00
Jason Venable
f2724e9e63 Update nodejs api docs with dataset_name parameter 2019-03-29 10:36:34 -04:00
Ilya Zverev
2820853fb6 Update changelog 2019-03-04 13:30:10 +03:00
Ilya Zverev
f5ebe8bc3b Update comment 2019-03-04 13:27:16 +03:00
Ilya Zverev
98294e3ddd Decrease max height to 2 meters 2019-03-04 13:23:17 +03:00
Jay Zhang
ce33f1ae98 correct comments 2019-03-01 22:33:44 +08:00
RhinoDevel
e86d93760f Table distances & durations work with MLD, too (v5.22.0) (#5377) 2019-02-26 08:41:33 -08:00
Ilya Zverev
a1e5061799 Decrease default car weight to 2 tons (#5371)
* Decrease default car weight to 2 tons
* Add a link to PR to the change log
2019-02-20 10:19:18 -08:00
Daniel Patterson
2c7c18fd24 Fix bug in snapping=any when bearings or radiuses are supplied. 2019-02-15 20:42:30 -08:00
Raf Czlonka
5ddbb25237 Use an environment variable instead of command substitution (#5364)
`$PWD` is already there so use it instead of running `pwd(1)` in a subshell each time.
2019-02-15 15:47:05 -08:00
Raf Czlonka
9ba60d0d5c Quote command line options which may contain special characters (#5362)
I.e. the example commands fail if $PWD contains a space character.
2019-02-15 08:59:02 -08:00
Daniel Patterson
4f0ec785f6
Configurable snapping behaviour (#5361) 2019-02-14 17:14:50 -08:00
Kajari Ghosh
02b50458b0 Update taginfo.json (#5356) 2019-02-07 14:55:57 -08:00
Daniel Patterson
0a556fe450
Fix changelog. 2019-02-04 16:15:19 -08:00
Daniel Patterson
f2f167c95d
Allow routing past barrier=arch. (#5352) 2019-02-04 16:14:43 -08:00
Lev Dragunov
8b45ff7a18
Store metadata about original OSM data, and return it in the API response, if available. 2019-01-30 15:31:56 -08:00
Daniel Patterson
4c665b24d9
Add optional builds for lts and node version aliases. This will give us a heads up when new Node (#5347)
versions break bindings, and might automagically get us support for new versions if it "just works".
2019-01-30 12:17:04 -08:00
Daniel Patterson
381d492a8f
Add waypoints parameter to viaroute API (#5345)
* Add silent waypoints to viaroute API.
2019-01-24 16:19:59 -08:00
Daniel Patterson
e250c83c21 Add BUILD_CONCURRENCY argument so that we can limit concurrency on Docker Hub (and thus reduce peak memory need for build) 2019-01-17 16:16:44 -08:00
Andrii Dmytrenko
e2e326d15e Fix cpack config by pointing to a correct LICENSE file 2019-01-17 09:45:11 -08:00
Daniel Patterson
4abca85474 Downgrade to debian:stretch-slim to ensure stable environment for building. 2019-01-11 16:46:28 -08:00
Daniel Patterson
2c78d862a3
Reset master for next release. 2018-12-18 16:25:51 -07:00
Daniel Patterson
b1451a7421
Release 5.21.0 2018-12-18 16:17:34 -07:00
Daniel Patterson
da1c251144
Prep 5.21.0-rc.1 2018-12-15 21:43:10 -07:00
Daniel Patterson
1eab7b41d1 Update CHANGELOG. 2018-12-15 21:07:06 -07:00
Daniel Patterson
1dca8ae76a Correct invalid tests - these captured the incorrect behaviour, the matrices should've been symmetrical (a->o == o->a for these cases) 2018-12-15 21:07:06 -07:00
Daniel Patterson
002e86863d Add test to ensure forward/reverse snapping distances are correct, and fix some tests that were incorrect due to the bug. 2018-12-15 21:07:06 -07:00
Daniel Patterson
1d82b01816 Count reverse offset from the back of the geometry, not the front. 2018-12-15 21:07:06 -07:00
Frédéric Rodrigo
714719c377 Lua maxspeed parsing refactoring (#5144)
* Lua maxspeed parsing refactoring
2018-12-14 21:58:07 -07:00
Huyen Chau Nguyen
77b4fbb69c Fix maxspeed to consider source:maxspeed tags (#5217)
* In Belgium the maximum speed in rural areas is 70 in the region Flanders
* parse maxspeed using source:maxspeed and maxspeed:type tags
* add changelog
* make maxspeed:advisory more important than maxspeed
* add test for source:maxspeed
2018-12-14 21:42:44 -07:00
Matt Riggott
11fde865f7 Document switch to Debian base images (#5281)
* Document switch to Debian base images
2018-12-14 21:36:09 -07:00
Salim KAYABASI
717406043a Remove unused Node binary publishing, and upgrade build environment.
Upgrades the build environment to Node 10, which let's us pull down some security fixes in package dependencies that were unfixed in Node 4.

Also removes Node 4 and 6 binary publishing which were almost never used (20 downloads out of 50,000).

Fixes https://github.com/Project-OSRM/osrm-backend/issues/5312
2018-12-14 21:34:48 -07:00
Daniel Patterson
1ef85c57cc Upgrade CI environment to Node 10, remove builds for < Node 8
Remove yarn, npm is fast now, and comes with node.
Synchronize package-lock.json and package.json
2018-12-14 14:56:21 -07:00
Daniel Patterson
d0180517a8
Merge branch 'master' of github.com:Project-OSRM/osrm-backend 2018-12-14 11:54:00 -07:00
Daniel Patterson
520b7ebbb6
Remove 5.20 build trigger from master branch - should only exist on release branches. 2018-12-14 11:53:48 -07:00
Dinesh Weerapurage
2caba96076 using libboost 1.67 in both build and run stages (#5311)
* using libboost 1.67 in both build and run stages, added execution permision for /opt
2018-12-14 11:51:05 -07:00
Daniel Patterson
81bc2f41a6
When matching, ignore 'is_startpoint' propert, snap to any edge (#5297)
Includes all edges in the rtree, but adds an `is_startpoint` flag to each.  Most plugin behaviour remains unchanged (non-startpoint edges aren't used as snapping candidates), but for map matching, we allow snapping to any edge.  This fixes map-matching across previously non-is_startpoint edges, like ferries, private service roads, and a few others.
2018-12-13 17:10:32 -07:00
Daniel Patterson
06e010b4d0 Include information on estimates in table response (#5259)
* Revert "Remove estimated_cells value in the response."

This reverts commit 364e35af06.

* Update changelog.

* fix linting

* adjust fallback_speed check

* change [].includes to [].indexOf !== -1 for compatibility with node 4

* change param name

* more cuke tests

* fix formatting
2018-12-11 12:21:57 -05:00
Kajari Ghosh
92d3ce789b
Fix scale_factor bug (#5303)
* check for scale_factor != 1

* changelog
2018-12-10 17:11:08 -05:00
Kajari Ghosh
01ca32c81c
Fix fallback speed validity checks (#5300)
* fix fallback_speeds check to only accept values > 0

* add invalid_fallback_speed
2018-12-10 14:53:30 -05:00
Kajari Ghosh
2e17f3010a
Add a multiplier to the matrix (#5298)
* add a multiplier to the matrix

* add rounding

* remove scale_factor restrictions

* clamp for overflow error

* update check to match error message

* enforce clamping on < 0 and increase test coverage

* add an invalid scale_factor value to node tests

* increase test coverage

* changelog
2018-12-10 13:41:44 -05:00
Kajari Ghosh
c4238c4ed6
Backport-v5.20.0 (#5301)
* Prepare RC.1

* Bump version.

* remove destination/sources length <= coordinates length check (#5289)

* Add node 10 builds to travis (#5246)

* Add node 10 builds to travis

* Add changelog

* bump version to rc5

* Fix fallback_speed vector access (#5291)

* add failing cuke test

* correctly access durations vector

* changelog

* one more cuke test

* bump rc version

* 5.20.0

* remove line from changelog about commit that isn't actually in here

* update CHANGELOG and osrm version in package.json for v5.20.0

* bump to restart appveyor
2018-12-10 11:27:13 -05:00
Kajari Ghosh
3d781e6f28
Fix fallback_speed vector access (#5291)
* add failing cuke test

* correctly access durations vector

* changelog

* one more cuke test
2018-12-05 00:41:06 -05:00
Daniel Paz-Soldan
4976233cff Add node 10 builds to travis (#5246)
* Add node 10 builds to travis

* Add changelog
2018-12-04 14:13:49 -05:00
Kajari Ghosh
98ea2a0b09
remove destination/sources length <= coordinates length check (#5289) 2018-12-04 13:35:26 -05:00
Dinesh Weerapurage
f978900ab0 adding a debian based docker image 2018-11-08 12:03:35 +01:00
Daniel Patterson
8b6580128b
Merge pull request #5255 from Project-OSRM/danpat_snapped_distance_everywhere
Return 'distance' in all waypoints for all APIs
2018-11-02 15:36:27 -07:00
Daniel Patterson
4dde9c7bbe
Include distance from input to snapped for all waypoints, not just on the nearest service. 2018-11-02 15:30:52 -07:00
Daniel Patterson
973837207b
Merge pull request #5257 from Project-OSRM/danpat_table_noroute_estimate
Use estimates for NoRoute in table requests
2018-11-02 01:41:50 -07:00
Daniel Patterson
364e35af06
Remove estimated_cells value in the response. 2018-11-02 01:08:59 -07:00
Daniel Patterson
985ab58f45
Add feature to fill null table entries with as-the-crow-flies estimates. 2018-11-02 01:07:24 -07:00
Daniel Patterson
cb1db646f2
Merge pull request #5251 from Project-OSRM/danpat_cache_distances
Pre-calculate distance values
2018-10-30 16:14:47 -07:00
Daniel Patterson
a67c4bf84d
Calculating durations is unavoidable due to tie-breaking minimums, but we can avoid accumulating distances if they're not requested. 2018-10-30 15:41:06 -07:00
Daniel Patterson
498259b220
Replace dynamic distance calculation for table plugin with pre-calculated distances on shortcuts, avoiding unpacking cost.
Adds approx 10% to total data size.  Speeds up large table requests by 2 orders of magnitude.

Co-authored-by: Kajari Ghosh <ghoshkaj@gmail.com>
2018-10-30 15:41:06 -07:00
Daniel Patterson
5327f8da4e
Timer script should error properly if something goes wrong, and print out what happened. 2018-10-30 15:41:06 -07:00
Daniel Patterson
802ccfb497
Merge pull request #5252 from Project-OSRM/danpat_pin_yarn
Pin Yarn to 1.11.1 so it works with Node4
2018-10-30 15:40:19 -07:00
Daniel Patterson
ec369d560a
Pin Yarn to 1.11.1 so it works with Node4 (https://github.com/yarnpkg/yarn/pull/6409#issuecomment-429181371) 2018-10-30 15:38:55 -07:00
Daniel Patterson
535647e439
Merge pull request #5242 from Project-OSRM/ghoshkaj_mmaperize
Support directly mmap-ing datafiles
2018-10-29 11:58:26 -07:00
Daniel Patterson
954121634f
Merge branch 'master' into ghoshkaj_mmaperize 2018-10-29 09:52:50 -07:00
Daniel Patterson
594a45e7e0
Re-use msinttypes bundled with RapidJSON when compiling on Windows. (#5249) 2018-10-29 09:51:56 -07:00
Daniel Patterson
96c7b47afe
Document new mmap_memory option in NodeJS API 2018-10-27 00:12:17 -07:00
Daniel Patterson
b7e7d32361
Expose new --mmap switch (mmap_memory: true in NodeJS), and run test suite in this mode, as well as shared memory mode. 2018-10-26 23:54:00 -07:00
Daniel Patterson
2f9cb44368
mmap tarfiles directly when mmapping is enabled, instead of copying data into separate mmapped block
Co-authored-by: Kajari Ghosh <ghoshkaj@gmail.com>
2018-10-26 23:53:59 -07:00
Daniel Patterson
d80318f8ea
Match serialized bit-packing for vector<bool> to match in-memory layout for vector_view<bool> so that data can be directly mmapped. 2018-10-26 23:53:50 -07:00
Daniel Paz-Soldan
b1791d1ab3 Fix anchor links in api docs (#5235) 2018-10-16 09:23:29 -07:00
Yota Toyama
a53da9095a Fix table node API docs (#5204) 2018-10-01 16:45:05 +03:00
Kajari Ghosh
72e03f9af9
update changelog after 5.19 release (#5203) 2018-09-11 00:34:40 -04:00
Kajari Ghosh
5597415f28
Revert "Improve speed of Map Matching" (#5196)
* Revert "Update changelog"

This reverts commit 9b779c704f.

* Revert "Fix formating"

This reverts commit 5bd7d04fe3.

* Revert "Fix bug in computation of distance offset for phantom node"

This reverts commit 0f78f7b2cc.

* Revert "Adjust text cases for flightly different matching due to rounding"

This reverts commit 8473be69d2.

* Revert "Round network distance to deci-meter to retain previous behavior"

This reverts commit c0124f7d77.

* Revert "Preserve heap state in map matching"

This reverts commit b630b4e32a.

* Revert "Use distance functions from many to many"

This reverts commit 89fabc1b9c.

* Revert "Use FCC algorithm for map matching distance calculation"

This reverts commit a649a8a5cf.
2018-09-06 12:05:28 -04:00
Jie
5476f6ab27 Fix GDB not work for osrm-routed on Linux (#5157)
As I mentioned in the issue #5156, I met below issue on my Win10+WSL(Ubuntu) env:
The remote debugger (VSCode on Win10, gdb on Ubuntu 18.04 LTS) works well from the beginning of the main() function. But when I step over the code pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask); (src/tools/routed.cpp(289)), below breakpoints can not work and displayed unverified breakpoint.

Then I found that gdb breakpoint need at least SIGTRAP, SIGSTOP to work (Please refer to [how debugger works](http://www.alexonlinux.com/how-debugger-works) for more details), but all signals are blocked in the source code until server initialized done.

In my understanding, block all signals DO NOT make sense for this osrm-routed process. Only several signals (SIGINT, SIGQUIT, SIGTERM) are expected to wait. So I made the change and it works well for me then.
2018-09-05 16:23:48 -07:00
Daniel Patterson
0971f06193 Add option to node bindings to return result as a pre-generated JSON string (this avoids a lot of overhead, and moves JSON string rendering out of the main event loop). 2018-09-05 15:09:13 -07:00
Daniel Patterson
85515f063a Render floating point numbers to string using Grisu2 algorithmt instead of stdlib to speed up JSON generation. 2018-09-05 14:20:47 -07:00
Daniel Patterson
69d7825542 Increase allowed shared memory regions to 512 from ~120 2018-09-05 11:48:02 -07:00
Patrick Niklaus
9b779c704f Update changelog 2018-08-02 12:19:24 +02:00
Patrick Niklaus
5bd7d04fe3 Fix formating 2018-08-02 12:19:24 +02:00
Patrick Niklaus
0f78f7b2cc Fix bug in computation of distance offset for phantom node 2018-08-02 12:19:24 +02:00
Patrick Niklaus
8473be69d2 Adjust text cases for flightly different matching due to rounding 2018-08-02 12:19:24 +02:00
Patrick Niklaus
c0124f7d77 Round network distance to deci-meter to retain previous behavior 2018-08-02 12:19:24 +02:00
Patrick Niklaus
b630b4e32a Preserve heap state in map matching 2018-08-02 12:19:24 +02:00
Patrick Niklaus
89fabc1b9c Use distance functions from many to many 2018-08-02 12:19:24 +02:00
Patrick Niklaus
a649a8a5cf Use FCC algorithm for map matching distance calculation 2018-08-02 12:19:24 +02:00
Frédéric Rodrigo
f928956584 Support maxlength and maxweight in car profile 2018-07-11 18:33:30 +02:00
Frédéric Rodrigo
7ff68792d7 Add helper for maxlength into measure.lua 2018-07-11 18:33:30 +02:00
Frédéric Rodrigo
3088dd0342 Better and flexible weight parsing in measure.lua 2018-07-11 18:33:30 +02:00
Frédéric Rodrigo
d2590989f5 Default maxspeed for fr:rural is now 80km/h 2018-07-11 17:54:46 +02:00
Antoine Giret
3a7b377586 Update profiles.md 2018-06-27 14:27:17 +02:00
Michael Krasnyk
82b5648c97 Don't collapse segregated intersections at roundabout exits, #5114 2018-06-21 15:24:03 +02:00
Antoine Giret
1628a3c4d5 Update profiles.md 2018-06-07 15:43:06 +02:00
Matthias Gilch
e5d8319c43 Removed unused variable
The variable name_data_mutex is declared in a block but never used
within this block. So I've removed the variable.
2018-06-02 22:49:30 +02:00
MichalPP
06699132eb allow routing over barrier=some_tag 2018-05-29 16:56:15 +02:00
MichalPP
918e794d6a change barrier_whitelist to barrier blacklist
change barrier_whitelist to barrier blacklist  in foot profile
fix #5067 and #3890 and #4823
2018-05-29 16:56:15 +02:00
MichalPP
8dd8ee1fc2 blacklisting barriers allow routing
blacklisting barriers allow routing over barrier=some_tag
2018-05-28 17:21:08 +02:00
MichalPP
c3d0efda93 change barrier_whitelist to barrier_blacklist 2018-05-28 17:21:08 +02:00
Patrick Niklaus
3b4e2e83ef Fix excluding nodes for one to all query 2018-05-08 15:50:25 +00:00
Patrick Niklaus
c459530cb6 Address PR comments 2018-05-08 15:50:25 +00:00
Kajari Ghosh
2a15e6dec8 Add support for annotations=distances in MLD
This commit brings feature parity with CH for the `table` pluging.
2018-05-08 15:50:25 +00:00
Huyen Chau Nguyen
1a1293608d fix example requests for distance tables 2018-05-02 17:25:01 +02:00
Michael Krasnyk
318df9deaa Adjust ebn_weight assertion to new node weights 2018-05-01 18:53:04 +02:00
Michael Krasnyk
cacb162520 Review and rebase updates 2018-04-28 08:59:18 +02:00
Michael Krasnyk
105709cb43 Don't handle response errors separately in osrm-runner 2018-04-28 08:59:18 +02:00
Michael Krasnyk
9695fa7941 Remove weight and duration from customizer::EdgeBasedGraphEdgeData 2018-04-28 08:59:18 +02:00
Michael Krasnyk
fd9bebbfa7 Add EBG node durations 2018-04-28 08:59:18 +02:00
Michael Krasnyk
db18e8669f Always read .osrm.enw file in updater 2018-04-28 08:59:18 +02:00
Michael Krasnyk
9b4a4fdd82 Add customizer::MultiLevelGraph 2018-04-28 08:59:18 +02:00
Michael Krasnyk
cdc7e5f021 Fix for updating node weights in contraction hierarchy 2018-04-28 08:59:18 +02:00
Michael Krasnyk
adc87149e2 List dataset blocks 2018-04-28 08:59:18 +02:00
Michael Krasnyk
8adbfe06ed Throw an exception if a shared region is not found 2018-04-28 08:59:18 +02:00
Patrick Niklaus
ae805f9ec8 Make cheap rulers static 2018-04-27 05:21:08 +02:00
Patrick Niklaus
be24689b0f Optimize distance calculation by getting rid of rounding 2018-04-27 05:21:08 +02:00
Michael Krasnyk
41c31a2388 Use mapbox::util::optional instead of std::experimental::optional 2018-04-27 05:21:08 +02:00
Huyen Chau Nguyen
8b866502d1 make eslint happy 2018-04-27 05:21:08 +02:00
Huyen Chau Nguyen
7837cd61df clang format 2018-04-27 05:21:08 +02:00
Huyen Chau Nguyen
b573485c31 only use half of rulers because earth is symmetric 2018-04-27 05:21:08 +02:00
Huyen Chau Nguyen
4e68f3a7e1 change haversine computation to cheap ruler in distance tables 2018-04-27 05:21:08 +02:00
Huyen Chau Nguyen
5ba26d3d6d refactor cheap ruler cache 2018-04-27 05:21:08 +02:00
Daniel Patterson
a6cf2eee7e Use faster method for calculating distances.
fix cmakelist
2018-04-27 05:21:08 +02:00
Patrick Niklaus
6843eb1479 Add changelog entries for profile changtes 2018-04-26 21:46:20 +02:00
Patrick Niklaus
b331885d3c Add test fo excluding ferries on bikes 2018-04-26 21:46:20 +02:00
Patrick Niklaus
73716bd651 Add support for classes on bicycle profile 2018-04-26 21:46:20 +02:00
Michael Krasnyk
9edd161da3 Test for "No turn issued for right turn on un-named roads", #4414
The issue is fixed by d166fc6a75
2018-04-26 18:53:47 +02:00
Kajari Ghosh
1bc3ff6491 fix the ascii art to make sense 2018-04-25 23:51:27 +02:00
Kajari Ghosh
b0f2ef287e fix the offset case when there is no packed path to unpack 2018-04-25 23:51:27 +02:00
Patrick Niklaus
16f53ff81a Sort unpacked paths by sharing 2018-04-25 16:07:31 +02:00
Patrick Niklaus
7a260dc2ba More parameter tuning 2018-04-25 16:07:31 +02:00
Patrick Niklaus
1c0d951f5e Adjust to PR comments 2018-04-25 16:07:31 +02:00
Patrick Niklaus
77a740c0fb Parameter tuning for different route lengths 2018-04-25 16:07:31 +02:00
Patrick Niklaus
61101db8cf Use duration and not weight for sharing 2018-04-25 16:07:31 +02:00
Patrick Niklaus
b51632a2fb Chose alternatives parameters based on coordinate distance 2018-04-25 16:07:31 +02:00
Patrick Niklaus
9d10503a9c Replace step function with contious scaling 2018-04-25 16:07:31 +02:00
Patrick Niklaus
7d50e5afe0 Refactor parameters to be selected at runtime 2018-04-25 16:07:31 +02:00
Patrick Niklaus
549216c792 Compute sharing weighted by edge weight
This ensures that small insignificat turns don't affect the overall
sharing metric too much.
2018-04-25 16:07:31 +02:00
Patrick Niklaus
1990de7dcc Fix inserting edges of shortest path for sharing check
This caused very sub-optimal routes to be selected.
2018-04-25 16:07:31 +02:00
Kajari Ghosh
89f6e2d55b
Parse table annotations param correctly (#5050)
* fix incorrect parameter parsing for node osrm and add tests

* fix boost spirit grammar parsing for annotations

* return NotImplemented when distance annotation is requested for MLD in table plugin

* update docs
2018-04-24 11:05:35 -04:00
Michael Krasnyk
c628ecbf24 Update tile unit tests 2018-04-24 15:40:57 +02:00
Jochen Topf
b6f19cd544 Use vtzero in tile plugin.
This uses the new vtzero library (https://github.com/mapbox/vtzero)
instead of using protozero directly.
2018-04-24 15:40:57 +02:00
Kajari Ghosh
14860b62e9
Unpack paths and return total distance in matrix plugin for CH (#4990) 2018-04-20 18:18:55 -04:00
Patrick Niklaus
9970b7d580
Merge pull request #5037 from Project-OSRM/subtrees-protozero-vtzero
Update libosmium and add protozero and vtzero libraries
2018-04-20 20:44:36 +02:00
Patrick Niklaus
7feb79ef91 Merge branch 'master' into subtrees-protozero-vtzero 2018-04-20 13:32:49 +00:00
Antoine Giret
6f84812903 Update profiles.md 2018-04-20 15:29:16 +02:00
Karen Shea
8085e86170
Change emoji 2018-04-20 13:19:48 +02:00
Karen Shea
35973576d9
Update releasing.md 2018-04-20 13:19:06 +02:00
Duane Gearhart
7740d5d7c0 Do not combine a segregated edge with a roundabout (#5040)
* Do not combine a segregated edge with a roundabout, add test
2018-04-20 11:41:53 +02:00
Patrick Niklaus
c4eff6cd65 Add option to osrm-runner to limit the distance 2018-04-20 08:14:03 +03:00
Michael Krasnyk
5c4353b46e
Removing submodules 2018-04-19 22:13:07 +03:00
Michael Krasnyk
05a5918909
Update CMakeLists.txt file 2018-04-19 22:13:06 +03:00
Michael Krasnyk
80ad38bbc6 Merge commit '6bee8866de99a602039feef463c22c972f0f86aa' as 'third_party/vtzero' 2018-04-19 22:03:52 +03:00
Michael Krasnyk
6bee8866de Squashed 'third_party/vtzero/' content from commit 2b43c8f5c
git-subtree-dir: third_party/vtzero
git-subtree-split: 2b43c8f5c7cc461a874a657673dfc15f8fb21d1d
2018-04-19 22:03:52 +03:00
Michael Krasnyk
ba92674c6e Merge commit '68019a1fb20928beaa7b0cb2d8310af29ffe789e' as 'third_party/protozero' 2018-04-19 22:03:49 +03:00
Michael Krasnyk
68019a1fb2 Squashed 'third_party/protozero/' content from commit d5d8debf1
git-subtree-dir: third_party/protozero
git-subtree-split: d5d8debf1b17c6bb652395957b76cde7787e5377
2018-04-19 22:03:49 +03:00
Michael Krasnyk
3a9acde2c3
Merge commit 'a3a7a822e136d2357660d85124d8e7bb26ea6f7c' into subtrees-protozero-vtzero 2018-04-19 22:03:25 +03:00
Michael Krasnyk
a3a7a822e1 Squashed 'third_party/libosmium/' changes from ce865381f..d2c1d872b
d2c1d872b Release v2.14.0
9c9aedd50 Update embedded catch.hpp to version 1.12.1.
f94e70d32 Change comment on namespace closing brace to make clang-tidy happy.
ad9f03afc Prefer prefix increment operator.
a141b9c0c Update change log.
363fc7a15 Add more XML tests.
303a3090f Refactor XML tests.
a1ee5dd56 Make util namespace inline.
6f1709a83 Cleanup progress bar code.
1b02b65e0 Use Location setters taking a string in osmium_tiles example.
7ffdc7618 Disable clang-tidy warning.
882631085 Better implementation of str_to_int.
4cbf53725 Fix another bitwise op on signed integer.
903bfac9d Disable clang-tidy warning.
01de3f518 Don't change location if set_lon() or set_lat() functions throw.
9a27e899d Fix bitwise operation on signed integer.
61650224f Disable some clang-tidy warnings.
9dfa8437e Provide a way to better mock the getenv function in tests.
ae2c172a2 Explicitly set integer type for integers in test code.
878850068 Simpler implementation. We don't need to look at errno at all.
8f9b886f5 Formatting
cf4760cb0 Use bit operations on unsigned where possible.
c7cb4cde8 No conversion needed later if we declare it this way.
01357a540 Add missing inline for free function.
3feef81ee Disable clang-tidy warning in place we can't do anything about.
bf083b8ee Avoid binary bitwise operations on signed integers.
f70b1c803 Move content of osmium::util::detail namespace into osmium::detail.
caf2f0033 Remove use of atoi and atol from code.
f564cef07 Formatting.
f0885fc73 Disable travis build with sanitizers.
858c58444 Use explicit asserts and then casts, not static_cast_with_assert.
a613b1b0a Disable clang-tidy warning.
50e327677 Always build and run data tests on travis.
20d7a09b0 Update submodule to add more XML tests.
6c8f652bf Merge pull request #250 from Nakaner/object-comparison-without-timestamp
38ea437c0 Make XML parser more strict.
7788f5108 Remove object_order_type_id_reverse_version_without_timestamp
fe2223d25 Ignore timestamps if only one object has a valid timestamp
a4515161a Code cleanup.
eb5ea1a0e Use explicit conversions.
105905c45 Only disable warning on non-MSVC compilers.
80fc1b35d Change the way IDs are parsed from strings.
78aedf91e More tests for StringMatcher and disable a clang-tidy warning.
644a00752 Move catch.hpp into its own directory.
19842756c Update to newest osm-testdata submodule.
0402f64d7 Fix the problem with "git submodule" in appveyor.
ec4095d32 Cleanup metadata_options code.
d7390741e Add static_cast to avoid conversion warning.
dd16be1c3 Remove else after throw.
ef4d618de Remove unused variable.
0fdb58d13 Check out submodule in appveyor builds.
6406282d3 Merge pull request #248 from Nakaner/metadata-options-more
eb138a902 make clang < 3.9 work
e703b0d1d make sections their own independent test cases
f68888006 detect_available_metadata must be inline
b53224588 move metadata_options into osmium namespace
edd363cfa make const what could be const
302a485e5 remove unnecessary include, add missing include
93a76e07e give osmium::io::metadata_from_object a better name
91dfbc427 update documentation
453cd6395 replace REQUIRE(!foo) by REQUIRE_FALSE(foo)
247c3b021 replace friend function by setter methods
0a62e589c performance improvement: check first character instead using std::strlen()
73568bbff move ctor of metadata_options which taks an OSMObject out of class
1879c9e47 restore metadata_options::to_string
71a303608 add more unit tests for osmium::io::metadata_options
843cdc89c replace osmium::io::metdata_options::to_string fully by operator<<
6402a8793 Fix bug in code which determines if an OSM object has a valid user.
a6d8143ae Move metadata_options out of "detail" subnamespace
61e32df10 add metadata_options::operator|=
d5f7cc0ab Use newest osm-testdata submodule.
31e34f10c add operator&=, operator<< and a to_string method to metadata_options
77d507172 Formatting fixes.
1c38b2a61 Update some URLs. Use https where possible.
10066cb3e Merge pull request #247 from Nakaner/issue-245
3c938ce82 Allow version=-1 and changeset=-1 for PBF input.
9a542c133 Add ReaderWithProgressBar class.
49839a1ce Replace strftime by our own implementation.
b32b90942 Update osm-testdata version used.
f88b6e548 Add more tests.
cb7e778f6 Handle NULL geometries in test cases.
1961a9c95 Clean up some test cases.
d7f45e071 Update osm-testdata submodule.
73a2ef18f Remove check for lost ways in multipolygon assembler.
1244e498a Update submodule also in msys2 build.
229fc2453 Revert "Make util namespace inline."
9f942d2e9 Revert "Add inline declaration to one util namespace we forgot."
40d4835ea Really fix appveyor build (I hope).
5ae071135 Add inline declaration to one util namespace we forgot.
e0916257c Clean up debug message.
2ddc474cc Make util namespace inline.
4b4e25f87 Travis config: Do not install clang-tidy, we are not using it.
5a608fba1 Fix travis build.
a075cc323 Fix appveyor build.
41ee9920b Add submodule with osm-testdata repository.
4d42245c0 Revert "Add clang-tidy build to travis."
9df355b64 Fix issue on some compilers.
c8a3c00d6 Add clang-tidy build to travis.
2fc80ad17 Fixed clang-tidy config file order.
2adf05267 Fix various clang-tidy warnings
1dca92459 Use the right syntax to override clang-tidy settings in the code.
25baecb46 Fix some issues found by clang-tidy.
54a8de6c0 Disable more clang-tidy tests.
de46d562e Also look for clang-tidy-6.0 in CMake config.
2172553d8 Add build with sanitizers on travis.
7e4e45562 Add object comparators ignoring the timestamp.
92fb231a1 Fix test code.
e541df0fc Cleanup test code.
5640269da Add comment in appveyor script about unusual parameter.
acb872376 Workaround for failing appveyor MSYS2 build.
0634bcf70 Set default value for m_file_size member.
3a2fe5781 Set default values on output options.
43d289fda Make metadata_options constructor explicit.
6e54992b4 Update change log.
e54b955cf Update included `catch.hpp` to version 1.12.0.
e50b40d53 Update copyright date.
0d8b401b6 Merge branch 'metadata'
c7da3a3b6 Remove superfluous has_visibles boolean.
7f74d33d3 Some cleanups of metadata code and fixes test.
5b3c34990 Output XML attributes uid and user independently of each other.
384167334 Merge pull request #243 from Nakaner/metadata_other
733f1916c Change path of nuget installs in appveyor config.
e48672999 Debug output from FindOsmium.cmake script is better formatted now.
79663be5d Change appveyor scripts to work without deprecated prebuilt libs.
443f7a9e4 Remove dependency on (win)getopt completely.
c133b8b14 Fix osmium_convert: Long options with = syntax.
b55daf00a Remove dependency on (win)getopt from area_test and convert examples.
92f7275a9 output visibility directly after the object ID in debug format
a771279f0 deprecate format option pbf_add_metadata
18e3f6005 The value "no" should be treated as "none" by metadata_options
c8b0b2e28 re-assign metadata_options instead of calling a public method of it
15bc4a200 Add more flexible metadata handling to PBF output
b085632b7 add more flexible metadata handling to OPL and debug output
a12c65974 Remove now wrong check.
767ad883a Allow PBF DenseNodes with only some attributes to be read.
fd5a7eb6c More flexible metadata encoding in OSM files.
d16c18581 Add instructions for bug reporting.
db52591ab Use __COUNTER__ instead of name for internal dummy name.
89e634dfc Cleanup.
931ec30ca Marks some false positives for clang-tidy google-runtime-int warning.
b59ef02a2 More rule of zero/rule of five fixes.
1b72b3386 Pass by value and use std::move.
b7d7017cc Handle some clang-tidy google-runtime-int warnings.
c043ca016 Fix special functions.
41d9f0795 Use fixed sized ints where possible.
0899a66a7 Revert some changes older compilers don't like.
41e05989a Fix several rule of zero/rule of five issues.
4e78a828f Various fixes based on clang-tidy reports.
636bda372 Default initialize arrays.
466e5aa6a Handle various clang-tidy warnings.
9f47aa07d Disable clang-tidy misc-forwarding-reference-overload warning.
5e97bf29f Mark Reader and Writer non-movable.
3a2221b27 Add minimal tests for thread-safe queue class.
affdeed6f Add some tests.
5ed055d50 Handle some warnings regarding "explicit".
b9d4c9bf5 Disable clang-tidy cert-err58-cpp warning.
254c25349 Make ADL work for begin()/end() of InputIterator<Reader>.
b64cb32ae Disable clang-tidy android-cloexec-* warnings.
6d6934ffc Fix various warnings reported by clang-tidy.
30dcabaed Another travis build fix.
88c59e669 Fix travis build.
2facb461f Fix travis and appveyor builds.
bba631a51 Remove protozero from repository.
aebe4a914 Use pass by value and std::move in some constructors.
c8c24c8fd Name unused parameters in comments.
9c2e321f9 Make deleted special functions public.
265c16284 Fix some problems with older compilers.
174e95211 Modernize class initialization code for some classes.
4e3e584f8 Disable more clang-tidy warnings.
6b53981bb Fix some class initializations.
fe1405ef8 Add/remove special functions for some classes.
c6dd930d9 Disable cppcoreguidelines-pro-type-static-cast-downcast warning.
0d09210ec Disable misc-unused-parameters warning in clang-tidy.
1dbc43112 Refactor to avoid misc-suspicious-string-compare clang-tidy warning.
91262cc86 Merge pull request #232 from worace/wkt-geojson-polygons
438076b09 Cleanup: Avoid else after return/break.
e0368e92c Disable modernize-raw-string-literal and hicpp-no-assembler check.
c822888fc Mark C style cast in macro from a library as NOLINT.
662d4a641 Moving a TypedMemoryMapping is noexcept.
aec1c4526 Use auto (clang-tidy check modernize-use-auto).
64857589d Consistent include order.
d1ce8de00 Disable hicpp-invalid-access-moved clang-tidy check.
0d3902420 Refactor test without SECTION.
32e9e9e1e Rewrite test avoiding nested sections.
eeb532902 Reorder includes according to best practice.
249e7b553 Revert "Add build with sanitizers to travis."
362cb419a Set CC env var in travis config.
9f520eca3 Add build with sanitizers to travis.
cfc18fef0 Travis config cleanup.
212c6cd42 Remove tests that triggers undefined behaviour in the std lib.
f30985884 Bugfix: Avoid undefined behaviour.
90191619a Make test work even if unused memory isn't returned to OS.
876867e68 Make older compilers happy.
925d1a797 Add names for unused parameters.
014b3a056 Avoid repeating the return type from the declaration
c4e705f92 Disable hicpp-invalid-access-moved clang-tidy warnings.
8c03b3827 Disable some warnings.
c49962ffe Refactor test to avoid spurious use-after-move warning.
04a0afbba Sort includes.
2aaab9a89 Use auto where possible.
e2d84109b More changes for old compilers.
5364ca2a8 Changes for old compilers.
098fc1fa2 Move initializations of class members to the declaration.
eea463026 Fix buffer overflow in o5m parser.
5dc74f2d5 Remove check from static cast (and document why).
7a2dfdcdc Add NOLINT for using namespace osmium::builder::attr.
01fa05f1e Clang-tidy config cleanup.
5e8f8df3f Order includes.
6b78d9b24 Various small fixes for problems detected by clang-tidy.
b815f71b7 Fix gdal check in CMake config.
d47487093 Fix integer type error.
dec9de9ec Bugfix: Throw if elemens in XML file are nested too deep.
85e37723b Various small cleanups.
5f40d726a Additional checks in o5m parser.
b59b4b6a6 Check before static cast and throw.
e57b15700 Disable compiling some header files if gdal lib is not available.
1d3056646 Better checking that PBF data is in range.
c586521d3 Add some consts to the code.
df17e8189 Trying to get the types right...
8e9b759e0 Check read and write system call for EINTR.
28c676054 Rename license file so that Github finds it.
be29e9a52 Remove duplicate space character.
36c14136f Update protozero to newest version (1.6.0).
a19181998 Make libosmium work with different protozero versions.
5c5d9fb36 Use tag and type from protozero to make PBF parser more robust.
03f894400 Add repology.org badge to README.md.
1840739dd Merge pull request #234 from AMDmi3/patch-1
d8e737196 Add support for DragonFly BSD
8de181c8d Revert "Return const object from postfix ++ operator."
0dfb1d649 Add polygon implementation for WKT and GeoJSON Geometry Factories
150e05aea Fix indentation.
6fdee974a Merge pull request #229 from alex85k/no-winsock
f302f08ce Merge pull request #228 from alex85k/fix-test-win
bfb60c888 remove ws2_32 from needed libraries
ef187851c no winsock2 on windows: replace htonl with protozero::detail::byteswap_inplace
9343f8453 Fix testdata-multipolygon test on Windows (executable path differs)
381cf9272 Do not return const from postfix increment operator.
46ec985e9 Add const version of OutputIterator::operator*.
c67de374f Disable clang-tidy test for const params.
f5eda165f Make functions noexcept and return const value from post increment op.
1e4e3160f Use {} when calling constructors. Use .empty() to check empty strings.
8893d16be Mark some tests using size() with NOLINT.
f8a74a8aa Make functions noexcept.
45c1e072c Use REQUIRE_FALSE(...) instead of REQUIRE(!...) for readability.
fc173dae7 Merge pull request #227 from alex85k/msys2-appveor
0a281c064 Add MSYS2 building to Appveyor
c93f73120 fix FindGem for Windows Ruby distributions
8bf6702b3 Merge pull request #226 from alex85k/master
e8dad731d gmtime_s should be used on both MSVC and GCC from MinGW64
d0d98e9c1 remove "osmium::util::MemoryMapping::" from class body
6830ee9bd ftruncate is not available only on MSVC (MinGW has it)
c0597584f Disable some clang-tidy checks.
578db8e4a Use empty() instead of size() or == "" to check for empty collections.
53c8f3a21 Return const object from postfix ++ operator.
bd5e4d109 Use emplace_back() instead of push_back().
0a0a4f24c Use correct C++ header.
35226ea86 Remove unused move.
df843a9cf Fix header guard.
759e76131 Avoid default argument on virtual function.
db4f1bdb9 Update included catch.hpp to version 1.10.0.
59e70e5c6 Pass constructor arguments by value and std::move() into members.
ee9b598ed Add tests for thread_handler.
ac661209a CMake config: Update list of clang-tidy versions we look for.
d7281215c Add comment to unusual code.
cbb4c09fb Split up some overlong test functions.
9870a6b90 Fix noexcept specification.
5e27c37d0 Use array instead of map to store input/output format creators.
987d12922 Mark some constructors noexcept.
17f4d8b7e Avoid static variable only needed as constant value.
fe705cef0 Avoid else after return in several cases.
d4a85878e Beautifying travis config.
f07d1e375 Make some special functions noexcept.
4bb0f7f22 Do not declare special functions on some classes.
bc6c5943d Disable some clang-tidy checks that produce false positives.
6b6598a5b Remove superfluous std::move() of POD type.
71c3f5e16 Make some special functions noexcept.
1cb32778c Remove explicit true/false in tests.
929ba89cf Always catch by const ref.
a9a255820 Code readability: No else clause after return.
f14364bd3 Code formatting fixes.
f41feb6a5 Simplify code.
727f6eff4 Mark dummy includes for IWYU.
72d20f835 Switch travis build to 'trusty'.
c480e6808 Do not run gcov from codecov script.
d16c6e90a Clean up lambda captures in xml_input_format.hpp.

git-subtree-dir: third_party/libosmium
git-subtree-split: d2c1d872bc915d9579350007383ce1ebfea3665f
2018-04-19 22:03:25 +03:00
Michael Krasnyk
c7d22c2b92
Update dependencies script 2018-04-19 22:03:20 +03:00
Michael Krasnyk
b2aeb47630 Remove dummy edges before inplace permutation 2018-04-19 12:18:48 +02:00
Patrick Niklaus
0a1d1901cc Fix help text and banner 2018-04-17 18:02:28 +02:00
Patrick Niklaus
29db0c80d9 Use CSV stringify to properly escape data in CSV 2018-04-17 18:02:28 +02:00
Huyen Chau Nguyen
4654751872 add dev dependencies for osrm runner 2018-04-17 18:02:28 +02:00
Marcel Radischat
b5b18d8afc Update profiles.md
Add api-version 4 for lua profiles as latest api-version
2018-04-17 17:23:08 +02:00
Huyen Chau Nguyen
15139c934f add changelog entry 2018-04-16 11:39:44 +02:00
Huyen Chau Nguyen
7b8619e37c adjust tests to changes 2018-04-16 11:39:44 +02:00
Huyen Chau Nguyen
f52b5c31b6 refactor bike profile 2018-04-16 11:39:44 +02:00
Huyen Chau Nguyen
e98859e4c0 make primaries and secondaries more dangerous
only apply oneway safety considerations on primaries

re-adjust primary and secondary safeties
2018-04-16 11:39:44 +02:00
Patrick Niklaus
c5cc4c5a74 Remove double log printing 2018-04-13 10:13:57 +00:00
karenzshea
e3b831364f empty list of shmem regions if none found 2018-04-13 12:07:10 +02:00
karenzshea
730d2b5ef2 log err instead of throwing when no shmem regions found 2018-04-13 12:07:10 +02:00
Michael Krasnyk
16abee1022 Avoid using signed integers for edge IDs 2018-04-12 10:03:37 +02:00
Patrick Niklaus
69fa52a010 Use byte based tar size encoding above 8GB 2018-04-10 21:12:39 +02:00
Patrick Niklaus
e1efa4c6ab Add test case for writing and reading huge tar file
This test case is disabled by default because it needs too much storage,
but serves as documentation for the future.
2018-04-10 21:12:39 +02:00
Michael Krasnyk
17cd1575f6 Use base-256 encoding for files larger 68G
Reference:
http://lists.busybox.net/pipermail/busybox/2011-May/075596.html
2018-04-10 21:12:39 +02:00
Michael Krasnyk
3cd8e0fef8 Use 12 octal digits in mtar_raw_header_t::size 2018-04-10 21:12:39 +02:00
Michael Krasnyk
397bb694fd Fix mtar file size truncation to 4G 2018-04-10 21:12:39 +02:00
Patrick Niklaus
473ebfcbf6 Fix debug printing for coordinates 2018-04-10 18:08:18 +02:00
Patrick Niklaus
a06171438e Fix hard-coded hint strings in unit-tests 2018-04-10 18:08:18 +02:00
Patrick Niklaus
ea0881553e [skip ci] Bump master to 5.18 2018-04-09 13:14:43 +00:00
2060 changed files with 362684 additions and 88997 deletions

View File

@ -1,8 +1,7 @@
{
"plugins": ["transform-class-properties"],
"presets": [
"stage-0",
"es2015",
"react"
"@babel/preset-env",
"@babel/preset-react"
]
}

View File

@ -1,4 +1,101 @@
---
Checks: '-clang-analyzer-*,google-*,llvm-*,misc-*,readability-*,-google-build-explicit-make-pair,-google-explicit-constructor,-google-readability-braces-around-statements,-google-readability-casting,-google-readability-namespace-comments,-google-readability-function,-google-readability-todo,-google-runtime-int,-llvm-namespace-comment,-llvm-header-guard,-llvm-twine-local,-misc-argument-comment,-readability-braces-around-statements,-readability-identifier-naming'
...
Checks: >
bugprone-*,
-bugprone-narrowing-conversions,
-bugprone-easily-swappable-parameters,
-bugprone-branch-clone,
-bugprone-misplaced-widening-cast,
-bugprone-exception-escape,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-integer-division,
-bugprone-reserved-identifier,
-bugprone-unhandled-self-assignment,
-bugprone-forward-declaration-namespace,
-bugprone-sizeof-expression,
-bugprone-throw-keyword-missing,
-bugprone-chained-comparison,
-bugprone-incorrect-enable-if,
-bugprone-switch-missing-default-case,
-bugprone-empty-catch,
-bugprone-unchecked-optional-access,
-clang-analyzer-*,
-clang-diagnostic-deprecated-declarations,
-clang-diagnostic-constant-conversion,
cppcoreguidelines-avoid-goto,
cppcoreguidelines-no-malloc,
cppcoreguidelines-virtual-class-destructor,
google-*,
-google-build-explicit-make-pair,
-google-build-using-namespace,
-google-explicit-constructor,
-google-default-arguments,
-google-readability-braces-around-statements,
-google-readability-casting,
-google-readability-namespace-comments,
-google-readability-function,
-google-readability-todo,
-google-runtime-int,
-google-build-namespaces,
-google-runtime-references,
-google-readability-function-size,
llvm-*,
-llvm-namespace-comment,
-llvm-qualified-auto,
-llvm-include-order,
-llvm-else-after-return,
-llvm-header-guard,
-llvm-twine-local,
misc-*,
-misc-argument-comment,
-misc-const-correctness,
-misc-non-private-member-variables-in-classes,
-misc-unconventional-assign-operator,
-misc-no-recursion,
-misc-misplaced-const,
-misc-definitions-in-headers,
-misc-unused-parameters,
-misc-include-cleaner,
modernize-concat-nested-namespaces,
modernize-use-using,
performance-*,
-performance-no-int-to-ptr,
-performance-enum-size,
-performance-avoid-endl,
readability-*,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements,
-readability-container-size-empty,
-readability-convert-member-functions-to-static,
-readability-const-return-type,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-naming,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-else-after-return,
-readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration,
-readability-identifier-length,
-readability-redundant-declaration,
-readability-uppercase-literal-suffix,
-readability-named-parameter,
-readability-qualified-auto,
-readability-suspicious-call-argument,
-readability-redundant-access-specifiers,
-readability-redundant-member-init,
-readability-static-definition-in-anonymous-namespace,
-readability-use-anyofallof,
-readability-simplify-boolean-expr,
-readability-make-member-function-const,
-readability-redundant-string-init,
-readability-non-const-parameter,
-readability-redundant-inline-specifier,
-readability-avoid-nested-conditional-operator,
-readability-avoid-return-with-void-value,
-readability-redundant-casting,
-readability-static-accessed-through-instance
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
features/support/flatbuffers.js
features/support/fbresult_generated.js

3
.gitattributes vendored
View File

@ -13,3 +13,6 @@
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
# https://eslint.org/docs/latest/rules/linebreak-style#using-this-rule-with-version-control-systems
*.js text eol=lf

View File

@ -0,0 +1,65 @@
name: Build and Publish Docker Image
on:
release:
types: [published, prereleased]
env:
IMAGE_NAME: openharbor/osrm-backend
jobs:
publish:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
- name: Docker meta - debug
id: metadebug
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
flavor: |
latest=true
suffix=-debug,onlatest=true
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Build and push debug image
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metadebug.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags) }}-${{ matrix.docker-base-image }}
- name: Build and push normal image
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.meta.outputs.tags) }}-${{ matrix.docker-base-image }}

30
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,30 @@
---
name: Bug Report
about: Report issue with osrm-backend
labels: Bug Report
---
# Issue
Please describe the issue you are seeing with OSRM.
Images are a good way to illustrate your problem.
**Note**: If your issue relates to the demo site (https://map.project-osrm.org) or routing provided on openstreetmap.org, be aware that they use separate [profile settings](https://github.com/fossgis-routing-server/cbf-routing-profiles) from those provided by default in `osrm-backend`.
If your issue relates to the demo site or openstreetmap.org behaviour, please check these profiles first to see if they explain the behaviour before creating an issue here.
# Steps to reproduce
Please provide the steps required to reproduce your problem.
- `osrm-backend` version being used
- OSM extract that was processed
- Processing commands (e.g. CH vs MLD processing)
- Server queries
If you're reporting an issue with https://map.project-osrm.org, please provide a link to the problematic request.
# Specifications
Please provide details of your development environment.
- Library/dependency versions
- Operating system
- Hardware

10
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@ -0,0 +1,10 @@
---
name: Feature Request
about: Request a new feature in osrm-backend
labels: Feature Request
---
# Feature
Please describe the feature you would like to see in OSRM.
Images are often a good way to illustrate your requested feature.

View File

@ -9,7 +9,7 @@ If your PR is still work in progress please attach the relevant label.
- [ ] CHANGELOG.md entry ([How to write a changelog entry](http://keepachangelog.com/en/1.0.0/#how))
- [ ] update relevant [Wiki pages](https://github.com/Project-OSRM/osrm-backend/wiki)
- [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md)
- [ ] add tests (see [testing documentation](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md))
- [ ] review
- [ ] adjust for comments
- [ ] cherry pick to release branch

View File

@ -0,0 +1,84 @@
name: build and publish container image
on:
push:
tags:
- 'v*'
jobs:
publish:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
- name: Docker meta - debug
id: metadebug
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=true
suffix=-debug,onlatest=true
- name: Docker meta - assertions
id: metaassertions
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=true
suffix=-assertions,onlatest=true
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image - debug
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metadebug.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metadebug.outputs.tags ) }}-${{ matrix.docker-base-image }}
- name: Build container image - assertions
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.metaassertions.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.metaassertions.outputs.tags ) }}-${{ matrix.docker-base-image }}
# build and publish "normal" image as last to get it listed on top
- name: Build container image - normal
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile-${{ matrix.docker-base-image }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
DOCKER_TAG=${{ join(steps.meta.outputs.tags ) }}-${{ matrix.docker-base-image }}

786
.github/workflows/osrm-backend.yml vendored Normal file
View File

@ -0,0 +1,786 @@
name: osrm-backend CI
on:
push:
branches:
- master
tags:
- v[1-9]+.[0-9]+.[0-9]+
- v[1-9]+.[0-9]+.[0-9]+-[a-zA-Z]+.[0-9]+
- v[1-9]+.[0-9]+-[0-9a-zA-Z]+
pull_request:
branches:
- master
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
CCACHE_COMPRESS: 1
CASHER_TIME_OUT: 599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
CMAKE_VERSION: 3.21.2
ENABLE_NODE_BINDINGS: "ON"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
windows-release-node:
needs: format-taginfo-docs
runs-on: windows-2022
continue-on-error: false
env:
BUILD_TYPE: Release
steps:
- uses: actions/checkout@v4
- run: pip install "conan<2.0.0"
- run: conan --version
- run: cmake --version
- uses: actions/setup-node@v4
with:
node-version: 18
- run: node --version
- run: npm --version
- name: Prepare environment
shell: bash
run: |
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
- run: npm install --ignore-scripts
- run: npm link --ignore-scripts
- name: Build
shell: bash
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON ..
cmake --build . --config Release
# TODO: MSVC goes out of memory when building our tests
# - name: Run tests
# shell: bash
# run: |
# cd build
# cmake --build . --config Release --target tests
# # TODO: run tests
# - name: Run node tests
# shell: bash
# run: |
# ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf
# mkdir -p test/data/ch
# cp test/data/monaco.osrm* test/data/ch/
# ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm
# ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm
# node test/nodejs/index.js
- name: Build Node package
shell: bash
run: ./scripts/ci/node_package.sh
- name: Publish Node package
if: ${{ env.PUBLISH == 'On' }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: build/stage/**/*.tar.gz
omitBody: true
omitBodyDuringUpdate: true
omitName: true
omitNameDuringUpdate: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
format-taginfo-docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Enable Node.js cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Prepare environment
run: |
npm ci --ignore-scripts
clang-format-15 --version
- name: Run checks
run: |
./scripts/check_taginfo.py taginfo.json profiles/car.lua
./scripts/format.sh && ./scripts/error_on_dirty.sh
node ./scripts/validate_changelog.js
npm run docs && ./scripts/error_on_dirty.sh
npm audit --production
docker-image-matrix:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
needs: format-taginfo-docs
runs-on: ubuntu-22.04
continue-on-error: false
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Enable osm.pbf cache
uses: actions/cache@v4
with:
path: berlin-latest.osm.pbf
key: v1-berlin-osm-pbf
restore-keys: |
v1-berlin-osm-pbf
- name: Docker build
run: |
docker build -t osrm-backend-local -f docker/Dockerfile-${{ matrix.docker-base-image }} .
- name: Test Docker image
run: |
if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
fi
TAG=osrm-backend-local
# when `--memory-swap` value equals `--memory` it means container won't use swap
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
MEMORY_ARGS="--memory=1g --memory-swap=1g"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
if [ ! -s "${PWD}/berlin-latest.geojson" ]
then
>&2 echo "No berlin-latest.geojson found"
exit 1
fi
# removing `.osrm.nbg` to check that whole pipeline works without it
rm -rf "${PWD}/berlin-latest.osrm.nbg"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
docker stop osrm-container
build-test-publish:
needs: format-taginfo-docs
strategy:
matrix:
include:
- name: gcc-13-debug-cov
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: gcc-13
CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: g++-13
ENABLE_COVERAGE: ON
- name: clang-18-debug-asan-ubsan
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: clang-18
CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: clang++-18
ENABLE_SANITIZER: ON
TARGET_ARCH: x86_64-asan-ubsan
OSRM_CONNECTION_RETRIES: 10
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
- name: clang-18-release
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang-18
CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF
- name: clang-18-debug
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: clang-18
CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF
- name: clang-18-debug-clang-tidy
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: clang-18
CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000
ENABLE_CLANG_TIDY: ON
- name: clang-17-release
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang-17
CXXCOMPILER: clang++-17
CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF
- name: clang-16-release
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang-16
CXXCOMPILER: clang++-16
CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF
- name: conan-linux-debug-asan-ubsan
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang-18
CXXCOMPILER: clang++-18
ENABLE_CONAN: ON
ENABLE_SANITIZER: ON
ENABLE_LTO: OFF
- name: conan-linux-release
continue-on-error: false
node: 18
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang-18
CXXCOMPILER: clang++-18
ENABLE_CONAN: ON
ENABLE_LTO: OFF
- name: gcc-14-release
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-14
CXXCOMPILER: g++-14
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: gcc-13-release
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-13
CXXCOMPILER: g++-13
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: gcc-12-release
continue-on-error: false
node: 20
runs-on: ubuntu-22.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-12
CXXCOMPILER: g++-12
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: conan-linux-release-node
build_node_package: true
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TYPE: Release
CCOMPILER: clang-16
CXXCOMPILER: clang++-16
ENABLE_CONAN: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: conan-linux-debug-node
build_node_package: true
continue-on-error: false
node: 20
runs-on: ubuntu-24.04
BUILD_TYPE: Debug
CCOMPILER: clang-16
CXXCOMPILER: clang++-16
ENABLE_CONAN: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: conan-macos-x64-release-node
build_node_package: true
continue-on-error: true
node: 20
runs-on: macos-13 # x86_64
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_CONAN: ON
- name: conan-macos-arm64-release-node
build_node_package: true
continue-on-error: true
node: 20
runs-on: macos-14 # arm64
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_CONAN: ON
name: ${{ matrix.name}}
continue-on-error: ${{ matrix.continue-on-error }}
runs-on: ${{ matrix.runs-on }}
env:
BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
CCOMPILER: ${{ matrix.CCOMPILER }}
CFLAGS: ${{ matrix.CFLAGS }}
CUCUMBER_TIMEOUT: ${{ matrix.CUCUMBER_TIMEOUT }}
CXXCOMPILER: ${{ matrix.CXXCOMPILER }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }}
ENABLE_CLANG_TIDY: ${{ matrix.ENABLE_CLANG_TIDY }}
ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }}
ENABLE_CONAN: ${{ matrix.ENABLE_CONAN }}
ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }}
NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }}
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
ENABLE_LTO: ${{ matrix.ENABLE_LTO }}
steps:
- uses: actions/checkout@v4
- name: Build machine architecture
run: uname -m
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Enable Node.js cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Enable compiler cache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ccache-${{ matrix.name }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.name }}-
- name: Enable Conan cache
uses: actions/cache@v4
with:
path: ~/.conan
key: v9-conan-${{ matrix.name }}-${{ github.sha }}
restore-keys: |
v9-conan-${{ matrix.name }}-
- name: Enable test cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/test/cache
key: v4-test-${{ matrix.name }}-${{ github.sha }}
restore-keys: |
v4-test-${{ matrix.name }}-
- name: Prepare environment
run: |
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
mkdir -p $HOME/.ccache
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV
echo "OSRM_BUILD_DIR=${GITHUB_WORKSPACE}/build-osrm" >> $GITHUB_ENV
if [[ "$ENABLE_SANITIZER" == 'ON' ]]; then
# We can only set this after checkout once we know the workspace directory
echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV
echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV
echo "ASAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/addresssanitizer.conf" >> $GITHUB_ENV
fi
if [[ "${RUNNER_OS}" == "Linux" ]]; then
echo "JOBS=$((`nproc` + 1))" >> $GITHUB_ENV
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV
fi
# See: https://github.com/actions/toolkit/issues/946#issuecomment-1590016041
# We need it to be able to access system folders while restoring cached Boost below
- name: Give tar root ownership
if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
run: sudo chown root /bin/tar && sudo chmod u+s /bin/tar
- name: Cache Boost
if: runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
id: cache-boost
uses: actions/cache@v4
with:
path: |
/usr/local/include/boost
/usr/local/lib/libboost*
key: v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }}
restore-keys: |
v1-boost-${{ runner.os }}-${{ runner.arch }}-${{ matrix.runs-on }}
- name: Install Boost
if: steps.cache-boost.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
run: |
BOOST_VERSION="1.85.0"
BOOST_VERSION_FLAVOR="${BOOST_VERSION}-b2-nodocs"
wget -q https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION_FLAVOR}.tar.gz
tar xzf boost-${BOOST_VERSION_FLAVOR}.tar.gz
cd boost-${BOOST_VERSION}
sudo ./bootstrap.sh
sudo ./b2 install
cd ..
sudo rm -rf boost-${BOOST_VERSION}*
- name: Install dev dependencies
run: |
python3 -m pip install "conan<2.0.0" || python3 -m pip install "conan<2.0.0" --break-system-packages
# workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499
# and that's why CI cannot find conan executable installed above
if [[ "${RUNNER_OS}" == "macOS" ]]; then
echo "/Library/Frameworks/Python.framework/Versions/Current/bin" >> $GITHUB_PATH
fi
# ccache
if [[ "${RUNNER_OS}" == "Linux" ]]; then
sudo apt-get update -y && sudo apt-get install ccache
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
brew install ccache
fi
# Linux dev packages
if [ "${ENABLE_CONAN}" != "ON" ]; then
sudo apt-get update -y
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev
if [[ "${CCOMPILER}" != clang-* ]]; then
sudo apt-get install -y ${CXXCOMPILER}
fi
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
sudo apt-get install -y lcov
fi
fi
# TBB
TBB_VERSION=2021.12.0
if [[ "${RUNNER_OS}" == "Linux" ]]; then
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-lin.tgz"
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-mac.tgz"
fi
wget --tries 5 ${TBB_URL} -O onetbb.tgz
tar zxvf onetbb.tgz
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
- name: Add Clang 18 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Clang 18
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.CCOMPILER == 'clang-18' }}
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
conan config init
yq eval '.compiler.clang.version += ["18"]' -i "$HOME/.conan/settings.yml"
- name: Add Apple-clang 16 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Apple-clang 16
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.runs-on == 'macos-14' }}
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_darwin_arm64 -O /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
conan config init
yq eval '.compiler.apple-clang.version += ["16.0"]' -i "$HOME/.conan/settings.yml"
- name: Prepare build
run: |
mkdir ${OSRM_BUILD_DIR}
ccache --max-size=256M
npm ci --ignore-scripts
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
lcov --directory . --zerocounters # clean cached files
fi
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
if [[ "${RUNNER_OS}" == "macOS" ]]; then
# missing from GCC path, needed for conan builds of libiconv, for example.
sudo xcode-select --switch /Library/Developer/CommandLineTools
echo "LIBRARY_PATH=${LIBRARY_PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV
echo "CPATH=${CPATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" >> $GITHUB_ENV
fi
- name: Build and install OSRM
run: |
echo "Using ${JOBS} jobs"
pushd ${OSRM_BUILD_DIR}
ccache --zero-stats
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
-DENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY:-OFF} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
-DENABLE_CCACHE=ON \
-DENABLE_LTO=${ENABLE_LTO:-ON} \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
make --jobs=${JOBS}
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
make tests --jobs=${JOBS}
make benchmarks --jobs=${JOBS}
sudo make install
if [[ "${RUNNER_OS}" == "Linux" ]]; then
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV
fi
echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV
fi
popd
- name: Build example
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
run: |
mkdir example/build && pushd example/build
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
make --jobs=${JOBS}
popd
- name: Run all tests
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
run: |
make -C test/data benchmark
# macOS SIP strips the linker path. Reset this inside the running shell
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
./example/build/osrm-example test/data/mld/monaco.osrm
# All tests assume to be run from the build directory
pushd ${OSRM_BUILD_DIR}
for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done
if [ -z "${ENABLE_SANITIZER}" ]; then
npm run nodejs-tests
fi
popd
npm test
- name: Use Node 18
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
uses: actions/setup-node@v4
with:
node-version: 18
- name: Run Node package tests on Node 18
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
run: |
node --version
npm run nodejs-tests
- name: Use Node 20
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
uses: actions/setup-node@v4
with:
node-version: 20
- name: Run Node package tests on Node 20
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
run: |
node --version
npm run nodejs-tests
- name: Use Node latest
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
uses: actions/setup-node@v4
with:
node-version: latest
- name: Run Node package tests on Node-latest
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
run: |
node --version
npm run nodejs-tests
- name: Upload test logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: test/logs/
# - name: Generate code coverage
# if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
# run: |
# lcov --directory . --capture --output-file coverage.info # capture coverage info
# lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
# lcov --list coverage.info #debug info
# # Uploading report to CodeCov
# - name: Upload code coverage
# if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
# uses: codecov/codecov-action@v4
# with:
# files: coverage.info
# name: codecov-osrm-backend
# fail_ci_if_error: true
# verbose: true
- name: Build Node package
if: ${{ matrix.build_node_package }}
run: ./scripts/ci/node_package.sh
- name: Publish Node package
if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: build/stage/**/*.tar.gz
omitBody: true
omitBodyDuringUpdate: true
omitName: true
omitNameDuringUpdate: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Show CCache statistics
run: |
ccache -p
ccache -s
benchmarks:
if: github.event_name == 'pull_request'
needs: [format-taginfo-docs]
runs-on: self-hosted
env:
CCOMPILER: clang-16
CXXCOMPILER: clang++-16
CC: clang-16
CXX: clang++-16
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }}
steps:
- name: Checkout PR Branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
path: pr
- name: Activate virtualenv
run: |
python3 -m venv .venv
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4"
- name: Prepare data
run: |
if [ "$RUN_BIG_BENCHMARK" = "true" ]; then
rm -rf ~/data.osm.pbf
wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet
gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv
else
if [ ! -f "~/data.osm.pbf" ]; then
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf
else
echo "Using cached data.osm.pbf"
fi
gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv
fi
- name: Prepare environment
run: |
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
mkdir -p $HOME/.ccache
ccache --zero-stats
ccache --max-size=256M
- name: Checkout Base Branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base
- name: Build Base Branch
run: |
cd base
npm ci --ignore-scripts
cd ..
mkdir base/build
cd base/build
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
make -j$(nproc)
make -j$(nproc) benchmarks
cd ..
make -C test/data
- name: Build PR Branch
run: |
cd pr
npm ci --ignore-scripts
cd ..
mkdir -p pr/build
cd pr/build
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
make -j$(nproc)
make -j$(nproc) benchmarks
cd ..
make -C test/data
# we run benchmarks in tmpfs to avoid impact of disk IO
- name: Create folder for tmpfs
run: |
# if by any chance it was mounted before(e.g. due to previous job failed), unmount it
sudo umount ~/benchmarks | true
rm -rf ~/benchmarks
mkdir -p ~/benchmarks
# see https://llvm.org/docs/Benchmarking.html
- name: Run PR Benchmarks
run: |
sudo cset shield -c 2-3 -k on
sudo mount -t tmpfs -o size=4g none ~/benchmarks
cp -rf pr/build ~/benchmarks/build
cp -rf pr/lib ~/benchmarks/lib
mkdir -p ~/benchmarks/test
cp -rf pr/test/data ~/benchmarks/test/data
cp -rf pr/profiles ~/benchmarks/profiles
sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sudo umount ~/benchmarks
sudo cset shield --reset
- name: Run Base Benchmarks
run: |
sudo cset shield -c 2-3 -k on
sudo mount -t tmpfs -o size=4g none ~/benchmarks
cp -rf base/build ~/benchmarks/build
cp -rf base/lib ~/benchmarks/lib
mkdir -p ~/benchmarks/test
cp -rf base/test/data ~/benchmarks/test/data
cp -rf base/profiles ~/benchmarks/profiles
# TODO: remove it when base branch will have this file at needed location
if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then
cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json
fi
# we intentionally use scripts from PR branch to be able to update them and see results in the same PR
sudo cset shield --exec -- cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sudo umount ~/benchmarks
sudo cset shield --reset
- name: Post Benchmark Results
run: |
python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results
- name: Show CCache statistics
run: |
ccache -p
ccache -s
ci-complete:
runs-on: ubuntu-22.04
needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks]
steps:
- run: echo "CI complete"

29
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: 'Close stale issues'
on:
# NOTE: uncomment if you want to test changes to this file in PRs CI
# pull_request:
# branches:
# - master
schedule:
- cron: '30 1 * * *' # every day at 1:30am
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-24.04
steps:
- uses: actions/stale@v9
with:
operations-per-run: 3000
stale-issue-message: 'This issue seems to be stale. It will be closed in 30 days if no further activity occurs.'
stale-pr-message: 'This PR seems to be stale. Is it still relevant?'
days-before-issue-stale: 180 # 6 months
days-before-issue-close: 30 # 1 month
days-before-pr-stale: 180 # 6 months
days-before-pr-close: -1 # never close PRs
exempt-issue-labels: 'Do Not Stale,Feature Request,Performance,Bug Report,CI,Starter Task,Refactor,Guidance'

18
.gitignore vendored
View File

@ -1,8 +1,3 @@
# mason #
#########
/.mason
/mason_packages
# pre compiled dependencies #
#############################
osrm-deps
@ -49,9 +44,8 @@ Thumbs.db
/_build*
/build/
/example/build/
/test/data/monaco*
/test/data/monaco.osrm*
/test/data/ch
/test/data/corech
/test/data/mld
/cmake/postinst
@ -67,12 +61,11 @@ Thumbs.db
/.vs*
/*.local.bat
/CMakeSettings.json
/.cache
# stxxl related files #
#######################
.stxxl
stxxl.log
stxxl.errlog
# Jetbrains related files #
###########################
.idea/
# Compiled Binary Files #
####################################
@ -111,3 +104,4 @@ debug.lua
# node-osrm artifacts
lib/binding

View File

@ -1,384 +0,0 @@
language: cpp
git:
depth: 10
# sudo:required is needed for trusty images
sudo: required
dist: trusty
notifications:
email: false
branches:
only:
- master
# enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
cache:
yarn: true
ccache: true
apt: true
directories:
- test/cache
env:
global:
- secure: "hk+32aXXF5t1ApaM2Wjqooz3dx1si907L87WRMkO47WlpJmUUU/Ye+MJk9sViH8MdhOcceocVAmdYl5/WFWOIbDWNlBya9QvXDZyIu2KIre/0QyOCTZbrsif8paBXKIO5O/R4OTvIZ8rvWZsadBdmAT9GSbDhih6FzqXAEgeIYQ="
- secure: "VE+cFkseFwW4jK6XwkP0yW3h4DixPJ8+Eb3yKcchGZ5iIJxlZ/8i1vKHYxadgPRwSYwPSB14tF70xj2OmiT2keGzZUfphmPXinBaLEhYk+Bde+GZZkoSl5ND109I/LcyNr0nG9dDgtV6pkvFchgchpyP9JnVOOS0+crEZlAz0RE="
- CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1
- CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
- CCACHE_VERSION=3.3.1
- CMAKE_VERSION=3.7.2
- MASON="$(pwd)/scripts/mason.sh"
- ENABLE_NODE_BINDINGS=On
- NODE="4"
matrix:
fast_finish: true
# We override the compiler names here to yield better ccache behavior, which uses this as key
include:
# Debug Builds
- os: linux
compiler: "format-taginfo-docs"
env: NODE=6
sudo: false
before_install:
install:
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- npm --version
- npm install --ignore-scripts
- npm link --ignore-scripts
script:
- ./scripts/check_taginfo.py taginfo.json profiles/car.lua
- ${MASON} install clang-format 3.8.1
- PATH=$(${MASON} prefix clang-format 3.8.1)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh
- node ./scripts/validate_changelog.js
# See issue 4043
#- npm run docs && ./scripts/error_on_dirty.sh
after_success:
- os: linux
compiler: "gcc-7-debug-cov"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
before_script:
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --zerocounters # clean cached da files
after_success:
# Creating report
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --capture --output-file coverage.info # capture coverage info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
- lcov --list coverage.info #debug info
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
- os: linux
compiler: "gcc-7-debug-asan"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
- os: linux
compiler: "clang-5.0-debug"
addons: &clang50
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux
compiler: "mason-linux-debug-asan"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
# Release Builds
- os: linux
compiler: "mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
- os: linux
compiler: "gcc-7-release"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-7-release-i686"
env: >
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-7-stxxl"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' ENABLE_STXXL=On
- os: linux
compiler: "gcc-5-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-6-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-8"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8"
after_success:
- ./scripts/travis/publish.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-4"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="4"
after_success:
- ./scripts/travis/publish.sh
# Shared Library
- os: linux
compiler: "gcc-7-release-shared"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests.
- os: linux
sudo: false
compiler: "node-4-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-4-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="4"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-8-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
- os: linux
sudo: false
compiler: "node-8-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh
before_install:
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- node --version
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
- |
if [[ -z $JOBS ]]; then
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export JOBS=$((`nproc` + 1))
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export JOBS=$((`sysctl -n hw.ncpu` + 1))
fi
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
sudo mdutil -i off /
fi
- |
if [[ ! -f $(which yarn) ]]; then
npm install -g yarn
fi
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off")
- echo "Using ${JOBS} jobs"
- yarn install --ignore-scripts
- yarn check --ignore-scripts --integrity
# Bootstrap cmake to be able to run mason
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz"
- CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}"
- mkdir -p ${CMAKE_DIR}
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1
- export PATH=${CMAKE_DIR}/bin:${PATH}
- ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}
- ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH}
- |
if [[ ! -z ${CLANG_VERSION} ]]; then
export CCOMPILER='clang'
export CXXCOMPILER='clang++'
${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1
# we only enable lto for release builds
# and therefore don't need to us ld.gold or llvm tools for linking
# for debug builds
if [[ ${BUILD_TYPE} == 'Release' ]]; then
${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1
fi
fi
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
- export OSRM_INSTALL_DIR="$(pwd)/install-osrm"
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- mkdir ${OSRM_BUILD_DIR}
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
-DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
- echo "travis_fold:start:MAKE"
- make --jobs=${JOBS}
- make tests --jobs=${JOBS}
- make benchmarks --jobs=${JOBS}
- echo "travis_fold:end:MAKE"
- ccache -s
- sudo make install
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib
fi
- popd
- mkdir example/build && pushd example/build
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make --jobs=${JOBS}
- popd
script:
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
- make -C test/data benchmark
- ./example/build/osrm-example test/data/mld/monaco.osrm
# All tests assume to be run from the build directory
- pushd ${OSRM_BUILD_DIR}
- ./unit_tests/library-tests
- ./unit_tests/extractor-tests
- ./unit_tests/contractor-tests
- ./unit_tests/engine-tests
- ./unit_tests/util-tests
- ./unit_tests/server-tests
- ./unit_tests/partitioner-tests
- |
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests
fi
- |
- popd
- yarn test

View File

@ -1,4 +1,338 @@
# UNRELEASED
# Unreleased
- Changes from 5.27.1
- Features
- ADDED: Route pedestrians over highway=platform [#6993](https://github.com/Project-OSRM/osrm-backend/pull/6993)
- REMOVED: Remove all core-CH left-overs [#6920](https://github.com/Project-OSRM/osrm-backend/pull/6920)
- ADDED: Add support for a keepalive_timeout flag. [#6674](https://github.com/Project-OSRM/osrm-backend/pull/6674)
- ADDED: Add support for a default_radius flag. [#6575](https://github.com/Project-OSRM/osrm-backend/pull/6575)
- ADDED: Add support for disabling feature datasets. [#6666](https://github.com/Project-OSRM/osrm-backend/pull/6666)
- ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842)
- ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658)
- Build:
- CHANGED: Upgrade clang-format to version 15. [#6919](https://github.com/Project-OSRM/osrm-backend/pull/6919)
- CHANGED: Use Debian Bookworm as base Docker image [#6904](https://github.com/Project-OSRM/osrm-backend/pull/6904)
- CHANGED: Upgrade CI actions to latest versions [#6893](https://github.com/Project-OSRM/osrm-backend/pull/6893)
- CHANGED: Remove outdated warnings #6894 [#6894](https://github.com/Project-OSRM/osrm-backend/pull/6894)
- ADDED: Add CI job which builds OSRM with gcc 12. [#6455](https://github.com/Project-OSRM/osrm-backend/pull/6455)
- CHANGED: Upgrade to clang-tidy 15. [#6439](https://github.com/Project-OSRM/osrm-backend/pull/6439)
- CHANGED: Update actions/cache to v3. [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
- REMOVED: Drop support of Node 12 & 14. [#6431](https://github.com/Project-OSRM/osrm-backend/pull/6431)
- ADDED: Add 'load directly' mode to default Cucumber test suite. [#6663](https://github.com/Project-OSRM/osrm-backend/pull/6663)
- CHANGED: Fix compilation for Boost 1.85.0 [#6856](https://github.com/Project-OSRM/osrm-backend/pull/6856)
- CHANGED: Drop support for Node 16 [#6855](https://github.com/Project-OSRM/osrm-backend/pull/6855)
- REMOVED: Remove unused AppVeyor files [#6860](https://github.com/Project-OSRM/osrm-backend/pull/6860)
- CHANGED: Upgrade clang-format to version 15 [#6859](https://github.com/Project-OSRM/osrm-backend/pull/6859)
- NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc:
- CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062)
- CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991)
- CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988)
- CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983)
- CHANGED: Get rid of boost::optional leftovers. [#6977](https://github.com/Project-OSRM/osrm-backend/pull/6977)
- CHANGED: Use Link Time Optimisation whenever possible. [#6967](https://github.com/Project-OSRM/osrm-backend/pull/6967)
- CHANGED: Use struct instead of tuple to define UnpackedPath. [#6974](https://github.com/Project-OSRM/osrm-backend/pull/6974)
- CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976)
- CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952)
- CHANGED: Optimise encodePolyline function. [#6940](https://github.com/Project-OSRM/osrm-backend/pull/6940)
- CHANGED: Avoid reallocations in base64 encoding. [#6951](https://github.com/Project-OSRM/osrm-backend/pull/6951)
- CHANGED: Get rid of unused Boost dependencies. [#6960](https://github.com/Project-OSRM/osrm-backend/pull/6960)
- CHANGED: Apply micro-optimisation for Table & Trip APIs. [#6949](https://github.com/Project-OSRM/osrm-backend/pull/6949)
- CHANGED: Apply micro-optimisation for Route API. [#6948](https://github.com/Project-OSRM/osrm-backend/pull/6948)
- CHANGED: Apply micro-optimisation for Match API. [#6945](https://github.com/Project-OSRM/osrm-backend/pull/6945)
- CHANGED: Apply micro-optimisation for Nearest API. [#6944](https://github.com/Project-OSRM/osrm-backend/pull/6944)
- CHANGED: Avoid copy of intersection in totalTurnAngle. [#6938](https://github.com/Project-OSRM/osrm-backend/pull/6938)
- CHANGED: Use std::unordered_map::emplace instead of operator[] when producing JSONs. [#6936](https://github.com/Project-OSRM/osrm-backend/pull/6936)
- CHANGED: Avoid copy of vectors in MakeRoute function. [#6939](https://github.com/Project-OSRM/osrm-backend/pull/6939)
- FIXED: Fix bugprone-unused-return-value clang-tidy warning. [#6934](https://github.com/Project-OSRM/osrm-backend/pull/6934)
- FIXED: Fix performance-noexcept-move-constructor clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6933)
- FIXED: Fix performance-noexcept-swap clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6931)
- CHANGED: Use custom struct instead of std::pair in QueryHeap. [#6921](https://github.com/Project-OSRM/osrm-backend/pull/6921)
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
- CHANGED: Get rid of boost::math::constants::* and M_PI in favor of std::numbers. [#6916](https://github.com/Project-OSRM/osrm-backend/pull/6916)
- CHANGED: Make constants in PackedVector constexpr. [#6917](https://github.com/Project-OSRM/osrm-backend/pull/6917)
- CHANGED: Use std::variant instead of mapbox::util::variant. [#6903](https://github.com/Project-OSRM/osrm-backend/pull/6903)
- CHANGED: Bump rapidjson to version f9d53419e912910fd8fa57d5705fa41425428c35 [#6906](https://github.com/Project-OSRM/osrm-backend/pull/6906)
- CHANGED: Bump mapbox/variant to version 1.2.0 [#6898](https://github.com/Project-OSRM/osrm-backend/pull/6898)
- CHANGED: Avoid copy of std::function-based callback in path unpacking [#6895](https://github.com/Project-OSRM/osrm-backend/pull/6895)
- CHANGED: Replace boost::hash by std::hash [#6892](https://github.com/Project-OSRM/osrm-backend/pull/6892)
- CHANGED: Partial fix migration from boost::optional to std::optional [#6551](https://github.com/Project-OSRM/osrm-backend/issues/6551)
- CHANGED: Replace boost::filesystem with std::filesystem [#6432](https://github.com/Project-OSRM/osrm-backend/pull/6432)
- CHANGED: Update Conan Boost version to 1.85.0. [#6868](https://github.com/Project-OSRM/osrm-backend/pull/6868)
- FIXED: Fix an error in a RouteParameters AnnotationsType operator overload. [#6646](https://github.com/Project-OSRM/osrm-backend/pull/6646)
- ADDED: Add support for "unlimited" to be passed as a value for the default-radius and max-matching-radius flags. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
- CHANGED: Allow -1.0 as unlimited for default_radius value. [#6599](https://github.com/Project-OSRM/osrm-backend/pull/6599)
- CHANGED: keep libosrm* in the docker image for downstream linking [#6602](https://github.com/Project-OSRM/osrm-backend/pull/6602)
- CHANGED: Move vector in CSVFilesParser instead copying it. [#6470](https://github.com/Project-OSRM/osrm-backend/pull/6470)
- REMOVED: Get rid of unused functions in util/json_util.hpp. [#6446](https://github.com/Project-OSRM/osrm-backend/pull/6446)
- FIXED: Apply workaround for Conan installation issue on CI. [#6442](https://github.com/Project-OSRM/osrm-backend/pull/6442)
- FIXED: Fix `npm audit` warnings in NPM package. [#6437](https://github.com/Project-OSRM/osrm-backend/pull/6437)
- FIXED: Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only. [#6417](https://github.com/Project-OSRM/osrm-backend/pull/6417)
- FIXED: Fix annotations=true handling in NodeJS bindings & libosrm. [#6415](https://github.com/Project-OSRM/osrm-backend/pull/6415/)
- FIXED: Fix bindings compilation issue on the latest Node. Update NAN to 2.17.0. [#6416](https://github.com/Project-OSRM/osrm-backend/pull/6416)
- CHANGED: Make edge metrics strongly typed [#6420](https://github.com/Project-OSRM/osrm-backend/pull/6420)
- FIXED: Typo in file name src/util/timed_historgram.cpp -> src/util/timed_histogram.cpp [#6428](https://github.com/Project-OSRM/osrm-backend/issues/6428)
- CHANGED: Replace boost::string_ref with std::string_view [#6433](https://github.com/Project-OSRM/osrm-backend/pull/6433)
- ADDED: Print tracebacks for Lua runtime errors [#6564](https://github.com/Project-OSRM/osrm-backend/pull/6564)
- FIXED: Added a variable to preprocessor guard in file osrm-backend/include/util/range_table.hpp to solve build error. [#6596](https://github.com/Project-OSRM/osrm-backend/pull/6596)
- FIXED: Ensure required file check in osrm-routed is correctly enforced. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
- FIXED: Correct HTTP docs to reflect summary output dependency on steps parameter. [#6655](https://github.com/Project-OSRM/osrm-backend/pull/6655)
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
- Profiles:
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
- ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044)
- Routing:
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
- FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739)
- FIXED: Remove force-loop checks for routes with u-turns [#6858](https://github.com/Project-OSRM/osrm-backend/pull/6858)
- FIXED: Correctly check runtime search conditions for forcing routing steps [#6866](https://github.com/Project-OSRM/osrm-backend/pull/6866)
- Map Matching:
- CHANGED: Optimise path distance calculation in MLD map matching even more. [#6884](https://github.com/Project-OSRM/osrm-backend/pull/6884)
- CHANGED: Optimise path distance calculation in MLD map matching. [#6876](https://github.com/Project-OSRM/osrm-backend/pull/6876)
- CHANGED: Optimise R-tree queries in the case of map matching. [#6881](https://github.com/Project-OSRM/osrm-backend/pull/6876)
- Debug tiles:
- FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726)
# 5.27.1
- Changes from 5.27.0
- Misc:
- FIXED: Revert back to using custom HTTP parser instead of Boost.Beast. [#6407](https://github.com/Project-OSRM/osrm-backend/pull/6407)
- FIXED: Fix bug with large HTTP requests leading to Bad Request in osrm-routed. [#6403](https://github.com/Project-OSRM/osrm-backend/pull/6403)
- Routing:
- CHANGED: Add support for surface=metal,grass_paver,woodchips in bicyle profile. [#6395](https://github.com/Project-OSRM/osrm-backend/pull/6395)
# 5.27.0
- Changes from 5.26.0
- API:
- ADDED: Add Flatbuffers support to NodeJS bindings. [#6338](https://github.com/Project-OSRM/osrm-backend/pull/6338)
- CHANGED: Add `data_version` field to responses of all services. [#5387](https://github.com/Project-OSRM/osrm-backend/pull/5387)
- FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294)
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
- FIXED: Fix HTTP compression precedence [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
- NodeJS:
- FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060)
- Misc:
- ADDED: conanbuildinfo.json for easy reading of dependencies [#6388](https://github.com/Project-OSRM/osrm-backend/pull/6388)
- CHANGED: Improve performance of JSON rendering. Fix undefined behaviour in JSON numbers formatting. [#6380](https://github.com/Project-OSRM/osrm-backend/pull/6380)
- ADDED: Add timestamps for logs. [#6375](https://github.com/Project-OSRM/osrm-backend/pull/6375)
- CHANGED: Improve performance of map matching via getPathDistance optimization. [#6378](https://github.com/Project-OSRM/osrm-backend/pull/6378)
- CHANGED: Optimize RestrictionParser performance. [#6344](https://github.com/Project-OSRM/osrm-backend/pull/6344)
- ADDED: Support floats for speed value in traffic updates CSV. [#6327](https://github.com/Project-OSRM/osrm-backend/pull/6327)
- CHANGED: Use Lua 5.4 in Docker image. [#6346](https://github.com/Project-OSRM/osrm-backend/pull/6346)
- CHANGED: Remove redundant nullptr check. [#6326](https://github.com/Project-OSRM/osrm-backend/pull/6326)
- CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360)
- CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318)
- FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315)
- FIXED: Fix performance issue after migration to sol2 3.3.0. [#6304](https://github.com/Project-OSRM/osrm-backend/pull/6304)
- CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298)
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
- FIXED: Internal refactoring of identifier types used in data facade [#6044](https://github.com/Project-OSRM/osrm-backend/pull/6044)
- CHANGED: Update docs to reflect recent build and dependency changes [#6383](https://github.com/Project-OSRM/osrm-backend/issues/6383)
- Build:
- REMOVED: Get rid of Mason. [#6387](https://github.com/Project-OSRM/osrm-backend/pull/6387)
- CHANGED: Use clang-format from CI base image. [#6391](https://github.com/Project-OSRM/osrm-backend/pull/6391)
- ADDED: Build Node bindings on Windows. [#6334](https://github.com/Project-OSRM/osrm-backend/pull/6334)
- ADDED: Configure cross-compilation for Apple Silicon. [#6360](https://github.com/Project-OSRM/osrm-backend/pull/6360)
- CHANGED: Use apt-get to install Clang on CI. [#6345](https://github.com/Project-OSRM/osrm-backend/pull/6345)
- CHANGED: Fix TBB in case of Conan + NodeJS build. [#6333](https://github.com/Project-OSRM/osrm-backend/pull/6333)
- CHANGED: Migrate to modern TBB version. [#6300](https://github.com/Project-OSRM/osrm-backend/pull/6300)
- CHANGED: Enable performance-move-const-arg clang-tidy check. [#6319](https://github.com/Project-OSRM/osrm-backend/pull/6319)
- CHANGED: Use the latest node on CI. [#6317](https://github.com/Project-OSRM/osrm-backend/pull/6317)
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
- ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313)
- CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303)
- CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299)
- CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290)
- CHANGED: Use Conan instead of Mason to install code dependencies. [#6284](https://github.com/Project-OSRM/osrm-backend/pull/6284)
- CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [#6279](https://github.com/Project-OSRM/osrm-backend/pull/6279)
- CHANGED: Update macOS CI image to macos-11. [#6286](https://github.com/Project-OSRM/osrm-backend/pull/6286)
- CHANGED: Enable even more clang-tidy checks. [#6273](https://github.com/Project-OSRM/osrm-backend/pull/6273)
- CHANGED: Configure CMake to not build flatbuffers tests and samples. [#6274](https://github.com/Project-OSRM/osrm-backend/pull/6274)
- CHANGED: Enable more clang-tidy checks. [#6270](https://github.com/Project-OSRM/osrm-backend/pull/6270)
- CHANGED: Configure clang-tidy job on CI. [#6261](https://github.com/Project-OSRM/osrm-backend/pull/6261)
- CHANGED: Use Github Actions for building container images [#6138](https://github.com/Project-OSRM/osrm-backend/pull/6138)
- CHANGED: Upgrade Boost dependency to 1.70 [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
- CHANGED: Upgrade Ubuntu CI builds to 20.04 [#6119](https://github.com/Project-OSRM/osrm-backend/pull/6119)
- CHANGED: Make building osrm-routed optional [#6144](https://github.com/Project-OSRM/osrm-backend/pull/6144)
- FIXED: Run all unit tests in CI [#5248](https://github.com/Project-OSRM/osrm-backend/pull/5248)
- FIXED: Fix installation of Mason CMake and 32 bit CI build [#6170](https://github.com/Project-OSRM/osrm-backend/pull/6170)
- FIXED: Fixed Node docs generation check in CI. [#6058](https://github.com/Project-OSRM/osrm-backend/pull/6058)
- CHANGED: Docker build, enabled arm64 build layer [#6172](https://github.com/Project-OSRM/osrm-backend/pull/6172)
- CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [#6175](https://github.com/Project-OSRM/osrm-backend/pull/6175)
- FIXED: Bump CI complete meta job to ubuntu-20.04 [#6323](https://github.com/Project-OSRM/osrm-backend/pull/6323)
- CHANGED: Node packages are now scoped by @project-osrm [#6386](https://github.com/Project-OSRM/osrm-backend/issues/6386)
- Routing:
- CHANGED: Lazily generate optional route path data [#6045](https://github.com/Project-OSRM/osrm-backend/pull/6045)
- FIXED: Completed support for no_entry and no_exit turn restrictions. [#5988](https://github.com/Project-OSRM/osrm-backend/pull/5988)
- ADDED: Add support for non-round-trips with a single fixed endpoint. [#6050](https://github.com/Project-OSRM/osrm-backend/pull/6050)
- FIXED: Improvements to maneuver override processing [#6125](https://github.com/Project-OSRM/osrm-backend/pull/6125)
- ADDED: Support snapping to multiple ways at an input location. [#5953](https://github.com/Project-OSRM/osrm-backend/pull/5953)
- FIXED: Fix snapping target locations to ways used in turn restrictions. [#6339](https://github.com/Project-OSRM/osrm-backend/pull/6339)
- ADDED: Support OSM traffic signal directions. [#6153](https://github.com/Project-OSRM/osrm-backend/pull/6153)
- FIXED: Ensure u-turn exists in intersection view. [#6376](https://github.com/Project-OSRM/osrm-backend/pull/6376)
- FIXED: Gracefully handle no-turn intersections in guidance processing. [#6382](https://github.com/Project-OSRM/osrm-backend/issues/6382)
- Profile:
- CHANGED: Bicycle surface speeds [#6212](https://github.com/Project-OSRM/osrm-backend/pull/6212)
- Tools:
- CHANGED: Do not generate intermediate .osrm file in osrm-extract. [#6354](https://github.com/Project-OSRM/osrm-backend/pull/6354)
# 5.26.0
- Changes from 5.25.0
- API:
- FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090)
- FIXED: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112)
- Build:
- CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071)
- FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083)
- FIXED: Fixed test cache to consider MLD executable changes. [#6129](https://github.com/Project-OSRM/osrm-backend/pull/6129)
- Routing:
- FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084)
- FIXED: Fix MLD level mask generation to support 64-bit masks. [#6123](https://github.com/Project-OSRM/osrm-backend/pull/6123)
- FIXED: Fix metric offset overflow for large MLD partitions. This breaks the **data format** [#6124](https://github.com/Project-OSRM/osrm-backend/pull/6124)
# 5.25.0
- Changes from 5.24.0
- Build:
- CHANGED: Node binaries now use Github Releases for hosting [#6030](https://github.com/Project-OSRM/osrm-backend/pull/6030)
- Misc:
- FIXED: Upgrade to @mapbox/node-pre-gyp fix various bugs with Node 12/14 [#5991](https://github.com/Project-OSRM/osrm-backend/pull/5991)
- FIXED: `valid` type in documentation examples [#5990](https://github.com/Project-OSRM/osrm-backend/issues/5990)
- FIXED: Remove redundant loading of .osrm.cell_metrics [#6019](https://github.com/Project-OSRM/osrm-backend/issues/6019)
- CHANGED: Increase PackedOSMIDs size to 34 bits. This breaks the **data format** [#6020](https://github.com/Project-OSRM/osrm-backend/issues/6020)
- Profile:
- FIXED: Add kerb barrier exception to default car profile. [#5999](https://github.com/Project-OSRM/osrm-backend/pull/5999)
# 5.24.0
- Changes from 5.23.0
- Features
- ADDED: Added support for multiple via-way restrictions. [#5907](https://github.com/Project-OSRM/osrm-backend/pull/5907)
- ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
- REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
- Routing:
- FIXED: Avoid copying ManyToMany table results [#5923](https://github.com/Project-OSRM/osrm-backend/pull/5923)
- FIXED: Reduce copying in API parameter constructors [#5925](https://github.com/Project-OSRM/osrm-backend/pull/5925)
- Misc:
- CHANGED: Cleanup NodeJS dependencies [#5945](https://github.com/Project-OSRM/osrm-backend/pull/5945)
- CHANGED: Unify `.osrm.turn_penalites_index` dump processing same with `.osrm.turn_weight_penalties` and `.osrm.turn_duration_penalties` [#5868](https://github.com/Project-OSRM/osrm-backend/pull/5868)
- FIXED: Properly validate source/destination validation in NodeJS table service [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595/files)
- FIXED: turn.roads_on_the_left not containing incoming roads and turn.roads_on_the_right not containing outgoing roads on two-way roads [#5128](https://github.com/Project-OSRM/osrm-backend/issues/5128)
- Profile:
- ADDED: Profile debug script which fetches a way from OSM then outputs the result of the profile. [#5908](https://github.com/Project-OSRM/osrm-backend/pull/5908)
- Infrastructure
- CHANGED: Bundled protozero updated to v1.7.0. [#5858](https://github.com/Project-OSRM/osrm-backend/pull/5858)
- Windows:
- FIXED: Fix bit-shift overflow in MLD partition step. [#5878](https://github.com/Project-OSRM/osrm-backend/pull/5878)
- FIXED: Fix vector bool permutation in graph contraction step [#5882](https://github.com/Project-OSRM/osrm-backend/pull/5882)
- API:
- FIXED: Undo libosrm API break by adding old interface as method overload [#5861](https://github.com/Project-OSRM/osrm-backend/pull/5861)
- FIXED: Fixed validation of sources/destinations when accessed via node bindings [#5595](https://github.com/Project-OSRM/osrm-backend/pull/5595)
# 5.23.0
- Changes from 5.22.0
- Build:
- FIXED: pessimistic calls to std::move [#5560](https://github.com/Project-OSRM/osrm-backend/pull/5561)
- Features:
- ADDED: new API parameter - `snapping=any|default` to allow snapping to previously unsnappable edges [#5361](https://github.com/Project-OSRM/osrm-backend/pull/5361)
- ADDED: keepalive support to the osrm-routed HTTP server [#5518](https://github.com/Project-OSRM/osrm-backend/pull/5518)
- ADDED: flatbuffers output format support [#5513](https://github.com/Project-OSRM/osrm-backend/pull/5513)
- ADDED: Global 'skip_waypoints' option [#5556](https://github.com/Project-OSRM/osrm-backend/pull/5556)
- FIXED: Install the libosrm_guidance library correctly [#5604](https://github.com/Project-OSRM/osrm-backend/pull/5604)
- FIXED: Http Handler can now deal witch optional whitespace between header-key and -value [#5606](https://github.com/Project-OSRM/osrm-backend/issues/5606)
- Routing:
- CHANGED: allow routing past `barrier=arch` [#5352](https://github.com/Project-OSRM/osrm-backend/pull/5352)
- CHANGED: default car weight was reduced to 2000 kg. [#5371](https://github.com/Project-OSRM/osrm-backend/pull/5371)
- CHANGED: default car height was reduced to 2 meters. [#5389](https://github.com/Project-OSRM/osrm-backend/pull/5389)
- FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [#5622](https://github.com/Project-OSRM/osrm-backend/pull/5622)
- FIXED: fix table result when source and destination on same one-way segment. [#5828](https://github.com/Project-OSRM/osrm-backend/pull/5828)
- FIXED: fix occasional segfault when swapping data with osrm-datastore and using `exclude=` [#5844](https://github.com/Project-OSRM/osrm-backend/pull/5844)
- FIXED: fix crash in MLD alternative search if source or target are invalid [#5851](https://github.com/Project-OSRM/osrm-backend/pull/5851)
- Misc:
- CHANGED: Reduce memory usage for raster source handling. [#5572](https://github.com/Project-OSRM/osrm-backend/pull/5572)
- CHANGED: Add cmake option `ENABLE_DEBUG_LOGGING` to control whether output debug logging. [#3427](https://github.com/Project-OSRM/osrm-backend/issues/3427)
- CHANGED: updated extent of Hong Kong as left hand drive country. [#5535](https://github.com/Project-OSRM/osrm-backend/issues/5535)
- FIXED: corrected error message when failing to snap input coordinates [#5846](https://github.com/Project-OSRM/osrm-backend/pull/5846)
- Infrastructure
- REMOVED: STXXL support removed as STXXL became abandonware. [#5760](https://github.com/Project-OSRM/osrm-backend/pull/5760)
# 5.22.0
- Changes from 5.21.0
- Build:
- ADDED: optionally build Node `lts` and `latest` bindings [#5347](https://github.com/Project-OSRM/osrm-backend/pull/5347)
- Features:
- ADDED: new waypoints parameter to the `route` plugin, enabling silent waypoints [#5345](https://github.com/Project-OSRM/osrm-backend/pull/5345)
- ADDED: data timestamp information in the response (saved in new file `.osrm.timestamp`). [#5115](https://github.com/Project-OSRM/osrm-backend/issues/5115)
# 5.21.0
- Changes from 5.20.0
- Features:
- ADDED: all waypoints in responses now contain a distance property between the original coordinate and the snapped location. [#5255](https://github.com/Project-OSRM/osrm-backend/pull/5255)
- ADDED: if `fallback_speed` is used, a new structure `fallback_speed_cells` will describe which cells contain estimated values [#5259](https://github.com/Project-OSRM/osrm-backend/pull/5259)
- REMOVED: we no longer publish Node 4 or 6 binary modules (they are still buildable from source) [#5314](https://github.com/Project-OSRM/osrm-backend/pull/5314)
- Table:
- ADDED: new parameter `scale_factor` which will scale the cell `duration` values by this factor. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5298)
- FIXED: only trigger `scale_factor` code to scan matrix when necessary. [#5303](https://github.com/Project-OSRM/osrm-backend/pull/5303)
- FIXED: fix bug in reverse offset calculation that sometimes lead to negative (and other incorrect) values in distance table results [#5315](https://github.com/Project-OSRM/osrm-backend/pull/5315)
- Docker:
- FIXED: use consistent boost version between build and runtime [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
- FIXED: don't override default permissions on /opt [#5311](https://github.com/Project-OSRM/osrm-backend/pull/5311)
- Matching:
- CHANGED: matching will now consider edges marked with is_startpoint=false, allowing matching over ferries and other previously non-matchable edge types. [#5297](https://github.com/Project-OSRM/osrm-backend/pull/5297)
- Profile:
- ADDED: Parse `source:maxspeed` and `maxspeed:type` tags to apply maxspeeds and add belgian flanders rural speed limit. [#5217](https://github.com/Project-OSRM/osrm-backend/pull/5217)
- CHANGED: Refactor maxspeed parsing to use common library. [#5144](https://github.com/Project-OSRM/osrm-backend/pull/5144)
# 5.20.0
- Changes from 5.19.0:
- Table:
- CHANGED: switch to pre-calculated distances for table responses for large speedup and 10% memory increase. [#5251](https://github.com/Project-OSRM/osrm-backend/pull/5251)
- ADDED: new parameter `fallback_speed` which will fill `null` cells with estimated value [#5257](https://github.com/Project-OSRM/osrm-backend/pull/5257)
- CHANGED: Remove API check for matrix sources/destination length to be less than or equal to coordinates length. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5289)
- FIXED: Fix crashing bug when using fallback_speed parameter with more sources than destinations. [#5291](https://github.com/Project-OSRM/osrm-backend/pull/5291)
- Features:
- ADDED: direct mmapping of datafiles is now supported via the `--mmap` switch. [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242)
- REMOVED: the previous `--memory_file` switch is now deprecated and will fallback to `--mmap` [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242)
- ADDED: Now publishing Node 10.x LTS binary modules [#5246](https://github.com/Project-OSRM/osrm-backend/pull/5246)
- Windows:
- FIXED: Windows builds again. [#5249](https://github.com/Project-OSRM/osrm-backend/pull/5249)
- Docker:
- CHANGED: switch from Alpine Linux to Debian Buster base images [#5281](https://github.com/Project-OSRM/osrm-backend/pull/5281)
# 5.19.0
- Changes from 5.18.0:
- Optimizations:
- CHANGED: Use Grisu2 for serializing floating point numbers. [#5188](https://github.com/Project-OSRM/osrm-backend/pull/5188)
- ADDED: Node bindings can return pre-rendered JSON buffer. [#5189](https://github.com/Project-OSRM/osrm-backend/pull/5189)
- Profiles:
- CHANGED: Bicycle profile now blacklists barriers instead of whitelisting them [#5076
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
](https://github.com/Project-OSRM/osrm-backend/pull/5077/)
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101)
- Bugfixes:
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
- Misc:
- CHANGED: Support up to 512 named shared memory regions [#5185](https://github.com/Project-OSRM/osrm-backend/pull/5185)
# 5.18.0
- Changes from 5.17.0:
- Features:
- ADDED: `table` plugin now optionally returns `distance` matrix as part of response [#4990](https://github.com/Project-OSRM/osrm-backend/pull/4990)
- ADDED: New optional parameter `annotations` for `table` that accepts `distance`, `duration`, or both `distance,duration` as values [#4990](https://github.com/Project-OSRM/osrm-backend/pull/4990)
- Infrastructure:
- ADDED: Updated libosmium and added protozero and vtzero libraries [#5037](https://github.com/Project-OSRM/osrm-backend/pull/5037)
- CHANGED: Use vtzero library in tile plugin [#4686](https://github.com/Project-OSRM/osrm-backend/pull/4686)
- Profile:
- ADDED: Bicycle profile now returns classes for ferry and tunnel routes. [#5054](https://github.com/Project-OSRM/osrm-backend/pull/5054)
- ADDED: Bicycle profile allows to exclude ferry routes (default to not enabled) [#5054](https://github.com/Project-OSRM/osrm-backend/pull/5054)
# 5.17.1
- Changes from 5.17.0:
- Bugfixes:
- FIXED: Do not combine a segregated edge with a roundabout [#5039](https://github.com/Project-OSRM/osrm-backend/issues/5039)
# 5.17.0
- Changes from 5.16.0:
- Bugfixes:
- FIXED: deduplication of route steps when waypoints are used [#4909](https://github.com/Project-OSRM/osrm-backend/issues/4909)
@ -6,9 +340,11 @@
- FIXED: Remove the last short annotation segment in `trimShortSegments` [#4946](https://github.com/Project-OSRM/osrm-backend/pull/4946)
- FIXED: Properly calculate annotations for speeds, durations and distances when waypoints are used with mapmatching [#4949](https://github.com/Project-OSRM/osrm-backend/pull/4949)
- FIXED: Don't apply unimplemented SH and PH conditions in OpeningHours and add inversed date ranges [#4992](https://github.com/Project-OSRM/osrm-backend/issues/4992)
- FIXED: integer overflow in `DynamicGraph::Renumber` [#5021](https://github.com/Project-OSRM/osrm-backend/pull/5021)
- Profile:
- CHANGED: Handle oneways in get_forward_backward_by_key [#4929](https://github.com/Project-OSRM/osrm-backend/pull/4929)
- FIXED: Do not route against oneway road if there is a cycleway in the wrong direction; also review bike profile [#4943](https://github.com/Project-OSRM/osrm-backend/issues/4943)
- CHANGED: Make cyclability weighting of the bike profile prefer safer routes more strongly [#5015](https://github.com/Project-OSRM/osrm-backend/issues/5015)
- Guidance:
- CHANGED: Don't use obviousness for links bifurcations [#4929](https://github.com/Project-OSRM/osrm-backend/pull/4929)
- FIXED: Adjust Straight direction modifiers of side roads in driveway handler [#4929](https://github.com/Project-OSRM/osrm-backend/pull/4929)

View File

@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.18)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
@ -18,59 +22,81 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
endif()
option(ENABLE_MASON "Use mason for dependencies" OFF)
option(ENABLE_CONAN "Use conan for dependencies" OFF)
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
option(BUILD_TOOLS "Build OSRM tools" OFF)
option(BUILD_PACKAGE "Build OSRM package" OFF)
option(BUILD_ROUTED "Build osrm-routed HTTP server" ON)
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
option(ENABLE_STXXL "Use STXXL library" OFF)
option(ENABLE_LTO "Use LTO if available" OFF)
option(ENABLE_LTO "Use Link Time Optimisation" ON)
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
option(ENABLE_GLIBC_WORKAROUND "Workaround GLIBC symbol exports" OFF)
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
if (ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
else()
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*;--header-filter=.*")
endif()
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(ENABLE_MASON)
# versions in use
set(MASON_BOOST_VERSION "1.65.1")
set(MASON_STXXL_VERSION "1.4.1-1")
set(MASON_EXPAT_VERSION "2.2.0")
set(MASON_LUA_VERSION "5.2.4")
set(MASON_BZIP2_VERSION "1.0.6")
set(MASON_TBB_VERSION "2017_U7")
message(STATUS "Enabling mason")
find_program(CURL_FOUND curl)
if(NOT CURL_FOUND)
message(FATAL_ERROR "curl command required with -DENABLE_MASON")
endif()
include(mason)
endif()
# be compatible with version handling before cmake 3.x
if (POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(OSRM C CXX)
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
if(LTO_SUPPORTED)
message(STATUS "IPO / LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(FATAL_ERROR "IPO / LTO not supported: <${error}>")
endif()
endif()
# add @loader_path/$ORIGIN to rpath to make binaries relocatable
if (APPLE)
set(CMAKE_BUILD_RPATH "@loader_path")
else()
set(CMAKE_BUILD_RPATH "\$ORIGIN")
# https://stackoverflow.com/questions/6324131/rpath-origin-not-having-desired-effect
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,origin")
endif()
include(JSONParser)
file(READ "package.json" packagejsonraw)
sbeParseJson(packagejson packagejsonraw)
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)")
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
# This regex is not strict enough, but the correct one is too complicated for cmake matching.
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
if (packagejson.version MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)([-+][0-9a-zA-Z.-]+)?$")
set(OSRM_VERSION_MAJOR ${CMAKE_MATCH_1})
set(OSRM_VERSION_MINOR ${CMAKE_MATCH_2})
set(OSRM_VERSION_PATCH ${CMAKE_MATCH_3})
set(OSRM_VERSION_PRERELEASE_BUILD ${CMAKE_MATCH_4})
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
set(OSRM_VERSION packagejson.version)
else()
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible X.Y.Z, but found ${packagejson.version}")
message(FATAL_ERROR "Version from package.json cannot be parsed, expected semver compatible label, but found ${packagejson.version}")
endif()
if (MSVC)
@ -102,35 +128,18 @@ include(CheckCXXCompilerFlag)
include(FindPackageHandleStandardArgs)
include(GNUInstallDirs)
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(STATUS "Building on a 32 bit system")
endif()
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
# Strictly require GCC>=5.0 and Clang>=3.4 - GCC 4.8 is already too old for C++14.
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "GCC>=5.0 required. In case you are on Ubuntu upgrade via ppa:ubuntu-toolchain-r/test")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
message(FATAL_ERROR "Clang>=3.4 required. In case you are on Ubuntu upgrade via http://apt.llvm.org")
endif()
message(FATAL_ERROR "Building on a 32 bit system is not supported")
endif()
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/variant/include)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/generated/include/)
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sol2/include)
set(BOOST_COMPONENTS date_time chrono filesystem iostreams program_options regex system thread unit_test_framework)
set(BOOST_COMPONENTS date_time iostreams program_options thread unit_test_framework)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/util/version.hpp.in
@ -157,7 +166,11 @@ add_library(CONTRACTOR OBJECT ${ContractorGlob})
add_library(UPDATER OBJECT ${UpdaterGlob})
add_library(STORAGE OBJECT ${StorageGlob})
add_library(ENGINE OBJECT ${EngineGlob})
add_library(SERVER OBJECT ${ServerGlob})
if (BUILD_ROUTED)
add_library(SERVER OBJECT ${ServerGlob})
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
endif()
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
@ -165,9 +178,8 @@ add_executable(osrm-extract src/tools/extract.cpp)
add_executable(osrm-partition src/tools/partition.cpp)
add_executable(osrm-customize src/tools/customize.cpp)
add_executable(osrm-contract src/tools/contract.cpp)
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL> )
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_guidance $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:UTIL>)
@ -176,33 +188,6 @@ add_library(osrm_customize src/osrm/customizer.cpp $<TARGET_OBJECTS:CUSTOMIZER>
add_library(osrm_update $<TARGET_OBJECTS:UPDATER> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_store $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
if(ENABLE_GOLD_LINKER)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
message(STATUS "Using GNU gold as linker.")
# Issue 2785: check gold binutils version and don't use gc-sections for versions prior 2.25
string(REGEX REPLACE ".*\\(GNU Binutils[^\\)0-9]+([0-9]+\\.[0-9]+)[^\\)]*\\).*" "\\1" GOLD_BINUTILS_VERSION "${LD_VERSION}")
if ("${GOLD_BINUTILS_VERSION}" VERSION_LESS "2.26")
message(STATUS "Disabling gc-sections on gold binutils < 2.26, see: https://sourceware.org/bugzilla/show_bug.cgi?id=17639")
set(LD_AVOID_GC_SECTIONS TRUE)
endif()
else()
message(WARNING "GNU gold linker isn't available.")
set(ENABLE_GOLD_LINKER OFF)
endif()
endif()
# Disable LTO when mason+gcc is detected before testing for / setting any flags.
# Mason builds libraries with Clang, mixing does not work in the context of lto.
if(ENABLE_MASON AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENABLE_LTO)
set(ENABLE_LTO OFF)
message(WARNING "Mason and GCC's LTO not work together. Disabling LTO.")
endif()
# Explicitly set the build type to Release if no other type is specified
# on the command line. Without this, cmake defaults to an unoptimized,
# non-debug build, which almost nobody wants.
@ -227,6 +212,7 @@ endif()
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "Configuring debug mode flags")
set(ENABLE_ASSERTIONS ON)
set(ENABLE_DEBUG_LOGGING ON)
endif()
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
@ -239,95 +225,30 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
endif()
if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "Configuring release mode optimizations")
# Check if LTO is available
check_cxx_compiler_flag("-Wl,-flto" LTO_AVAILABLE)
if(ENABLE_LTO AND LTO_AVAILABLE)
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# GCC in addition allows parallelizing LTO
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
include(ProcessorCount)
ProcessorCount(NPROC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=${NPROC}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
endif()
set(CHECK_LTO_SRC "int main(){return 0;}")
check_cxx_source_compiles("${CHECK_LTO_SRC}" LTO_WORKS)
if(LTO_WORKS)
message(STATUS "LTO working")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -flto")
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} -flto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -flto")
else()
message(STATUS "LTO broken")
set(CMAKE_CXX_FLAGS "${OLD_CXX_FLAGS}")
set(ENABLE_LTO Off)
endif()
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT MINGW)
find_program(GCC_AR gcc-ar)
find_program(GCC_RANLIB gcc-ranlib)
if ("${GCC_AR}" STREQUAL "GCC_AR-NOTFOUND" OR "${GCC_RANLIB}" STREQUAL "GCC_RANLIB-NOTFOUND")
message(WARNING "GCC specific binutils not found. In case of linker issues export env vars: AR=gcc-ar, NM=gcc-nm, RANLIB=gcc-ranlib")
else()
message(STATUS "Using GCC specific binutils for LTO:")
message(STATUS " ${GCC_AR}")
message(STATUS " ${GCC_RANLIB}")
set(CMAKE_AR ${GCC_AR})
set(CMAKE_RANLIB ${GCC_RANLIB})
endif()
endif()
# Same for clang LTO requires their own toolchain
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
find_program(LLVM_AR llvm-ar)
find_program(LLVM_RANLIB llvm-ranlib)
if ("${LLVM_AR}" STREQUAL "LLVM_AR-NOTFOUND" OR "${LLVM_RANLIB}" STREQUAL "LLVM_RANLIB-NOTFOUND")
message(WARNING "LLVM specific binutils not found.")
else()
message(STATUS "Using LLVM specific binutils for LTO:")
message(STATUS " ${LLVM_AR}")
message(STATUS " ${LLVM_RANLIB}")
set(CMAKE_AR ${LLVM_AR})
set(CMAKE_RANLIB ${LLVM_RANLIB})
endif()
endif()
endif()
endif()
if(UNIX AND NOT APPLE AND ENABLE_MASON AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
message(WARNING "ENABLE_MASON and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
message(WARNING "For more details see: https://github.com/Project-OSRM/osrm-backend/issues/3202")
endif()
set(MAYBE_COVERAGE_LIBRARIES "")
if (ENABLE_COVERAGE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build")
message(ERROR "ENABLE_COVERAGE=ON only makes sense with a Debug build")
endif()
message(STATUS "Enabling coverage")
set(MAYBE_COVERAGE_LIBRARIES "-lgcov")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ftest-coverage -fprofile-arcs")
endif()
if (ENABLE_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(SANITIZER_FLAGS "-g -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=undefined -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_FLAGS}")
endif()
# Configuring compilers
set(OSRM_WARNING_FLAGS "-Werror=all -Werror=extra -Werror=uninitialized -Werror=unreachable-code -Werror=unused-variable -Werror=unreachable-code -Wno-error=cpp -Wpedantic")
include(cmake/warnings.cmake)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=2 -Wno-error=unused-local-typedef -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -Wno-unused-command-line-argument")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(COLOR_FLAG "-fdiagnostics-color=auto")
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
@ -335,194 +256,163 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(COLOR_FLAG "")
endif()
# using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSRM_WARNING_FLAGS} -Werror=strict-overflow=1 -Wno-error=maybe-uninitialized -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ${COLOR_FLAG} -fPIC -ftemplate-depth=1024")
if(WIN32) # using mingw
add_dependency_defines(-DWIN32)
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
endif()
# -fpermissive is required for parallel_do Intel TBB internal issue with GCC < 5
# https://github.com/Project-OSRM/osrm-backend/pull/3603#issuecomment-277688589
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(STATUS "Adding -fpermissive for GCC version < 5 bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51048). See #3603.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# using Intel C++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# using Visual Studio C++
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h
add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC)
add_dependency_defines(-D_CRT_SECURE_NO_WARNINGS)
add_dependency_defines(-DNOMINMAX) # avoid min and max macros that can break compilation
add_dependency_defines(-D_USE_MATH_DEFINES) #needed for M_PI with cmath.h
add_dependency_defines(-D_WIN32_WINNT=0x0501)
add_dependency_defines(-DXML_STATIC)
find_library(ws2_32_LIBRARY_PATH ws2_32)
target_link_libraries(osrm-extract wsock32 ws2_32)
endif()
# Configuring linker
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ERROR_QUIET OUTPUT_VARIABLE LINKER_VERSION)
# For ld.gold and ld.bfs (the GNU linkers) we optimize hard
if("${LINKER_VERSION}" MATCHES "GNU gold" OR "${LINKER_VERSION}" MATCHES "GNU ld")
message(STATUS "Setting linker optimizations")
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR "${LD_AVOID_GC_SECTIONS}"))
# Tell compiler to put every function in separate section, linker can then match sections and functions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
# Tell linker to do dead code and data eminination during link time discarding sections
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--gc-sections")
endif()
# Default linker optimization flags
set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common")
else()
message(STATUS "Using unknown linker, not setting linker optimizations")
endif ()
set(OSRM_LDFLAGS "${OSRM_LDFLAGS} ${LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# Activate C++1y
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(OSRM_CXXFLAGS "${OSRM_CXXFLAGS} -std=c++14")
endif()
# Configuring other platform dependencies
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_OSX_ARCHITECTURES "x86_64")
message(STATUS "Set Architecture to x64 on OS X")
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(OSXLIBSTD)
message(STATUS "linking against ${OSXLIBSTD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=${OSXLIBSTD}")
elseif(DARWIN_VERSION GREATER 12)
message(STATUS "linking against libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
if(UNIX AND NOT APPLE)
set(MAYBE_RT_LIBRARY -lrt)
find_library(RT_LIB rt)
if (RT_LIB)
set(MAYBE_RT_LIBRARY -lrt)
endif()
endif()
# Disallow deprecated protozero APIs
add_definitions(-DPROTOZERO_STRICT_API)
find_package(Threads REQUIRED)
# if mason is enabled no find_package calls are made
# to ensure that we are only compiling and linking against
# fully portable mason packages
if(ENABLE_MASON)
message(STATUS "Installing dependencies via mason")
# Third-party libraries
set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
target_no_warning(MICROTAR unused-variable)
target_no_warning(MICROTAR format)
set(PROTOZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/protozero/include")
include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})
set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include")
include_directories(SYSTEM ${VTZERO_INCLUDE_DIR})
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Disable the build of Flatbuffers tests and samples.")
set(FLATBUFFERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers")
set(FLATBUFFERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include")
include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_DIR})
add_subdirectory(${FLATBUFFERS_SRC_DIR}
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
EXCLUDE_FROM_ALL)
set(FMT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt/include")
add_compile_definitions(FMT_HEADER_ONLY)
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package
if (MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
if(ENABLE_CONAN)
message(STATUS "Installing dependencies via Conan")
# Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
conan_check(REQUIRED)
set(CONAN_BOOST_VERSION "1.85.0@#14265ec82b25d91305bbb3b30d3357f8")
set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897")
set(CONAN_EXPAT_VERSION "2.6.2@#2d385d0d50eb5561006a7ff9e356656b")
set(CONAN_LUA_VERSION "5.4.6@#658d6089093cf01992c2737ab2e96763")
set(CONAN_TBB_VERSION "2021.12.0@#e56e5b44be8d690530585dd3634c0106")
set(CONAN_SYSTEM_INCLUDES ON)
set(CONAN_ARGS
REQUIRES
"boost/${CONAN_BOOST_VERSION}"
"bzip2/${CONAN_BZIP2_VERSION}"
"expat/${CONAN_EXPAT_VERSION}"
"lua/${CONAN_LUA_VERSION}"
"onetbb/${CONAN_TBB_VERSION}"
BASIC_SETUP
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
KEEP_RPATHS
NO_OUTPUT_DIRS
OPTIONS boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
BUILD missing
)
# Enable revisions in the conan config
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE)
if(NOT "${RET_CODE}" STREQUAL "0")
message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'")
endif()
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
# cross-compilation for Apple Silicon
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
conan_cmake_run("${CONAN_ARGS};ARCH;armv8")
else()
conan_cmake_run("${CONAN_ARGS}")
endif()
add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})
add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2})
add_dependency_includes(${CONAN_INCLUDE_DIRS_EXPAT})
add_dependency_includes(${CONAN_INCLUDE_DIRS_LUA})
add_dependency_includes(${CONAN_INCLUDE_DIRS_TBB})
set(Boost_USE_STATIC_LIBS ON)
mason_use(boost VERSION ${MASON_BOOST_VERSION} HEADER_ONLY)
add_dependency_includes(${MASON_PACKAGE_boost_INCLUDE_DIRS})
mason_use(boost_libfilesystem VERSION ${MASON_BOOST_VERSION})
set(Boost_FILESYSTEM_LIBRARY ${MASON_PACKAGE_boost_libfilesystem_STATIC_LIBS})
mason_use(boost_libiostreams VERSION ${MASON_BOOST_VERSION})
set(Boost_IOSTREAMS_LIBRARY ${MASON_PACKAGE_boost_libiostreams_STATIC_LIBS})
mason_use(boost_libprogram_options VERSION ${MASON_BOOST_VERSION})
set(Boost_PROGRAM_OPTIONS_LIBRARY ${MASON_PACKAGE_boost_libprogram_options_STATIC_LIBS})
mason_use(boost_libregex VERSION ${MASON_BOOST_VERSION})
set(Boost_REGEX_LIBRARY ${MASON_PACKAGE_boost_libregex_STATIC_LIBS})
mason_use(boost_libtest VERSION ${MASON_BOOST_VERSION})
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY ${MASON_PACKAGE_boost_libtest_STATIC_LIBS})
mason_use(boost_libdate_time VERSION ${MASON_BOOST_VERSION})
set(Boost_DATE_TIME_LIBRARY ${MASON_PACKAGE_boost_libdate_time_STATIC_LIBS})
mason_use(boost_libthread VERSION ${MASON_BOOST_VERSION})
set(Boost_THREAD_LIBRARY ${MASON_PACKAGE_boost_libthread_STATIC_LIBS})
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}")
set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}")
set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}")
set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}")
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
if (ENABLE_STXXL)
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
add_definitions(-DUSE_STXXL_LIBRARY)
endif()
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
set(EXPAT_LIBRARIES ${MASON_PACKAGE_expat_STATIC_LIBS})
find_package(BZip2 REQUIRED)
find_package(EXPAT REQUIRED)
find_package(lua REQUIRED)
set(LUA_LIBRARIES ${lua_LIBRARIES})
mason_use(lua VERSION ${MASON_LUA_VERSION})
add_dependency_includes(${MASON_PACKAGE_lua_INCLUDE_DIRS})
set(USED_LUA_LIBRARIES ${MASON_PACKAGE_lua_STATIC_LIBS})
find_package(TBB REQUIRED)
mason_use(bzip2 VERSION ${MASON_BZIP2_VERSION})
add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS})
set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS})
mason_use(tbb VERSION ${MASON_TBB_VERSION})
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
endif()
set(TBB_LINKER_RPATHS "")
foreach(libpath ${MASON_PACKAGE_tbb_LIBRARY_DIRS})
set(TBB_LINKER_RPATHS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,${libpath}")
file(GLOB TBBGlob ${libpath}/*.*)
install(FILES ${TBBGlob} DESTINATION lib)
endforeach()
if(APPLE)
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} -Wl,-rpath -Wl,@loader_path")
elseif(UNIX)
set(LINKER_FLAGS "${TBB_LINKER_RPATHS} '-Wl,-rpath,$ORIGIN' -Wl,-z,origin")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
# note: we avoid calling find_package(Osmium ...) here to ensure that the
# expat and bzip2 are used from mason rather than the system
# expat and bzip2 are used from conan rather than the system
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
else()
find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
add_dependency_includes(${Boost_INCLUDE_DIRS})
if(WIN32 AND Boost_VERSION VERSION_LESS 106200)
message(FATAL_ERROR "Building with MSVC needs Boost 1.62 with CXX11_CONSTEXPR support")
endif()
find_package(TBB REQUIRED)
add_dependency_includes(${TBB_INCLUDE_DIR})
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
endif()
set(TBB_LIBRARIES TBB::tbb)
find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
if (ENABLE_STXXL)
find_package(STXXL)
if (STXXL_FOUND)
add_dependency_includes(${STXXL_INCLUDE_DIR})
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
add_definitions(-DUSE_STXXL_LIBRARY)
else()
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
endif()
endif()
find_package(BZip2 REQUIRED)
add_dependency_includes(${BZIP2_INCLUDE_DIR})
@ -531,7 +421,6 @@ else()
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
endif()
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
add_dependency_includes(${LUA_INCLUDE_DIR})
# add a target to generate API documentation with Doxygen
@ -554,14 +443,6 @@ else()
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
endif()
set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
# prefix compilation with ccache by default if available and on clang or gcc
if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
find_program(CCACHE_FOUND ccache)
@ -569,46 +450,27 @@ if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILE
message(STATUS "Using ccache to speed up incremental builds")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set(ENV{CCACHE_CPP2} "true")
endif()
endif()
# even with mason builds we want to link to system zlib
# even with conan builds we want to link to system zlib
# to ensure that osrm binaries play well with other binaries like nodejs
find_package(ZLIB REQUIRED)
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
endif()
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
endif()
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
add_dependency_defines(-DBOOST_FILESYSTEM_NO_DEPRECATED)
if (ENABLE_STXXL)
set(OpenMP_FIND_QUIETLY ON)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "OpenMP support found. Linking just in case for stxxl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
# Workaround for https://github.com/boostorg/phoenix/issues/111
add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_)
add_definitions(${OSRM_DEFINES})
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
set(BOOST_BASE_LIBRARIES
${Boost_DATE_TIME_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_SYSTEM_LIBRARY})
${Boost_THREAD_LIBRARY})
set(BOOST_ENGINE_LIBRARIES
${Boost_ZLIB_LIBRARY}
@ -621,24 +483,24 @@ target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY}
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
if (BUILD_ROUTED)
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
endif()
set(EXTRACTOR_LIBRARIES
${BZIP2_LIBRARIES}
${Boost_REGEX_LIBRARY}
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${EXPAT_LIBRARIES}
${USED_LUA_LIBRARIES}
${LUA_LIBRARIES}
${OSMIUM_LIBRARIES}
${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES}
${ZLIB_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
set(GUIDANCE_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES}
${LUA_LIBRARIES}
${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES})
set(PARTITIONER_LIBRARIES
@ -664,8 +526,7 @@ set(UPDATER_LIBRARIES
set(CONTRACTOR_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${USED_LUA_LIBRARIES}
${MAYBE_STXXL_LIBRARY}
${LUA_LIBRARIES}
${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES})
@ -685,7 +546,6 @@ set(STORAGE_LIBRARIES
set(UTIL_LIBRARIES
${BOOST_BASE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${MAYBE_STXXL_LIBRARY}
${TBB_LIBRARIES}
${MAYBE_COVERAGE_LIBRARIES}
${ZLIB_LIBRARY})
@ -707,7 +567,7 @@ install(TARGETS osrm-components DESTINATION bin)
if(BUILD_TOOLS)
message(STATUS "Activating OSRM internal tools")
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${TBB_LIBRARIES})
install(TARGETS osrm-io-benchmark DESTINATION bin)
endif()
@ -717,6 +577,11 @@ if (ENABLE_ASSERTIONS)
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
endif()
if (ENABLE_DEBUG_LOGGING)
message(STATUS "Enabling debug logging")
add_definitions(-DENABLE_DEBUG_LOGGING)
endif()
# Add RPATH info to executables so that when they are run after being installed
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
@ -724,11 +589,14 @@ set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-partition PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
if (BUILD_ROUTED)
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
file(GLOB FlatbuffersGlob third_party/flatbuffers/include/flatbuffers/*.h)
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)
@ -743,13 +611,16 @@ 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 ${VariantGlob} DESTINATION include/mapbox)
install(FILES ${ApiHeader} DESTINATION include/osrm/engine/api)
install(FILES ${FlatbuffersGlob} DESTINATION include/flatbuffers)
install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-partition DESTINATION bin)
install(TARGETS osrm-customize DESTINATION bin)
install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin)
if (BUILD_ROUTED)
install(TARGETS osrm-routed DESTINATION bin)
endif()
install(TARGETS osrm DESTINATION lib)
install(TARGETS osrm_extract DESTINATION lib)
install(TARGETS osrm_partition DESTINATION lib)
@ -757,12 +628,17 @@ 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
set(DefaultProfilesDir profiles)
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
# Install data geojson files to /usr/local/share/osrm/data by default
set(DefaultProfilesDir data)
install(DIRECTORY ${DefaultProfilesDir} DESTINATION share/osrm)
# Setup exporting variables for pkgconfig and subproject
#
@ -802,9 +678,26 @@ set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
# Boost uses imported targets, we need to use a generator expression to extract
# the link libraries to be written to the pkg-config file.
# Conan & TBB define dependencies as CMake targets too, that's why we do the same for them.
foreach(engine_lib ${ENGINE_LIBRARIES})
if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*" OR "${engine_lib}" MATCHES "^TBB.*")
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>")
else()
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}")
endif()
endforeach(engine_lib)
JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY)
file(GENERATE
OUTPUT
${PROJECT_BINARY_DIR}/libosrm.pc
INPUT
${PROJECT_BINARY_DIR}/pkgconfig.configured)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig)
# uninstall target
@ -821,10 +714,6 @@ add_custom_target(uninstall
add_subdirectory(unit_tests)
add_subdirectory(src/benchmarks)
if (ENABLE_GLIBC_WORKAROUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLIBC_WORKAROUND")
endif()
if (ENABLE_NODE_BINDINGS)
add_subdirectory(src/nodejs)
endif()
@ -844,22 +733,23 @@ if (ENABLE_FUZZING)
add_subdirectory(fuzz)
endif ()
# add headers sanity check target that includes all headers independently
# make sure we have all deps for the nodejs sub project's includes (nan, node)
if (ENABLE_NODE_BINDINGS)
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
file(GLOB_RECURSE headers_to_check
${PROJECT_BINARY_DIR}/*.hpp
${PROJECT_SOURCE_DIR}/include/*.hpp)
foreach(header ${headers_to_check})
get_filename_component(filename ${header} NAME_WE)
set(filename "${check_headers_dir}/${filename}.cpp")
if (NOT EXISTS ${filename})
file(WRITE ${filename} "#include \"${header}\"\n")
endif()
list(APPEND sources ${filename})
endforeach()
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
endif()
set(check_headers_dir "${PROJECT_BINARY_DIR}/check-headers")
file(GLOB_RECURSE headers_to_check
${PROJECT_BINARY_DIR}/*.hpp
${PROJECT_SOURCE_DIR}/include/*.hpp)
foreach(header ${headers_to_check})
if ("${header}" MATCHES ".*/include/nodejs/.*")
# we do not check NodeJS bindings headers
continue()
endif()
get_filename_component(filename ${header} NAME_WE)
set(filename "${check_headers_dir}/${filename}.cpp")
if (NOT EXISTS ${filename})
file(WRITE ${filename} "#include \"${header}\"\n")
endif()
list(APPEND sources ${filename})
endforeach()
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})

View File

@ -10,7 +10,7 @@ You can add a :+1: emoji reaction to the issue if you want to express interest i
# Developer
We use `clang-format` version `3.8` to consistently format the code base. There is a helper script under `scripts/format.sh`.
We use `clang-format` version `15` to consistently format the code base. There is a helper script under `scripts/format.sh`.
The format is automatically checked by the `mason-linux-release` job of a Travis CI build.
To save development time a local hook `.git/hooks/pre-push`
```

View File

@ -1,27 +1,26 @@
## Open Source Routing Machine
| Linux / macOS | Windows | Code Coverage |
| ------------- | ------- | ------------- |
| [![Travis](https://travis-ci.org/Project-OSRM/osrm-backend.png?branch=master)](https://travis-ci.org/Project-OSRM/osrm-backend) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/4iuo3s9gxprmcjjh)](https://ci.appveyor.com/project/DennisOSRM/osrm-backend) | [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) |
High performance routing engine written in C++14 designed to run on OpenStreetMap data.
[![osrm-backend CI](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml/badge.svg)](https://github.com/Project-OSRM/osrm-backend/actions/workflows/osrm-backend.yml) [![Codecov](https://codecov.io/gh/Project-OSRM/osrm-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/Project-OSRM/osrm-backend) [![Discord](https://img.shields.io/discord/1034487840219860992)](https://discord.gg/es9CdcCXcb)
High performance routing engine written in C++ designed to run on OpenStreetMap data.
The following services are available via HTTP API, C++ library interface and NodeJs wrapper:
- Nearest - Snaps coordinates to the street network and returns the nearest matches
- Route - Finds the fastest route between coordinates
- Table - Computes the duration of the fastest route between all pairs of supplied coordinates
- Table - Computes the duration or distances of the fastest route between all pairs of supplied coordinates
- Match - Snaps noisy GPS traces to the road network in the most plausible way
- Trip - Solves the Traveling Salesman Problem using a greedy heuristic
- Tile - Generates Mapbox Vector Tiles with internal routing metadata
To quickly try OSRM use our [demo server](http://map.project-osrm.org) which comes with both the backend and a frontend on top.
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [this guide about mapping for navigation](https://www.mapbox.com/mapping/mapping-for-navigation/).
For a quick introduction about how the road network is represented in OpenStreetMap and how to map specific road network features have a look at [the OSM wiki on routing](https://wiki.openstreetmap.org/wiki/Routing) or [this guide about mapping for navigation](https://web.archive.org/web/20221206013651/https://labs.mapbox.com/mapping/mapping-for-navigation/).
Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
- [osrm-frontend](https://github.com/Project-OSRM/osrm-frontend) - User-facing frontend with map. The demo server runs this on top of the backend
- [osrm-text-instructions](https://github.com/Project-OSRM/osrm-text-instructions) - Text instructions from OSRM route response
- [osrm-backend-docker](https://hub.docker.com/r/osrm/osrm-backend/) - Ready to use Docker images
- [osrm-backend-docker](https://github.com/project-osrm/osrm-backend/pkgs/container/osrm-backend) - Ready to use Docker images
## Documentation
@ -33,6 +32,7 @@ Related [Project-OSRM](https://github.com/Project-OSRM) repositories:
## Contact
- Discord: [join](https://discord.gg/es9CdcCXcb)
- IRC: `irc.oftc.net`, channel: `#osrm` ([Webchat](https://webchat.oftc.net))
- Mailinglist: `https://lists.openstreetmap.org/listinfo/osrm-talk`
@ -50,7 +50,7 @@ If you want to use the CH pipeline instead replace `osrm-partition` and `osrm-cu
### Using Docker
We base our Docker images ([backend](https://hub.docker.com/r/osrm/osrm-backend/), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Alpine Linux and make sure they are as lightweight as possible.
We base our Docker images ([backend](https://github.com/Project-OSRM/osrm-backend/pkgs/container/osrm-backend), [frontend](https://hub.docker.com/r/osrm/osrm-frontend/)) on Debian and make sure they are as lightweight as possible. Older backend versions can be found on [Docker Hub](https://hub.docker.com/r/osrm/osrm-backend/).
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/)
@ -58,16 +58,16 @@ Download OpenStreetMap extracts for example from [Geofabrik](http://download.geo
Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf || echo "osrm-extract failed"
The flag `-v $(pwd):/data` creates the directory `/data` inside the docker container and makes the current working directory `$(pwd)` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `$(pwd)/berlin-latest.osm.pbf` on the host.
The flag `-v "${PWD}:/data"` creates the directory `/data` inside the docker container and makes the current working directory `"${PWD}"` available there. The file `/data/berlin-latest.osm.pbf` inside the container is referring to `"${PWD}/berlin-latest.osm.pbf"` on the host.
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-partition /data/berlin-latest.osrm || echo "osrm-partition failed"
docker run -t -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-customize /data/berlin-latest.osrm || echo "osrm-customize failed"
Note that `berlin-latest.osrm` has a different file extension.
Note there is no `berlin-latest.osrm` file, but multiple `berlin-latest.osrm.*` files, i.e. `berlin-latest.osrm` is not file path, but "base" path referring to set of files and there is an option to omit this `.osrm` suffix completely(e.g. `osrm-partition /data/berlin-latest`).
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
docker run -t -i -p 5000:5000 -v "${PWD}:/data" ghcr.io/project-osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
Make requests against the HTTP server
@ -84,7 +84,7 @@ In case Docker complains about not being able to connect to the Docker daemon ma
After adding yourself to the `docker` group make sure to log out and back in again with your terminal.
We support the following images on Docker Cloud:
We support the following images in the Container Registry:
Name | Description
-----|------
@ -96,7 +96,7 @@ Name | Description
### Building from Source
The following targets Ubuntu 16.04.
The following targets Ubuntu 22.04.
For instructions how to build on different distributions, macOS or Windows see our [Wiki](https://github.com/Project-OSRM/osrm-backend/wiki).
Install dependencies
@ -132,16 +132,16 @@ curl "https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.38
The Node.js bindings provide read-only access to the routing engine.
We provide API documentation and examples [here](docs/nodejs/api.md).
You will need a modern `libstdc++` toolchain (`>= GLIBCXX_3.4.20`) for binary compatibility if you want to use the pre-built binaries.
You will need a modern `libstdc++` toolchain (`>= GLIBCXX_3.4.26`) for binary compatibility if you want to use the pre-built binaries.
For older Ubuntu systems you can upgrade your standard library for example with:
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update -y
sudo apt-get install -y libstdc++-5-dev
sudo apt-get install -y libstdc++-9-dev
```
You can install the Node.js bindings via `npm install osrm` or from this repository either via
You can install the Node.js bindings via `npm install @project-osrm/osrm` or from this repository either via
npm install
@ -151,7 +151,18 @@ which will check and use pre-built binaries if they're available for this releas
to always force building the Node.js bindings from source.
For usage details have a look [these API docs](docs/nodejs/api.md).
#### Unscoped packages
Prior to v5.27.0, the `osrm` Node package was unscoped. If you are upgrading from an old package, you will need to do the following:
```
npm uninstall osrm --save
npm install @project-osrm/osrm --save
```
#### Package docs
For usage details have a look [these API docs](docs/nodejs/api.md).
An exemplary implementation by a 3rd party with Docker and Node.js can be found [here](https://github.com/door2door-io/osrm-express-server-demo).

View File

@ -1,172 +0,0 @@
@ECHO OFF
SETLOCAL
SET EL=0
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET PROJECT_DIR=%CD%
ECHO PROJECT_DIR^: %PROJECT_DIR%
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
:: Check CMake version
SET CMAKE_VERSION=3.9.2
SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH%
ECHO cmake^: && cmake --version
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK
:CMAKE_NOT_OK
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
powershell Invoke-WebRequest https://cmake.org/files/v3.9/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
:CMAKE_OK
ECHO CMAKE_OK
cmake --version
ECHO activating VS command prompt ...
SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
ECHO platform^: %platform%
ECHO cl.exe version
cl
ECHO msbuild version
msbuild /version
:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive
SET DEPSPKG=osrm-deps-win-x64-14.0-2017.09.7z
:: local development
ECHO.
ECHO LOCAL_DEV^: %LOCAL_DEV%
IF NOT DEFINED LOCAL_DEV SET LOCAL_DEV=0
IF DEFINED LOCAL_DEV IF %LOCAL_DEV% EQU 1 IF EXIST %DEPSPKG% ECHO skipping deps download && GOTO SKIPDL
IF EXIST %DEPSPKG% DEL %DEPSPKG%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO downloading %DEPSPKG%
powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
:SKIPDL
IF EXIST osrm-deps ECHO deleting osrm-deps... && RD /S /Q osrm-deps
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST build ECHO deleting build dir... && RD /S /Q build
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
7z -y x %DEPSPKG% | %windir%\system32\FIND "ing archive"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
::tree osrm-deps
MKDIR build
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
cd build
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps
set PREFIX=%OSRMDEPSDIR%/libs
set BOOST_ROOT=%OSRMDEPSDIR%/boost
set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib
set TBB_INSTALL_DIR=%OSRMDEPSDIR%/tbb
set TBB_ARCH_PLATFORM=intel64/vc14
ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR%
ECHO PREFIX ^: %PREFIX%
ECHO BOOST_ROOT ^: %BOOST_ROOT%
ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR%
ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR%
ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM%
ECHO calling cmake ....
cmake .. ^
-G "Visual Studio 14 2015 Win64" ^
-DBOOST_ROOT=%BOOST_ROOT% ^
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
-DBoost_ADDITIONAL_VERSIONS=1.58 ^
-DBoost_USE_MULTITHREADED=ON ^
-DBoost_USE_STATIC_LIBS=ON ^
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DCMAKE_INSTALL_PREFIX=%PREFIX%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO building ...
msbuild OSRM.sln ^
/p:Configuration=%Configuration% ^
/p:Platform=x64 ^
/t:rebuild ^
/p:BuildInParallel=true ^
/m:%NUMBER_OF_PROCESSORS% ^
/toolsversion:14.0 ^
/p:PlatformToolset=v140 ^
/clp:Verbosity=normal ^
/nologo ^
/flp1:logfile=build_errors.txt;errorsonly ^
/flp2:logfile=build_warnings.txt;warningsonly
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CD %PROJECT_DIR%\build
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
ECHO running extractor-tests.exe ...
unit_tests\%Configuration%\extractor-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running engine-tests.exe ...
unit_tests\%Configuration%\engine-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running util-tests.exe ...
unit_tests\%Configuration%\util-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running server-tests.exe ...
unit_tests\%Configuration%\server-tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO running library-tests.exe ...
SET test_region=monaco
SET test_region_ch=ch\monaco
SET test_region_corech=corech\monaco
SET test_region_mld=mld\monaco
SET test_osm=%test_region%.osm.pbf
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm%
%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
MKDIR ch
XCOPY %test_region%.osrm.* ch\
XCOPY %test_region%.osrm ch\
MKDIR corech
XCOPY %test_region%.osrm.* corech\
XCOPY %test_region%.osrm corech\
MKDIR mld
XCOPY %test_region%.osrm.* mld\
XCOPY %test_region%.osrm mld\
%Configuration%\osrm-contract.exe %test_region_ch%.osrm
%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm
%Configuration%\osrm-partition.exe %test_region_mld%.osrm
%Configuration%\osrm-customize.exe %test_region_mld%.osrm
XCOPY /Y ch\*.* ..\test\data\ch\
XCOPY /Y corech\*.* ..\test\data\corech\
XCOPY /Y mld\*.* ..\test\data\mld\
unit_tests\%Configuration%\library-tests.exe
:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%
:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXIT /b %EL%

View File

@ -1,35 +0,0 @@
environment:
matrix:
- configuration: Release
# - configuration: Debug
install:
- ps: Install-Product node 6
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
os: Visual Studio 2015
# clone directory
clone_folder: c:\projects\osrm
platform: x64
build_script:
- CALL appveyor-build.bat
before_test:
- node --version
- npm --version
- npm install --ignore-scripts
- npm link --ignore-scripts
- SET PATH=%CD%\osrm-deps\libs\bin;%PATH%
- SET OSRM_BUILD_DIR=build\%Configuration%
- npm test
branches:
only:
- master

View File

@ -1,33 +0,0 @@
@ECHO OFF
SETLOCAL
SET EL=0
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET PLATFORM=x64
SET CONFIGURATION=Release
::SET LOCAL_DEV=1
FOR /F "tokens=*" %%i in ('git rev-parse --abbrev-ref HEAD') do SET APPVEYOR_REPO_BRANCH=%%i
ECHO APPVEYOR_REPO_BRANCH^: %APPVEYOR_REPO_BRANCH%
SET PATH=C:\mb\windows-builds-64\tmp-bin\cmake-3.7.0-rc2-win32-x86\bin;%PATH%
SET PATH=C:\Program Files\7-Zip;%PATH%
powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
CALL appveyor-build.bat
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE
:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%
:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXIT /b %EL%

View File

@ -1,75 +0,0 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "user for publishing to s3://mapbox-node-binary/osrm",
"Resources": {
"User": {
"Type": "AWS::IAM::User",
"Properties": {
"Policies": [
{
"PolicyName": "list",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary",
"Condition": {
"StringLike": {
"s3:prefix": [
"osrm/*"
]
}
}
}
]
}
},
{
"PolicyName": "publish",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::mapbox-node-binary/osrm/*"
}
]
}
}
]
}
},
"AccessKey": {
"Type": "AWS::IAM::AccessKey",
"Properties": {
"UserName": {
"Ref": "User"
}
}
}
},
"Outputs": {
"AccessKeyId": {
"Value": {
"Ref": "AccessKey"
}
},
"SecretAccessKey": {
"Value": {
"Fn::GetAtt": [
"AccessKey",
"SecretAccessKey"
]
}
}
}
}

View File

@ -1,59 +0,0 @@
var cf = require('@mapbox/cloudfriend');
var package_json = require('../package.json')
module.exports = {
AWSTemplateFormatVersion: '2010-09-09',
Description: 'user for publishing to s3://mapbox-node-binary/' + package_json.name,
Resources: {
User: {
Type: 'AWS::IAM::User',
Properties: {
Policies: [
{
PolicyName: 'list',
PolicyDocument: {
Statement: [
{
Action: ['s3:ListBucket'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary',
Condition : {
StringLike : {
"s3:prefix": [ package_json.name + "/*"]
}
}
}
]
}
},
{
PolicyName: 'publish',
PolicyDocument: {
Statement: [
{
Action: ['s3:DeleteObject', 's3:GetObject', 's3:GetObjectAcl', 's3:PutObject', 's3:PutObjectAcl'],
Effect: 'Allow',
Resource: 'arn:aws:s3:::mapbox-node-binary/' + package_json.name + '/*'
}
]
}
}
]
}
},
AccessKey: {
Type: 'AWS::IAM::AccessKey',
Properties: {
UserName: cf.ref('User')
}
}
},
Outputs: {
AccessKeyId: {
Value: cf.ref('AccessKey')
},
SecretAccessKey: {
Value: cf.getAtt('AccessKey', 'SecretAccessKey')
}
}
};

View File

@ -11,7 +11,7 @@ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "FALSE")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source Routing Machine (OSRM) is a high-performance routing engine. It combines sophisticated routing algorithms with the open and free data of the OpenStreetMap.")
SET(CPACK_PACKAGE_CONTACT "Project OSRM <info@project-osrm.org>")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENCE.TXT")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.TXT")
SET(CPACK_STRIP_FILES "TRUE")
file(GLOB_RECURSE ProfileGlob ${CMAKE_SOURCE_DIR}/profiles/*)

View File

@ -1,29 +0,0 @@
# - Check whether the CXX compiler supports a given flag.
# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
# <flag> - the compiler flag
# <var> - variable to store the result
# This internally calls the check_cxx_source_compiles macro. See help
# for CheckCXXSourceCompiles for a listing of variables that can
# modify the build.
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCXXSourceCompiles)
MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "unrecognized .*option" # GNU
FAIL_REGEX "ignoring unknown option" # MSVC
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_CXX_COMPILER_FLAG)

View File

@ -36,7 +36,10 @@
# This is because, the lua location is not standardized and may exist in
# locations other than lua/
include(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
include(CMakeFindDependencyMacro)
find_dependency(PkgConfig)
endif()
unset(_lua_include_subdirs)
unset(_lua_library_names)
@ -44,7 +47,7 @@ unset(_lua_append_versions)
# this is a function only to have all the variables inside go away automatically
function(_lua_set_version_vars)
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)
if (Lua_FIND_VERSION_EXACT)
if (Lua_FIND_VERSION_COUNT GREATER 1)

View File

@ -1,51 +0,0 @@
# Locate STXXL library
# This module defines
# STXXL_FOUND, if false, do not try to link to libstxxl
# STXXL_LIBRARY
# STXXL_INCLUDE_DIR, where to find stxxl.h
#
IF( NOT STXXL_FIND_QUIETLY )
MESSAGE(STATUS "Looking for STXXL...")
ENDIF()
FIND_PATH(STXXL_INCLUDE_DIR stxxl.h
HINTS
$ENV{STXXL_DIR}
PATH_SUFFIXES stxxl include/stxxl/stxxl include/stxxl include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/opt/local # DarwinPorts
/opt
)
FIND_LIBRARY(STXXL_LIBRARY
NAMES stxxl stxxl_debug
HINTS
$ENV{STXXL_DIR}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/opt/local
/opt
)
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set STXXL_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(STXXL DEFAULT_MSG STXXL_LIBRARY STXXL_INCLUDE_DIR)
IF( NOT STXXL_FIND_QUIETLY )
IF( STXXL_FOUND )
MESSAGE(STATUS "Found STXXL: ${STXXL_LIBRARY}" )
ENDIF()
ENDIF()
MARK_AS_ADVANCED(STXXL_INCLUDE_DIR STXXL_LIBRARY)

View File

@ -1,286 +1,456 @@
# Locate Intel Threading Building Blocks include paths and libraries
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
# The MIT License
# - Find ThreadingBuildingBlocks include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(TBB
# [REQUIRED] # Fail with error if TBB is not found
# ) #
# Once done, this will define
#
# Copyright (c) 2011 Hannes Hofmann
# TBB_FOUND - system has TBB
# TBB_INCLUDE_DIRS - the TBB include directories
# TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
# malloc proxy
# TBB::tbb - imported target for the TBB library
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# TBB_VERSION_MAJOR - Major Product Version Number
# TBB_VERSION_MINOR - Minor Product Version Number
# TBB_INTERFACE_VERSION - Engineering Focused Version Number
# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
# still supported. This uses the engineering
# focused interface version numbers.
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# TBB_MALLOC_FOUND - system has TBB malloc library
# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
# TBB::malloc - imported target for the TBB malloc library
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
# in the TBB installation directory (TBB_INSTALL_DIR).
# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
# TBB::malloc_proxy - imported target for the TBB malloc proxy library
#
# GvdB: Mac OS X distribution places libraries directly in lib directory.
#
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
# which architecture to use
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
# which compiler to use (detected automatically on Windows)
# This module respects
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
# This module defines
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
# TBB_INSTALL_DIR, the base TBB install directory
# TBB_LIBRARIES, the libraries to link against to use TBB.
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
# TBB_FOUND, If false, don't try to use TBB.
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
# This module reads hints about search locations from variables:
# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
# ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
# libraries. Should be specified with ENV TBB_ROOT
# and optionally...
# ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
#
#
# Modified by Robert Maynard from the original OGRE source
#
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
#
#=============================================================================
# Copyright 2010-2012 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if (WIN32)
# has em64t/vc8 em64t/vc9
# has ia32/vc7.1 ia32/vc8 ia32/vc9
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
if (MSVC71)
set (_TBB_COMPILER "vc7.1")
endif(MSVC71)
if (MSVC80)
set(_TBB_COMPILER "vc8")
endif(MSVC80)
if (MSVC90)
set(_TBB_COMPILER "vc9")
endif(MSVC90)
if(MSVC10)
set(_TBB_COMPILER "vc10")
endif(MSVC10)
# Todo: add other Windows compilers such as ICL.
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (WIN32)
#=============================================================================
# FindTBB helper functions and macros
#
if (UNIX)
if (APPLE)
# MAC
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# default flavor on apple: ia32/cc4.0.1_os10.4.9
# Jiri: There is no reason to presume there is only one flavor and
# that user's setting of variables should be ignored.
if(NOT TBB_COMPILER)
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
elseif (NOT TBB_COMPILER)
set(_TBB_COMPILER ${TBB_COMPILER})
endif(NOT TBB_COMPILER)
if(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE "ia32")
elseif(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif(NOT TBB_ARCHITECTURE)
else (APPLE)
# LINUX
set(_TBB_DEFAULT_INSTALL_DIR "/usr")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
# has ia32/*
# has itanium/*
set(_TBB_COMPILER ${TBB_COMPILER})
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (APPLE)
endif (UNIX)
if (CMAKE_SYSTEM MATCHES "SunOS.*")
# SUN
# not yet supported
# has em64t/cc3.4.3_kernel5.10
# has ia32/*
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
#-- Clear the public variables
set (TBB_FOUND "NO")
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
# first: use CMake variable TBB_INSTALL_DIR
if (TBB_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
endif (TBB_INSTALL_DIR)
# second: use environment variable
if (NOT _TBB_INSTALL_DIR)
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
# Intel recommends setting TBB21_INSTALL_DIR
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
endif (NOT _TBB_INSTALL_DIR)
# third: try to find path automatically
if (NOT _TBB_INSTALL_DIR)
if (_TBB_DEFAULT_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
endif (_TBB_DEFAULT_INSTALL_DIR)
endif (NOT _TBB_INSTALL_DIR)
# sanity check
if (NOT _TBB_INSTALL_DIR)
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
else (NOT _TBB_INSTALL_DIR)
# finally: set the cached CMake variable TBB_INSTALL_DIR
if (NOT TBB_INSTALL_DIR)
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
mark_as_advanced(TBB_INSTALL_DIR)
endif (NOT TBB_INSTALL_DIR)
#-- A macro to rewrite the paths of the library. This is necessary, because
# find_library() always found the em64t/vc9 version of the TBB libs
macro(TBB_CORRECT_LIB_DIR var_name)
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
endmacro(TBB_CORRECT_LIB_DIR var_content)
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
# Jiri: tbbvars now sets the CPATH environment variable to the directory
# containing the headers.
find_path(TBB_INCLUDE_DIR
tbb/task_scheduler_init.h
HINTS ${TBB_INC_SEARCH_DIR} ENV CPATH
)
mark_as_advanced(TBB_INCLUDE_DIR)
#-- Look for libraries
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
set (_TBB_LIBRARY_DIR
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
)
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
# Jiri: This block isn't mutually exclusive with the previous one
# (hence no else), instead I test if the user really specified
# the variables in question.
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# HH: deprecated
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
# Jiri: It doesn't hurt to look in more places, so I store the hints from
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
# variables and search them both.
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# GvdB: Mac OS X distribution places libraries directly in lib directory.
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
if(EXISTS ${_TBB_INSTALL_DIR}/build)
file(GLOB _TBB_BUILD_DIR_RELEASE ${_TBB_INSTALL_DIR}/build/*_release)
file(GLOB _TBB_BUILD_DIR_DEBUG ${_TBB_INSTALL_DIR}/build/*_debug)
endif()
# Jiri: No reason not to check the default paths. From recent versions,
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
# variables, which now point to the directories of the lib files.
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
# argument instead of the implicit PATHS as it isn't hard-coded
# but computed by system introspection. Searching the LIBRARY_PATH
# and LD_LIBRARY_PATH environment variables is now even more important
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
# the use of TBB built from sources.
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_BUILD_DIR_RELEASE} ${_TBB_LIBRARY_DIR})
#Extract path from TBB_LIBRARY name
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
#-- Look for debug libraries
# Jiri: Changed the same way as for the release libraries.
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_BUILD_DIR_DEBUG} ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
# Extract path from TBB_LIBRARY_DEBUG name
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
if (TBB_INCLUDE_DIR)
if (TBB_LIBRARY)
set (TBB_FOUND "YES")
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
message(STATUS "Found Intel TBB")
endif (TBB_LIBRARY)
endif (TBB_INCLUDE_DIR)
if (NOT TBB_FOUND)
message("ERROR: Intel TBB NOT found!")
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
# do only throw fatal, if this pkg is REQUIRED
if (TBB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find TBB library.")
endif (TBB_FIND_REQUIRED)
endif (NOT TBB_FOUND)
endif (NOT _TBB_INSTALL_DIR)
# Use TBBConfig.cmake if possible.
set(_tbb_find_quiet)
if (TBB_FIND_QUIETLY)
set(_tbb_find_quiet QUIET)
endif ()
set(_tbb_find_components)
set(_tbb_find_optional_components)
foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS)
if (TBB_FIND_REQUIRED_${_tbb_find_component})
list(APPEND _tbb_find_components "${_tbb_find_component}")
else ()
list(APPEND _tbb_find_optional_components "${_tbb_find_component}")
endif ()
endforeach ()
unset(_tbb_find_component)
find_package(TBB CONFIG ${_tbb_find_quiet}
COMPONENTS ${_tbb_find_components}
OPTIONAL_COMPONENTS ${_tbb_find_optional_components})
unset(_tbb_find_quiet)
unset(_tbb_find_components)
unset(_tbb_find_optional_components)
if (TBB_FOUND)
set(TBB_INTERFACE_VERSION 0)
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
message(STATUS "TBB interface version: ${TBB_INTERFACE_VERSION}")
endif (TBB_FOUND)
return ()
endif ()
#====================================================
# Fix the library path in case it is a linker script
#====================================================
function(tbb_extract_real_library library real_library)
if(NOT UNIX OR NOT EXISTS ${library})
set(${real_library} "${library}" PARENT_SCOPE)
return()
endif()
#Read in the first 4 bytes and see if they are the ELF magic number
set(_elf_magic "7f454c46")
file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
if(_hex_data STREQUAL _elf_magic)
#we have opened a elf binary so this is what
#we should link to
set(${real_library} "${library}" PARENT_SCOPE)
return()
endif()
file(READ ${library} _data OFFSET 0 LIMIT 1024)
if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
#extract out the .so name from REGEX MATCH command
set(_proper_so_name "${CMAKE_MATCH_1}")
#construct path to the real .so which is presumed to be in the same directory
#as the input file
get_filename_component(_so_dir "${library}" DIRECTORY)
set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
else()
#unable to determine what this library is so just hope everything works
#and pass it unmodified.
set(${real_library} "${library}" PARENT_SCOPE)
endif()
endfunction()
#===============================================
# Do the final processing for the package find.
#===============================================
macro(findpkg_finish PREFIX TARGET_NAME)
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
set(${PREFIX}_FOUND TRUE)
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
else ()
if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
message(FATAL_ERROR "Required library ${PREFIX} not found.")
endif ()
endif ()
if (NOT TARGET "TBB::${TARGET_NAME}")
if (${PREFIX}_LIBRARY_RELEASE)
tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
endif ()
if (${PREFIX}_LIBRARY_DEBUG)
tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
endif ()
add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
IMPORTED_LOCATION "${real_release}"
IMPORTED_LOCATION_DEBUG "${real_debug}"
IMPORTED_LOCATION_RELEASE "${real_release}")
elseif (${PREFIX}_LIBRARY_RELEASE)
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
IMPORTED_LOCATION "${real_release}")
elseif (${PREFIX}_LIBRARY_DEBUG)
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
IMPORTED_LOCATION "${real_debug}")
endif ()
endif ()
#mark the following variables as internal variables
mark_as_advanced(${PREFIX}_INCLUDE_DIR
${PREFIX}_LIBRARY
${PREFIX}_LIBRARY_DEBUG
${PREFIX}_LIBRARY_RELEASE)
endmacro()
#===============================================
# Generate debug names from given release names
#===============================================
macro(get_debug_names PREFIX)
foreach(i ${${PREFIX}})
set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
endforeach()
endmacro()
#===============================================
# See if we have env vars to help us find tbb
#===============================================
macro(getenv_path VAR)
set(ENV_${VAR} $ENV{${VAR}})
# replace won't work if var is blank
if (ENV_${VAR})
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
endif ()
endmacro()
#===============================================
# Couple a set of release AND debug libraries
#===============================================
macro(make_library_set PREFIX)
if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
elseif (${PREFIX}_RELEASE)
set(${PREFIX} ${${PREFIX}_RELEASE})
elseif (${PREFIX}_DEBUG)
set(${PREFIX} ${${PREFIX}_DEBUG})
endif ()
endmacro()
#=============================================================================
# Now to actually find TBB
#
# Get path, convert backslashes as ${ENV_${var}}
getenv_path(TBB_ROOT)
# initialize search paths
set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
set(TBB_INC_SEARCH_PATH "")
set(TBB_LIB_SEARCH_PATH "")
# If user built from sources
set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
getenv_path(TBB_BUILD_DIR)
if (NOT ENV_TBB_BUILD_DIR)
set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
endif ()
# include directory under ${ENV_TBB_ROOT}/include
list(APPEND TBB_LIB_SEARCH_PATH
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
endif ()
# For Windows, let's assume that the user might be using the precompiled
# TBB packages from the main website. These use a rather awkward directory
# structure (at least for automatically finding the right files) depending
# on platform and compiler, but we'll do our best to accommodate it.
# Not adding the same effort for the precompiled linux builds, though. Those
# have different versions for CC compiler versions and linux kernels which
# will never adequately match the user's setup, so there is no feasible way
# to detect the "best" version to use. The user will have to manually
# select the right files. (Chances are the distributions are shipping their
# custom version of tbb, anyway, so the problem is probably nonexistent.)
if (WIN32 AND MSVC)
set(COMPILER_PREFIX "vc7.1")
if (MSVC_VERSION EQUAL 1400)
set(COMPILER_PREFIX "vc8")
elseif(MSVC_VERSION EQUAL 1500)
set(COMPILER_PREFIX "vc9")
elseif(MSVC_VERSION EQUAL 1600)
set(COMPILER_PREFIX "vc10")
elseif(MSVC_VERSION EQUAL 1700)
set(COMPILER_PREFIX "vc11")
elseif(MSVC_VERSION EQUAL 1800)
set(COMPILER_PREFIX "vc12")
elseif(MSVC_VERSION GREATER_EQUAL 1900)
set(COMPILER_PREFIX "vc14")
endif ()
# for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
foreach (dir IN LISTS TBB_PREFIX_PATH)
if (CMAKE_CL_64)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
else ()
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
endif ()
endforeach ()
endif ()
# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
# and above and AppleClang
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
set (USE_LIBCXX OFF)
cmake_policy(GET CMP0025 POLICY_VAR)
if (POLICY_VAR STREQUAL "NEW")
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set (USE_LIBCXX ON)
endif ()
else ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (USE_LIBCXX ON)
endif ()
endif ()
if (USE_LIBCXX)
foreach (dir IN LISTS TBB_PREFIX_PATH)
list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
endforeach ()
endif ()
endif ()
# check compiler ABI
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(COMPILER_PREFIX)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
list(APPEND COMPILER_PREFIX "gcc4.8")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
list(APPEND COMPILER_PREFIX "gcc4.7")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
list(APPEND COMPILER_PREFIX "gcc4.4")
endif()
list(APPEND COMPILER_PREFIX "gcc4.1")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(COMPILER_PREFIX)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
list(APPEND COMPILER_PREFIX "gcc4.8")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
list(APPEND COMPILER_PREFIX "gcc4.7")
endif()
list(APPEND COMPILER_PREFIX "gcc4.4")
else() # Assume compatibility with 4.4 for other compilers
list(APPEND COMPILER_PREFIX "gcc4.4")
endif ()
# if platform architecture is explicitly specified
set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
if (TBB_ARCH_PLATFORM)
foreach (dir IN LISTS TBB_PREFIX_PATH)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
endforeach ()
endif ()
foreach (dir IN LISTS TBB_PREFIX_PATH)
foreach (prefix IN LISTS COMPILER_PREFIX)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
else ()
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
endif ()
endforeach()
endforeach ()
# add general search paths
foreach (dir IN LISTS TBB_PREFIX_PATH)
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
${dir}/Libs)
list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
${dir}/include/tbb)
endforeach ()
set(TBB_LIBRARY_NAMES tbb)
get_debug_names(TBB_LIBRARY_NAMES)
find_path(TBB_INCLUDE_DIR
NAMES tbb/tbb.h
PATHS ${TBB_INC_SEARCH_PATH})
find_library(TBB_LIBRARY_RELEASE
NAMES ${TBB_LIBRARY_NAMES}
PATHS ${TBB_LIB_SEARCH_PATH})
find_library(TBB_LIBRARY_DEBUG
NAMES ${TBB_LIBRARY_NAMES_DEBUG}
PATHS ${TBB_LIB_SEARCH_PATH})
make_library_set(TBB_LIBRARY)
findpkg_finish(TBB tbb)
#if we haven't found TBB no point on going any further
if (NOT TBB_FOUND)
return()
endif ()
#=============================================================================
# Look for TBB's malloc package
set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
find_path(TBB_MALLOC_INCLUDE_DIR
NAMES tbb/tbb.h
PATHS ${TBB_INC_SEARCH_PATH})
find_library(TBB_MALLOC_LIBRARY_RELEASE
NAMES ${TBB_MALLOC_LIBRARY_NAMES}
PATHS ${TBB_LIB_SEARCH_PATH})
find_library(TBB_MALLOC_LIBRARY_DEBUG
NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG}
PATHS ${TBB_LIB_SEARCH_PATH})
make_library_set(TBB_MALLOC_LIBRARY)
findpkg_finish(TBB_MALLOC tbbmalloc)
#=============================================================================
# Look for TBB's malloc proxy package
set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
NAMES tbb/tbbmalloc_proxy.h
PATHS ${TBB_INC_SEARCH_PATH})
find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE
NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES}
PATHS ${TBB_LIB_SEARCH_PATH})
find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG
NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG}
PATHS ${TBB_LIB_SEARCH_PATH})
make_library_set(TBB_MALLOC_PROXY_LIBRARY)
findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
#=============================================================================
#parse all the version numbers from tbb
if(NOT TBB_VERSION)
if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
file(STRINGS
"${TBB_INCLUDE_DIR}/oneapi/tbb/version.h"
TBB_VERSION_CONTENTS
REGEX "VERSION")
else()
#only read the start of the file
file(STRINGS
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
TBB_VERSION_CONTENTS
REGEX "VERSION")
endif()
string(REGEX REPLACE
".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
string(REGEX REPLACE
".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
string(REGEX REPLACE
".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
string(REGEX REPLACE
".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
endif()

View File

@ -1,7 +1,7 @@
# https://github.com/sbellus/json-cmake/blob/9913da8800b95322d393894d3525d634568f305e/JSONParser.cmake
# MIT Licensed - https://github.com/sbellus/json-cmake/blob/master/LICENSE
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.18)
if (DEFINED JSonParserGuard)
return()

1026
cmake/conan.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,215 +0,0 @@
# Mason CMake
include(CMakeParseArguments)
function(mason_detect_platform)
# Determine platform
if(NOT MASON_PLATFORM)
# we call uname -s manually here since
# CMAKE_HOST_SYSTEM_NAME will not be defined before the project() call
execute_process(
COMMAND uname -s
OUTPUT_VARIABLE UNAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (UNAME STREQUAL "Darwin")
set(MASON_PLATFORM "osx" PARENT_SCOPE)
else()
set(MASON_PLATFORM "linux" PARENT_SCOPE)
endif()
endif()
# Determine platform version string
if(NOT MASON_PLATFORM_VERSION)
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE MASON_PLATFORM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(MASON_PLATFORM_VERSION "${MASON_PLATFORM_VERSION}" PARENT_SCOPE)
endif()
endfunction()
function(mason_use _PACKAGE)
if(NOT _PACKAGE)
message(FATAL_ERROR "[Mason] No package name given")
endif()
cmake_parse_arguments("" "HEADER_ONLY" "VERSION" "" ${ARGN})
if(_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "[Mason] mason_use() called with unrecognized arguments: ${_UNPARSED_ARGUMENTS}")
endif()
if(NOT _VERSION)
message(FATAL_ERROR "[Mason] Specifying a version is required")
endif()
if(MASON_PACKAGE_${_PACKAGE}_INVOCATION STREQUAL "${MASON_INVOCATION}")
# Check that the previous invocation of mason_use didn't select another version of this package
if(NOT MASON_PACKAGE_${_PACKAGE}_VERSION STREQUAL ${_VERSION})
message(FATAL_ERROR "[Mason] Already using ${_PACKAGE} ${MASON_PACKAGE_${_PACKAGE}_VERSION}. Cannot select version ${_VERSION}.")
endif()
else()
if(_HEADER_ONLY)
set(_PLATFORM_ID "headers")
else()
set(_PLATFORM_ID "${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}")
endif()
set(_SLUG "${_PLATFORM_ID}/${_PACKAGE}/${_VERSION}")
set(_INSTALL_PATH "${MASON_PACKAGE_DIR}/${_SLUG}")
file(RELATIVE_PATH _INSTALL_PATH_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${_INSTALL_PATH}")
if(NOT EXISTS "${_INSTALL_PATH}")
set(_CACHE_PATH "${MASON_PACKAGE_DIR}/.binaries/${_SLUG}.tar.gz")
if (NOT EXISTS "${_CACHE_PATH}")
# Download the package
set(_URL "${MASON_REPOSITORY}/${_SLUG}.tar.gz")
message("[Mason] Downloading package ${_URL}...")
set(_FAILED)
set(_ERROR)
# Note: some CMake versions are compiled without SSL support
get_filename_component(_CACHE_DIR "${_CACHE_PATH}" DIRECTORY)
file(MAKE_DIRECTORY "${_CACHE_DIR}")
execute_process(
COMMAND curl --retry 3 -s -f -S -L "${_URL}" -o "${_CACHE_PATH}.tmp"
RESULT_VARIABLE _FAILED
ERROR_VARIABLE _ERROR)
if(_FAILED)
message(FATAL_ERROR "[Mason] Failed to download ${_URL}: ${_ERROR}")
else()
# We downloaded to a temporary file to prevent half-finished downloads
file(RENAME "${_CACHE_PATH}.tmp" "${_CACHE_PATH}")
endif()
endif()
# Unpack the package
message("[Mason] Unpacking package to ${_INSTALL_PATH_RELATIVE}...")
file(MAKE_DIRECTORY "${_INSTALL_PATH}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${_CACHE_PATH}"
WORKING_DIRECTORY "${_INSTALL_PATH}")
endif()
# Error out if there is no config file.
if(NOT EXISTS "${_INSTALL_PATH}/mason.ini")
message(FATAL_ERROR "[Mason] Could not find mason.ini for package ${_PACKAGE} ${_VERSION}")
endif()
set(MASON_PACKAGE_${_PACKAGE}_PREFIX "${_INSTALL_PATH}" CACHE STRING "${_PACKAGE} ${_INSTALL_PATH}" FORCE)
mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_PREFIX)
# Load the configuration from the ini file
file(STRINGS "${_INSTALL_PATH}/mason.ini" _CONFIG_FILE)
foreach(_LINE IN LISTS _CONFIG_FILE)
string(REGEX MATCH "^([a-z_]+) *= *" _KEY "${_LINE}")
if (_KEY)
string(LENGTH "${_KEY}" _KEY_LENGTH)
string(SUBSTRING "${_LINE}" ${_KEY_LENGTH} -1 _VALUE)
string(REGEX REPLACE ";.*$" "" _VALUE "${_VALUE}") # Trim trailing commas
string(REPLACE "{prefix}" "${_INSTALL_PATH}" _VALUE "${_VALUE}")
string(STRIP "${_VALUE}" _VALUE)
string(REPLACE "=" "" _KEY "${_KEY}")
string(STRIP "${_KEY}" _KEY)
string(TOUPPER "${_KEY}" _KEY)
if(_KEY STREQUAL "INCLUDE_DIRS" OR _KEY STREQUAL "STATIC_LIBS" )
separate_arguments(_VALUE)
endif()
set(MASON_PACKAGE_${_PACKAGE}_${_KEY} "${_VALUE}" CACHE STRING "${_PACKAGE} ${_KEY}" FORCE)
mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_${_KEY})
endif()
endforeach()
# Compare version in the package to catch errors early on
if(NOT _VERSION STREQUAL MASON_PACKAGE_${_PACKAGE}_VERSION)
message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has version '${MASON_PACKAGE_${_PACKAGE}_VERSION}', but required '${_VERSION}'")
endif()
if(NOT _PACKAGE STREQUAL MASON_PACKAGE_${_PACKAGE}_NAME)
message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has name '${MASON_PACKAGE_${_PACKAGE}_NAME}', but required '${_NAME}'")
endif()
if(NOT _HEADER_ONLY)
if(NOT MASON_PLATFORM STREQUAL MASON_PACKAGE_${_PACKAGE}_PLATFORM)
message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has platform '${MASON_PACKAGE_${_PACKAGE}_PLATFORM}', but required '${MASON_PLATFORM}'")
endif()
if(NOT MASON_PLATFORM_VERSION STREQUAL MASON_PACKAGE_${_PACKAGE}_PLATFORM_VERSION)
message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has platform version '${MASON_PACKAGE_${_PACKAGE}_PLATFORM_VERSION}', but required '${MASON_PLATFORM_VERSION}'")
endif()
endif()
# Concatenate the static libs and libraries
set(_LIBRARIES)
list(APPEND _LIBRARIES ${MASON_PACKAGE_${_PACKAGE}_STATIC_LIBS} ${MASON_PACKAGE_${_PACKAGE}_LDFLAGS})
set(MASON_PACKAGE_${_PACKAGE}_LIBRARIES "${_LIBRARIES}" CACHE STRING "${_PACKAGE} _LIBRARIES" FORCE)
mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_LIBRARIES)
if(NOT _HEADER_ONLY)
string(REGEX MATCHALL "(^| +)-L *([^ ]+)" MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LDFLAGS}")
string(REGEX REPLACE "(^| +)-L *" "\\1" MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}")
set(MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}" CACHE STRING "${_PACKAGE} ${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}" FORCE)
mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS)
endif()
# Store invocation ID to prevent different versions of the same package in one invocation
set(MASON_PACKAGE_${_PACKAGE}_INVOCATION "${MASON_INVOCATION}" CACHE INTERNAL "${_PACKAGE} invocation ID" FORCE)
endif()
endfunction()
macro(target_add_mason_package _TARGET _VISIBILITY _PACKAGE)
if (NOT MASON_PACKAGE_${_PACKAGE}_INVOCATION)
message(FATAL_ERROR "[Mason] Package ${_PACKAGE} has not been initialized yet")
endif()
target_include_directories(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_INCLUDE_DIRS}")
target_compile_definitions(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_DEFINITIONS}")
target_compile_options(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_OPTIONS}")
target_link_libraries(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_LIBRARIES}")
endmacro()
# Setup
string(RANDOM LENGTH 16 MASON_INVOCATION)
# Read environment variables if CMake is run in command mode
if (CMAKE_ARGC)
set(MASON_PLATFORM "$ENV{MASON_PLATFORM}")
set(MASON_PLATFORM_VERSION "$ENV{MASON_PLATFORM_VERSION}")
set(MASON_PACKAGE_DIR "$ENV{MASON_PACKAGE_DIR}")
set(MASON_REPOSITORY "$ENV{MASON_REPOSITORY}")
endif()
# Directory where Mason packages are located; typically ends with mason_packages
if (NOT MASON_PACKAGE_DIR)
set(MASON_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/mason_packages")
endif()
# URL prefix of where packages are located.
if (NOT MASON_REPOSITORY)
set(MASON_REPOSITORY "https://mason-binaries.s3.amazonaws.com")
endif()
mason_detect_platform()
# Execute commands if CMake is run in command mode
if (CMAKE_ARGC)
# Collect remaining arguments for passing to mason_use
set(_MASON_ARGS)
if (${CMAKE_ARGC} LESS 5)
message(FATAL_ERROR "Usage: mason.sh [install|prefix] PACKAGE VERSION")
endif()
if (${CMAKE_ARGV3} STREQUAL "install")
# Install the package
mason_use(${CMAKE_ARGV4} VERSION ${CMAKE_ARGV5})
elseif (${CMAKE_ARGV3} STREQUAL "prefix")
set(PKG_PREFIX "${MASON_PACKAGE_DIR}/${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}/${CMAKE_ARGV4}/${CMAKE_ARGV5}")
# CMake can't write to stdout with message()
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${PKG_PREFIX}")
else()
message(FATAL_ERROR "Usage: mason.sh [install|prefix] PACKAGE VERSION")
endif()
endif()

88
cmake/warnings.cmake Normal file
View File

@ -0,0 +1,88 @@
include (CheckCXXCompilerFlag)
include (CheckCCompilerFlag)
# Try to add -Wflag if compiler supports it
macro (add_warning flag)
string(REPLACE "-" "_" underscored_flag ${flag})
string(REPLACE "+" "x" underscored_flag ${underscored_flag})
check_cxx_compiler_flag("-W${flag}" SUPPORTS_CXXFLAG_${underscored_flag})
check_c_compiler_flag("-W${flag}" SUPPORTS_CFLAG_${underscored_flag})
if (SUPPORTS_CXXFLAG_${underscored_flag})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${flag}")
else()
message (STATUS "Flag -W${flag} is unsupported")
endif()
if (SUPPORTS_CFLAG_${underscored_flag})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W${flag}")
else()
message(STATUS "Flag -W${flag} is unsupported")
endif()
endmacro()
# Try to add -Wno flag if compiler supports it
macro (no_warning flag)
add_warning(no-${flag})
endmacro ()
# The same but only for specified target.
macro (target_add_warning target flag)
string (REPLACE "-" "_" underscored_flag ${flag})
string (REPLACE "+" "x" underscored_flag ${underscored_flag})
check_cxx_compiler_flag("-W${flag}" SUPPORTS_CXXFLAG_${underscored_flag})
if (SUPPORTS_CXXFLAG_${underscored_flag})
target_compile_options (${target} PRIVATE "-W${flag}")
else ()
message (STATUS "Flag -W${flag} is unsupported")
endif ()
endmacro ()
macro (target_no_warning target flag)
target_add_warning(${target} no-${flag})
endmacro ()
add_warning(all)
add_warning(extra)
add_warning(pedantic)
add_warning(error) # treat all warnings as errors
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_warning(strict-overflow=1)
endif()
add_warning(suggest-override)
add_warning(suggest-destructor-override)
add_warning(unused)
add_warning(unreachable-code)
add_warning(delete-incomplete)
add_warning(duplicated-cond)
add_warning(disabled-optimization)
add_warning(init-self)
add_warning(bool-compare)
add_warning(logical-not-parentheses)
add_warning(logical-op)
add_warning(misleading-indentation)
# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it)
add_warning(no-return-local-addr)
add_warning(odr)
add_warning(pointer-arith)
add_warning(redundant-decls)
add_warning(reorder)
add_warning(shift-negative-value)
add_warning(sizeof-array-argument)
add_warning(switch-bool)
add_warning(tautological-compare)
add_warning(trampolines)
# these warnings are not enabled by default
# no_warning(name-of-warning)
no_warning(deprecated-comma-subscript)
no_warning(comma-subscript)
no_warning(ambiguous-reversed-operator)
no_warning(restrict)
no_warning(free-nonheap-object)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
no_warning(stringop-overflow)
endif()

View File

@ -1,7 +1,7 @@
module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo --tags ~@mld-only -f progress --require features/support --require features/step_definitions',
default: '--strict --tags ~@stress --tags ~@todo --tags ~@mld --require features/support --require features/step_definitions',
ch: '--strict --tags ~@stress --tags ~@todo --tags ~@mld -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions -f progress'
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@ch --require features/support --require features/step_definitions -f progress'
};

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +0,0 @@
FROM alpine:3.6 as buildstage
ARG DOCKER_TAG
RUN mkdir -p /src && mkdir -p /opt
COPY . /src
WORKDIR /src
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add git cmake wget make libc-dev gcc g++ bzip2-dev boost-dev zlib-dev expat-dev lua5.2-dev libtbb@testing libtbb-dev@testing && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
\
strip /usr/local/bin/* && \
rm -rf /src /usr/local/lib/libosrm*
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM alpine:3.6 as runstage
RUN mkdir -p /src && mkdir -p /opt
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk add boost-filesystem boost-program_options boost-regex boost-iostreams boost-thread libgomp lua5.2 expat libtbb@testing
COPY --from=buildstage /usr/local /usr/local
COPY --from=buildstage /opt /opt
WORKDIR /opt
EXPOSE 5000

1
docker/Dockerfile Symbolic link
View File

@ -0,0 +1 @@
Dockerfile-debian

79
docker/Dockerfile-alpine Normal file
View File

@ -0,0 +1,79 @@
FROM alpine:3.21.2 AS alpine-mimalloc
RUN apk update && \
apk upgrade && \
apk add --no-cache \
boost-iostreams \
boost-program_options \
boost-thread \
mimalloc
ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2
ENV MIMALLOC_LARGE_OS_PAGES=1
FROM alpine-mimalloc AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src /opt && \
apk add --no-cache \
boost-dev \
boost-filesystem \
clang \
cmake \
expat-dev \
git \
libbz2 \
libxml2 \
lua5.4-dev \
make \
onetbb-dev
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=OFF && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
strip /usr/local/bin/* && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM alpine-mimalloc AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apk add --no-cache \
boost-date_time \
expat \
lua5.4 \
onetbb && \
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
WORKDIR /opt
EXPOSE 5000

76
docker/Dockerfile-debian Normal file
View File

@ -0,0 +1,76 @@
FROM debian:bookworm-slim AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src /opt && \
apt-get update && \
apt-get -y --no-install-recommends --no-install-suggests install \
ca-certificates \
cmake \
g++ \
gcc \
git \
libboost1.81-all-dev \
libbz2-dev \
liblua5.4-dev \
libtbb-dev \
libxml2-dev \
libzip-dev \
lua5.4 \
make \
pkg-config
COPY . /src
WORKDIR /src
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
export CXXFLAGS="-Wno-array-bounds -Wno-uninitialized -Wno-stringop-overflow" && \
echo "Building OSRM ${DOCKER_TAG}" && \
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
mkdir -p build && \
cd build && \
BUILD_TYPE="Release" && \
ENABLE_ASSERTIONS="Off" && \
BUILD_TOOLS="Off" && \
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
make -j${NPROC} install && \
cd ../profiles && \
cp -r * /opt && \
strip /usr/local/bin/* && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:bookworm-slim AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
expat \
libboost-date-time1.81.0 \
libboost-iostreams1.81.0 \
libboost-program-options1.81.0 \
libboost-thread1.81.0 \
liblua5.4-0 \
libtbb12 && \
rm -rf /var/lib/apt/lists/* && \
# Add /usr/local/lib to ldconfig to allow loading libraries from there
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
/usr/local/bin/osrm-routed --help && \
/usr/local/bin/osrm-contract --help && \
/usr/local/bin/osrm-partition --help && \
/usr/local/bin/osrm-customize --help
WORKDIR /opt
EXPOSE 5000

6
docker/hooks/build Normal file → Executable file
View File

@ -6,4 +6,8 @@
# ensure that "COPY . /src" is referring to the repo root, not the directory
# that contains the Dockerfile.
# This script gets executed with a pwd of wherever the Dockerfile is.
docker build --build-arg DOCKER_TAG=${DOCKER_TAG} -t $IMAGE_NAME -f Dockerfile ..
DOCKER_BUILD="docker build --build-arg BUILD_CONCURRENCY=${CONCURRENCY} --build-arg DOCKER_TAG=${DOCKER_TAG:?unset} -t ${IMAGE_NAME:?unset} -f"
$DOCKER_BUILD Dockerfile ..
$DOCKER_BUILD Dockerfile-alpine ..

View File

@ -32,9 +32,9 @@ For outputting data into our file (debug.geojson), we simply need to call the ma
### Possible Scopeguard Location
Think of the scopeguard as you would do of any reference. If you wan't to access to logging during a call, the guard object must be alive and valid.
As an example: a good location to create the a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
As an example: a good location to create a scopeguard to log decisions in the edge-based-graph-factory would be right before we run it ([here](https://github.com/Project-OSRM/osrm-backend/blob/a933b5d94943bf3edaf42c84a614a99650d23cba/src/extractor/extractor.cpp#L497)). If you put `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString> geojson_guard( "debug.geojson", node_coordinate_vector);` at that location, you can then print `util::ScopedGeojsonLoggerGuard<util::NodeIdVectorToLineString>::Write(list_of_node_ids);` anywhere within the `edge-based-graph-factory`.
This location would enable call for all guidance related pre-processing which is called in the edge-based-graph-factory.
This location would enable calls for all guidance related pre-processing which is called in the edge-based-graph-factory.
Logging any turn-handler decisions, for example, would now be possible.
## Limitations

View File

@ -1,3 +1,8 @@
# OSRM HTTP server
The built-in HTTP server is a basic HTTP/1.0 server that supports a 'keep-alive' extension. Persistent connections are limited to 512 requests per
connection and allow no more than 5 seconds between requests.
## General options
All OSRM HTTP requests use a common structure.
@ -16,22 +21,24 @@ GET /{service}/{version}/{profile}/{coordinates}[.{format}]?option=value&option=
| `version` | Version of the protocol implemented by the service. `v1` for all OSRM 5.x installations |
| `profile` | Mode of transportation, is determined statically by the Lua profile that is used to prepare the data using `osrm-extract`. Typically `car`, `bike` or `foot` if using one of the supplied profiles. |
| `coordinates`| String of format `{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]` or `polyline({polyline}) or polyline6({polyline6})`. |
| `format`| Only `json` is supported at the moment. This parameter is optional and defaults to `json`. |
| `format`| `json` or `flatbuffers`. This parameter is optional and defaults to `json`. |
Passing any `option=value` is optional. `polyline` follows Google's polyline format with precision 5 by default and can be generated using [this package](https://www.npmjs.com/package/polyline).
To pass parameters to each location some options support an array like encoding:
To pass parameters to each location some options support an array-like encoding:
**Request options**
| Option | Values | Description |
|----------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in clockwise direction. |
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|approaches |`{approach};{approach}[;{approach} ...]` |Keep waypoints on curb side. |
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, order does not matter. |
| Option | Values | Description |
|----------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|bearings |`{bearing};{bearing}[;{bearing} ...]` |Limits the search to segments with given bearing in degrees towards true north in a clockwise direction. |
|radiuses |`{radius};{radius}[;{radius} ...]` |Limits the search to given radius in meters. |
|generate\_hints |`true` (default), `false` |Adds a Hint to the response which can be used in subsequent requests, see `hints` parameter. |
|hints |`{hint};{hint}[;{hint} ...]` |Hint from previous request to derive position in street network. |
|approaches |`{approach};{approach}[;{approach} ...]` |Restrict the direction on the road network at a waypoint, relative to the input coordinate. |
|exclude |`{class}[,{class}]` |Additive list of classes to avoid, the order does not matter. |
|snapping |`default` (default), `any` |Default snapping avoids is_startpoint (see profile) edges, `any` will snap to any edge in the graph |
|skip_waypoints |`true`, `false` (default) |Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of the response and do not want to transfer waste data. |
Where the elements follow the following format:
@ -40,7 +47,7 @@ Where the elements follow the following format:
|bearing |`{value},{range}` `integer 0 .. 360,integer 0 .. 180` |
|radius |`double >= 0` or `unlimited` (default) |
|hint |Base64 `string` |
|approach |`curb` or `unrestricted` (default) |
|approach |`curb`, `opposite` or `unrestricted` (default) |
|class |A class name determined by the profile or `none`. |
```
@ -49,7 +56,7 @@ Where the elements follow the following format:
The number of elements must match exactly the number of locations (except for `generate_hints` and `exclude`). If you don't want to pass a value but instead use the default you can pass an empty `element`.
Example: 2nd location use the default value for `option`:
Example: 2nd location uses the default value for `option`:
```
{option}={element};;{element}
@ -70,6 +77,8 @@ curl 'http://router.project-osrm.org/route/v1/driving/polyline(ofp_Ik_vpAilAyu@t
### Responses
#### Code
Every response object has a `code` property containing one of the strings below or a service dependent code:
| Type | Description |
@ -79,20 +88,26 @@ Every response object has a `code` property containing one of the strings below
| `InvalidService` | Service name is invalid. |
| `InvalidVersion` | Version is not found. |
| `InvalidOptions` | Options are invalid. |
| `InvalidQuery` | The query string is synctactically malformed. |
| `InvalidQuery` | The query string is syntactically malformed. |
| `InvalidValue` | The successfully parsed query parameters are invalid. |
| `NoSegment` | One of the supplied input coordinates could not snap to street segment. |
| `TooBig` | The request size violates one of the service specific request size restrictions. |
| `NoSegment` | One of the supplied input coordinates could not snap to the street segment. |
| `TooBig` | The request size violates one of the service-specific request size restrictions. |
| `DisabledDataset` | The request tried to access a disabled dataset. |
- `message` is a **optional** human-readable error message. All other status types are service dependent.
- In case of an error the HTTP status code will be `400`. Otherwise the HTTP status code will be `200` and `code` will be `Ok`.
- `message` is a **optional** human-readable error message. All other status types are service-dependent.
- In case of an error the HTTP status code will be `400`. Otherwise, the HTTP status code will be `200` and `code` will be `Ok`.
#### Data version
Every response object has a `data_version` property containing a timestamp from the original OpenStreetMap file. This field is optional. It can be omitted if the data_version parameter was not set on the osrm-extract stage or the OSM file has not `osmosis_replication_timestamp` section.
#### Example response
```json
{
"code": "Ok",
"message": "Everything worked"
"message": "Everything worked",
"data_version": "2017-11-17T21:43:02Z"
}
```
@ -115,11 +130,13 @@ In addition to the [general options](#general-options) the following options are
|------------|------------------------------|----------------------------------------------------|
|number |`integer >= 1` (default `1`) |Number of nearest segments that should be returned. |
As `waypoints` is a single thing, returned by that service, using it with the option `skip_waypoints` set to `true` is quite useless, but still
possible. In that case, only the `code` field will be returned.
**Response**
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `waypoints` array of `Waypoint` objects sorted by distance to the input coordinate. Each object has at least the following additional properties:
- `distance`: Distance in meters to the supplied input coordinate.
- `nodes`: Array of OpenStreetMap node ids.
#### Example Requests
@ -131,7 +148,7 @@ curl 'http://router.project-osrm.org/nearest/v1/driving/13.388860,52.517037?numb
#### Example Response
```json
```JSON
{
"waypoints" : [
{
@ -195,7 +212,8 @@ In addition to the [general options](#general-options) the following options are
|annotations |`true`, `false` (default), `nodes`, `distance`, `duration`, `datasources`, `weight`, `speed` |Returns additional metadata for each coordinate along the route geometry. |
|geometries |`polyline` (default), `polyline6`, `geojson` |Returned route geometry format (influences overview and per step) |
|overview |`simplified` (default), `full`, `false` |Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all.|
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
|continue\_straight |`default` (default), `true`, `false` |Forces the route to keep going straight at waypoints constraining uturns there even if it would be faster. Default value depends on the profile. |
|waypoints | `{index};{index};{index}...` |Treats input coordinates indicated by given indices as waypoints in returned Match object. Default is to treat all input coordinates as waypoints. |
\* Please note that even if alternative routes are requested, a result cannot be guaranteed.
@ -222,13 +240,13 @@ curl 'http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397
### Table service
Computes the duration of the fastest route between all pairs of supplied coordinates.
Computes the duration of the fastest route between all pairs of supplied coordinates. Returns durations or distances or both between the coordinate pairs. Note that the distances are not the shortest distance between two coordinates, but rather the distances of the fastest routes. Durations are in seconds and distances are in meters.
```endpoint
GET /table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&destinations=[{elem}...]
GET /table/v1/{profile}/{coordinates}?{sources}=[{elem}...];&{destinations}=[{elem}...]&annotations={duration|distance|duration,distance}
```
**Coordinates**
**Options**
In addition to the [general options](#general-options) the following options are supported for this service:
@ -236,10 +254,16 @@ In addition to the [general options](#general-options) the following options are
|------------|--------------------------------------------------|---------------------------------------------|
|sources |`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as source. |
|destinations|`{index};{index}[;{index} ...]` or `all` (default)|Use location with given index as destination.|
|annotations |`duration` (default), `distance`, or `duration,distance`|Return the requested table or tables in response. |
|fallback_speed|`double > 0`| If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration.|
|fallback_coordinate|`input` (default), or `snapped`| When using a `fallback_speed`, use the user-supplied coordinate (`input`), or the snapped location (`snapped`) for calculating distances.|
|scale_factor|`double > 0`| Use in conjunction with `annotations=durations`. Scales the table `duration` values by this number.|
Unlike other array encoded options, the length of `sources` and `destinations` can be **smaller or equal**
to number of input locations;
With `skip_waypoints` set to `true`, both `sources` and `destinations` arrays will be skipped.
**Example:**
```
@ -253,36 +277,148 @@ sources=0;5;7&destinations=5;1;4;2;3;6
#### Example Request
```curl
# Returns a 3x3 matrix:
# Returns a 3x3 duration matrix:
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219'
# Returns a 1x3 matrix
# Returns a 1x3 duration matrix
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?sources=0'
# Returns a asymmetric 3x2 matrix with from the polyline encoded locations `qikdcB}~dpXkkHz`:
# Returns a asymmetric 3x2 duration matrix with from the polyline encoded locations `qikdcB}~dpXkkHz`:
curl 'http://router.project-osrm.org/table/v1/driving/polyline(egs_Iq_aqAppHzbHulFzeMe`EuvKpnCglA)?sources=0;1;3&destinations=2;4'
# Returns a 3x3 duration matrix:
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=duration'
# Returns a 3x3 distance matrix for CH:
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distance'
# Returns a 3x3 duration matrix and a 3x3 distance matrix for CH:
curl 'http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distance,duration'
```
**Response**
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `durations` array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from
the i-th waypoint to the j-th waypoint. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found.
the i-th source to the j-th destination. Values are given in seconds. Can be `null` if no route between `i` and `j` can be found.
- `distances` array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel distance from
the i-th source to the j-th destination. Values are given in meters. Can be `null` if no route between `i` and `j` can be found.
- `sources` array of `Waypoint` objects describing all sources in order
- `destinations` array of `Waypoint` objects describing all destinations in order
- `fallback_speed_cells` (optional) array of arrays containing `i,j` pairs indicating which cells contain estimated values based on `fallback_speed`. Will be absent if `fallback_speed` is not used.
In case of error the following `code`s are supported in addition to the general ones:
| Type | Description |
|-------------------|-----------------|
| Type | Description |
|------------------|-----------------|
| `NoTable` | No route found. |
| `NotImplemented` | This request is not supported |
All other properties might be undefined.
#### Example Response
```json
{
"sources": [
{
"location": [
13.3888,
52.517033
],
"hint": "PAMAgEVJAoAUAAAAIAAAAAcAAAAAAAAArss0Qa7LNEHiVIRA4lSEQAoAAAAQAAAABAAAAAAAAADMAAAAAEzMAKlYIQM8TMwArVghAwEA3wps52D3",
"name": "Friedrichstraße"
},
{
"location": [
13.397631,
52.529432
],
"hint": "WIQBgL6mAoAEAAAABgAAAAAAAAA7AAAAhU6PQHvHj0IAAAAAQbyYQgQAAAAGAAAAAAAAADsAAADMAAAAf27MABiJIQOCbswA_4ghAwAAXwVs52D3",
"name": "Torstraße"
},
{
"location": [
13.428554,
52.523239
],
"hint": "7UcAgP___38fAAAAUQAAACYAAABTAAAAhSQKQrXq5kKRbiZCWJo_Qx8AAABRAAAAJgAAAFMAAADMAAAASufMAOdwIQNL58wA03AhAwMAvxBs52D3",
"name": "Platz der Vereinten Nationen"
}
],
"durations": [
[
0,
192.6,
382.8
],
[
199,
0,
283.9
],
[
344.7,
222.3,
0
]
],
"destinations": [
{
"location": [
13.3888,
52.517033
],
"hint": "PAMAgEVJAoAUAAAAIAAAAAcAAAAAAAAArss0Qa7LNEHiVIRA4lSEQAoAAAAQAAAABAAAAAAAAADMAAAAAEzMAKlYIQM8TMwArVghAwEA3wps52D3",
"name": "Friedrichstraße"
},
{
"location": [
13.397631,
52.529432
],
"hint": "WIQBgL6mAoAEAAAABgAAAAAAAAA7AAAAhU6PQHvHj0IAAAAAQbyYQgQAAAAGAAAAAAAAADsAAADMAAAAf27MABiJIQOCbswA_4ghAwAAXwVs52D3",
"name": "Torstraße"
},
{
"location": [
13.428554,
52.523239
],
"hint": "7UcAgP___38fAAAAUQAAACYAAABTAAAAhSQKQrXq5kKRbiZCWJo_Qx8AAABRAAAAJgAAAFMAAADMAAAASufMAOdwIQNL58wA03AhAwMAvxBs52D3",
"name": "Platz der Vereinten Nationen"
}
],
"code": "Ok",
"distances": [
[
0,
1886.89,
3791.3
],
[
1824,
0,
2838.09
],
[
3275.36,
2361.73,
0
]
],
"fallback_speed_cells": [
[ 0, 1 ],
[ 1, 0 ]
]
}
```
### Match service
Map matching matches/snaps given GPS points to the road network in the most plausible way.
Please note the request might result multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found.
Please note the request might result in multiple sub-traces. Large jumps in the timestamps (> 60s) or improbable transitions lead to trace splits if a complete matching could not be found.
The algorithm might not be able to match all points. Outliers are removed if they can not be matched successfully.
```endpoint
@ -317,11 +453,11 @@ The area to search is chosen such that the correct candidate should be considere
- `code` if the request was successful `Ok` otherwise see the service dependent and general status codes.
- `tracepoints`: Array of `Waypoint` objects representing all points of the trace in order.
If the trace point was ommited by map matching because it is an outlier, the entry will be `null`.
If the tracepoint was omitted by map matching because it is an outlier, the entry will be `null`.
Each `Waypoint` object has the following additional properties:
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
- `waypoint_index`: Index of the waypoint inside the matched route.
- `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching.
- `alternatives_count`: Number of probable alternative matchings for this tracepoint. A value of zero indicates that this point was matched unambiguously. Split the trace at these points for incremental map matching.
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.
@ -336,7 +472,7 @@ All other properties might be undefined.
### Trip service
The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm) for 10 or more waypoints and uses brute force for less than 10 waypoints.
The returned path does not have to be the fastest path. As TSP is NP-hard it only returns an approximation.
The returned path does not have to be the fastest one. As TSP is NP-hard it only returns an approximation.
Note that all input coordinates have to be connected for the trip service to work.
```endpoint
@ -357,12 +493,12 @@ In addition to the [general options](#general-options) the following options are
**Fixing Start and End Points**
It is possible to explicitely set the start or end coordinate of the trip.
When source is set to `first`, the first coordinate is used as start coordinate of the trip in the output. When destination is set to `last`, the last coordinate will be used as destination of the trip in the returned output. If you specify `any`, any of the coordinates can be used as the first or last coordinate in the output.
It is possible to explicitly set the start or end coordinate of the trip.
When the source is set to `first`, the first coordinate is used as the start coordinate of the trip in the output. When the destination is set to `last`, the last coordinate will be used as the destination of the trip in the returned output. If you specify `any`, any of the coordinates can be used as the first or last coordinate in the output.
However, if `source=any&destination=any` the returned round-trip will still start at the first input coordinate by default.
Currently, not all combinations of `roundtrip`, `source` and `destination` are supported.
Currently, not all combinations of `roundtrip`, `source`, and `destination` are supported.
Right now, the following combinations are possible:
| roundtrip | source | destination | supported |
@ -372,8 +508,8 @@ Right now, the following combinations are possible:
| true | any | last | **yes** |
| true | any | any | **yes** |
| false | first | last | **yes** |
| false | first | any | no |
| false | any | last | no |
| false | first | any | **yes** |
| false | any | last | **yes** |
| false | any | any | no |
#### Example Requests
@ -441,7 +577,8 @@ Vector tiles contain two layers:
| `duration` | `float` | how long this segment takes to traverse, in seconds. This value is to calculate the total route ETA. |
| `weight ` | `integer` | how long this segment takes to traverse, in units (may differ from `duration` when artificial biasing is applied in the Lua profiles). ACTUAL ROUTING USES THIS VALUE. |
| `name` | `string` | the name of the road this segment belongs to |
| `rate` | `float` | the value of `length/weight` - analagous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
| `rate` | `float` | the value of `length/weight` - analogous to `speed`, but using the `weight` value rather than `duration`, rounded to the nearest integer |
| `is_startpoint` | `boolean` | whether this segment can be used as a start/endpoint for routes |
`turns` layer:
@ -465,13 +602,13 @@ Represents a route through (potentially multiple) waypoints.
- `distance`: The distance traveled by the route, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` property for a parameter documentation.
- `geometry`: The whole geometry of the route value depending on `overview` parameter, format depending on the `geometries` parameter. See `RouteStep`'s `geometry` property for the parameter documentation.
- `weight`: The calculated weight of the route.
- `weight_name`: The name of the weight profile used during extraction phase.
- `weight_name`: The name of the weight profile used during the extraction phase.
| overview | Description |
|------------|-----------------------------|
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed on full. |
| simplified | Geometry is simplified according to the highest zoom level it can still be displayed in full. |
| full | Geometry is not simplified. |
| false | Geometry is not added. |
@ -512,12 +649,12 @@ Represents a route between two waypoints.
- `distance`: The distance traveled by this route leg, in `float` meters.
- `duration`: The estimated travel time, in `float` number of seconds.
- `weight`: The calculated weight of the route leg.
- `summary`: Summary of the route taken as `string`. Depends on the `summary` parameter:
- `summary`: Summary of the route taken as `string`. Depends on the `steps` parameter:
| summary | |
|--------------|-----------------------------------------------------------------------|
| true | Names of the two major roads used. Can be empty if route is too short.|
| false | empty `string` |
| steps | |
|-------|-----------------------------------------------------------------------|
| true | Names of the two major roads used. Can be empty if the route is too short.|
| false | empty `string` |
- `steps`: Depends on the `steps` parameter.
@ -526,11 +663,11 @@ Represents a route between two waypoints.
| true | array of `RouteStep` objects describing the turn-by-turn instructions |
| false | empty array |
- `annotation`: Additional details about each coordinate along the route geometry:
- `annotation`: Additional details about each coordinate along with the route geometry:
| annotations | |
|--------------|-------------------------------------------------------------------------------|
| true | An `Annotation` object containing node ids, durations, distances and weights. |
| true | An `Annotation` object containing node ids, durations, distances, and weights. |
| false | `undefined` |
#### Example
@ -560,14 +697,14 @@ Annotation of the whole route leg with fine-grained information about each segme
**Properties**
- `distance`: The distance, in metres, between each pair of coordinates
- `distance`: The distance, in meters, between each pair of coordinates
- `duration`: The duration between each pair of coordinates, in seconds. Does not include the duration of any turns.
- `datasources`: The index of the datasource for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`. String-like names are in the `metadata.datasource_names` array.
- `datasources`: The index of the data source for the speed between each pair of coordinates. `0` is the default profile, other values are supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`. String-like names are in the `metadata.datasource_names` array.
- `nodes`: The OSM node ID for each coordinate along the route, excluding the first/last user-supplied coordinates
- `weight`: The weights between each pair of coordinates. Does not include any turn costs.
- `speed`: Convenience field, calculation of `distance / duration` rounded to one decimal place
- `metadata`: Metadata related to other annotations
- `datasource_names`: The names of the datasources used for the speed between each pair of coordinates. `lua profile` is the default profile, other values arethe filenames supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`
- `datasource_names`: The names of the data sources used for the speed between each pair of coordinates. `lua profile` is the default profile, other values are the filenames supplied via `--segment-speed-file` to `osrm-contract` or `osrm-customize`
#### Example
@ -626,8 +763,8 @@ step.
{ "bearings" : [ 10, 92, 184, 270 ],
"lanes" : [
{ "indications" : [ "left", "straight" ],
"valid" : "false" },
{ "valid" : "true",
"valid" : false },
{ "valid" : true,
"indications" : [ "right" ] }
],
"out" : 2,
@ -638,9 +775,9 @@ step.
{ "out" : 1,
"lanes" : [
{ "indications" : [ "straight" ],
"valid" : "true" },
"valid" : true },
{ "indications" : [ "right" ],
"valid" : "false" }
"valid" : false }
],
"bearings" : [ 60, 240, 330 ],
"in" : 0,
@ -667,11 +804,11 @@ step.
- `bearing_after`: The clockwise angle from true north to the
direction of travel immediately after the maneuver. Range 0-359.
- `type` A string indicating the type of maneuver. **new identifiers might be introduced without API change**
Types unknown to the client should be handled like the `turn` type, the existence of correct `modifier` values is guranteed.
Types unknown to the client should be handled like the `turn` type, the existence of correct `modifier` values is guaranteed.
| `type` | Description |
|------------------|--------------------------------------------------------------|
| `turn` | a basic turn into direction of the `modifier` |
| `turn` | a basic turn into the direction of the `modifier` |
| `new name` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
| `depart` | indicates the departure of the leg |
| `arrive` | indicates the destination of the leg |
@ -685,9 +822,9 @@ step.
| `continue` | Turn in direction of `modifier` to stay on the same road |
| `roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
| `rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as normal turn. The `modifier` indicates the turn direciton. Example instruction: `At the roundabout turn left`. |
| `roundabout turn`| Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
| `notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
| `exit roundabout`| Describes a maneuver exiting a roundabout (usually preceeded by a `roundabout` instruction) |
| `exit roundabout`| Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
| `exit rotary` | Describes the maneuver exiting a rotary (large named roundabout) |
Please note that even though there are `new name` and `notification` instructions, the `mode` and `name` can change
@ -697,7 +834,7 @@ step.
| `modifier` | Description |
|-------------------|-------------------------------------------|
| `uturn` | indicates reversal of direction |
| `uturn` | indicates the reversal of direction |
| `sharp right` | a sharp right turn |
| `right` | a normal turn to the right |
| `slight right` | a slight turn to the right |
@ -715,8 +852,8 @@ step.
| `turn` | `modifier` indicates the change in direction accomplished through the turn |
| `depart`/`arrive` | `modifier` indicates the position of departure point and arrival point in relation to the current direction of travel |
- `exit` An optional `integer` indicating number of the exit to take. The property exists for the `roundabout` / `rotary` property:
Number of the roundabout exit to take. If exit is `undefined` the destination is on the roundabout.
- `exit` An optional `integer` indicating the number of the exit to take. The property exists for the `roundabout` / `rotary` property:
Number of the roundabout exit to take. If an exit is `undefined` the destination is on the roundabout.
New properties (potentially depending on `type`) may be introduced in the future without an API version change.
@ -727,7 +864,7 @@ A `Lane` represents a turn lane at the corresponding turn location.
**Properties**
- `indications`: a indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications are given in an array, each containing one of the following types. Further indications might be added on without an API version change.
- `indications`: an indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left). The indications are given in an array, each containing one of the following types. Further indications might be added on without an API version change.
| `value` | Description |
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
@ -748,13 +885,13 @@ A `Lane` represents a turn lane at the corresponding turn location.
```json
{
"indications": ["left", "straight"],
"valid": "false"
"valid": false
}
```
### Intersection object
An intersection gives a full representation of any cross-way the path passes bay. For every step, the very first intersection (`intersections[0]`) corresponds to the
An intersection gives a full representation of any cross-way the path passes by. For every step, the very first intersection (`intersections[0]`) corresponds to the
location of the StepManeuver. Further intersections are listed for every cross-way until the next turn instruction.
**Properties**
@ -783,21 +920,22 @@ location of the StepManeuver. Further intersections are listed for every cross-w
"classes": ["toll", "restricted"],
"lanes":{
"indications": ["left", "straight"],
"valid": "false"
"valid": false
}
}
```
### Waypoint object
Object used to describe waypoint on a route.
The object is used to describe the waypoint on a route.
**Properties**
- `name` Name of the street the coordinate snapped to
- `location` Array that contains the `[longitude, latitude]` pair of the snapped coordinate
- `distance` The distance, in meters, from the input coordinate to the snapped coordinate
- `hint` Unique internal identifier of the segment (ephemeral, not constant over data updates)
This can be used on subsequent request to significantly speed up the query and to connect multiple services.
This can be used on subsequent requests to significantly speed up the query and to connect multiple services.
E.g. you can use the `hint` value obtained by the `nearest` query as `hint` values for `route` inputs.
#### Example
@ -813,3 +951,175 @@ Object used to describe waypoint on a route.
]
}
```
## Flatbuffers format
The default response format is `json`, but OSRM supports binary [`flatbuffers`](https://google.github.io/flatbuffers/) format, which
is much faster in serialization/deserialization, comparing to `json`.
The format itself is described in message descriptors, located at `include/engine/api/flatbuffers` directory. Those descriptors could
be compiled to provide protocol parsers in Go/Javascript/Typescript/Java/Dart/C#/Python/Lobster/Lua/Rust/PHP/Kotlin. Precompiled
protocol parser for C++ is supplied with OSRM.
`Flatbuffers` format provides exactly the same data, as `json` format with a slightly different layout, which was optimized to minimize
in-transfer size.
### Root object
Root object is the only object, available from a 'raw' `flatbuffers` buffer. It can be constructed with a following call:
auto osrm = osrm::engine::api::fbresult::GetFBResult(some_input_buffer);
**Properties**
- `error`: `bool` Marks response as erroneous. An erroneous response should include the `code` fieldset, all the other fields may not be present.
- `code`: `Error` Error description object, only present, when `error` is `true`
- `waypoints`: `[Waypoint]` Array of `Waypoint` objects. Should present for every service call, unless `skip_waypoints` is set to `true`. Table service will put `sources` array here.
- `routes`: `[RouteObject]` Array of `RouteObject` objects. May be empty or absent. Should present for Route/Trip/Match services call.
- `table`: `Table` Table object, may absent. Should be present in case of Table service call.
### Error object
Contains error information.
**Properties**
- `code`: `string` Error code
- `message`: `string` Detailed error message
### Waypoint object
Almost the same as `json` Waypoint object. The following properties differ:
- `location`: `Position` Same as `json` location field, but different format.
- `nodes`: `Uint64Pair` Same as `json` nodes field, but different format.
### RouteObject object
Almost the same as `json` Route object. The following properties differ:
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
- `legs`: `[Leg]` Array of `Leg` objects.
### Leg object
Almost the same as `json` Leg object. The following properties differ:
- `annotations`: `Annotation` Same as `json` annotation field, but different format.
- `steps`: `[Step]` Same as `step` annotation field, but different format.
### Step object
Almost the same as `json` Step object. The following properties differ:
- `polyline`: `string` Same as `json` geometry.polyline or geometry.polyline6 fields. One field for both formats.
- `coordinates`: `[Position]` Same as `json` geometry.coordinates field, but different format.
- `maneuver`: `StepManeuver` Same as `json` maneuver field, but different format.
| `type` | Description |
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Turn` | a basic turn into the direction of the `modifier` |
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
| `Depart` | indicates the departure of the leg |
| `Arrive` | indicates the destination of the leg |
| `Merge` | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
| `OnRamp` | take a ramp to enter a highway (direction given my `modifier`) |
| `OffRamp` | take a ramp to exit a highway (direction given my `modifier`) |
| `Fork` | take the left/right side at a fork depending on `modifier` |
| `EndOfRoad` | road ends in a T intersection turn in direction of `modifier` |
| `Continue` | Turn in direction of `modifier` to stay on the same road |
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
| `Rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
| `RoundaboutTurn` | Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
- `driving_side`: `bool` Ttrue stands for the left side driving.
- `intersections`: `[Intersection]` Same as `json` intersections field, but different format.
### Intersection object
Almost the same as `json` Intersection object. The following properties differ:
- `location`: `Position` Same as `json` location property, but in a different format.
- `lanes`: `[Lane]` Array of `Lane` objects.
### Lane object
Almost the same as `json` Lane object. The following properties differ:
- `indications`: `Turn` Array of `Turn` enum values.
| `value` | Description |
|------------------------|---------------------------------------------------------------------------------------------------------------------------|
| `None` | No dedicated indication is shown. |
| `UTurn` | An indication signaling the possibility to reverse (i.e. fully bend arrow). |
| `SharpRight` | An indication indicating a sharp right turn (i.e. strongly bend arrow). |
| `Right` | An indication indicating a right turn (i.e. bend arrow). |
| `SlightRight` | An indication indicating a slight right turn (i.e. slightly bend arrow). |
| `Straight` | No dedicated indication is shown (i.e. straight arrow). |
| `SlightLeft` | An indication indicating a slight left turn (i.e. slightly bend arrow). |
| `Left` | An indication indicating a left turn (i.e. bend arrow). |
| `SharpLeft` | An indication indicating a sharp left turn (i.e. strongly bend arrow). |
### StepManeuver object
Almost the same as `json` StepManeuver object. The following properties differ:
- `location`: `Position` Same as `json` location property, but in a different format.
- `type`: `ManeuverType` Type of a maneuver (enum)
| `type` | Description |
|------------------|--------------------------------------------------------------|
| `Turn` | a basic turn into the direction of the `modifier` |
| `NewName` | no turn is taken/possible, but the road name changes. The road can take a turn itself, following `modifier`. |
| `Depart` | indicates the departure of the leg |
| `Arrive` | indicates the destination of the leg |
| `Merge` | merge onto a street (e.g. getting on the highway from a ramp, the `modifier specifies the direction of the merge`) |
| `OnRamp` | take a ramp to enter a highway (direction given my `modifier`) |
| `OffRamp` | take a ramp to exit a highway (direction given my `modifier`) |
| `Fork` | take the left/right side at a fork depending on `modifier` |
| `EndOfRoad` | road ends in a T intersection turn in direction of `modifier`|
| `Continue` | Turn in direction of `modifier` to stay on the same road |
| `Roundabout` | traverse roundabout, if the route leaves the roundabout there will be an additional property `exit` for exit counting. The modifier specifies the direction of entering the roundabout. |
| `Rotary` | a traffic circle. While very similar to a larger version of a roundabout, it does not necessarily follow roundabout rules for right of way. It can offer `rotary_name` and/or `rotary_pronunciation` parameters (located in the RouteStep object) in addition to the `exit` parameter (located on the StepManeuver object). |
| `RoundaboutTurn` | Describes a turn at a small roundabout that should be treated as a normal turn. The `modifier` indicates the turn direction. Example instruction: `At the roundabout turn left`. |
| `Notification` | not an actual turn but a change in the driving conditions. For example the travel mode or classes. If the road takes a turn itself, the `modifier` describes the direction |
| `ExitRoundabout` | Describes a maneuver exiting a roundabout (usually preceded by a `roundabout` instruction) |
| `ExitRotary` | Describes the maneuver exiting a rotary (large named roundabout) |
- `modifier`: `Turn` Maneuver turn (enum)
### Annotation object
Exactly the same as `json` annotation object.
### Position object
A point on Earth.
***Properties***
- `longitute`: `float` Point's longitude
- `latitude`: `float` Point's latitude
### Uint64Pair
A pair of long long integers. Used only by `Waypoint` object.
***Properties***
- `first`: `uint64` First pair value.
- `second`: `uint64` Second pair value.
### Table object
Almost the same as `json` Table object. The main difference is that 'sources' field is absent and the root's object 'waypoints' field is
used instead. All the other differences follow:
- `durations`: `[float]` Flat representation of a durations matrix. Element at row;col can be addressed as [row * cols + col]
- `distances`: `[float]` Flat representation of a destinations matrix. Element at row;col can be addressed as [row * cols + col]
- `destinations`: `[Waypoint]` Array of `Waypoint` objects. Will be `null` if `skip_waypoints` will be set to `true`
- `rows`: `ushort` Number of rows in durations/destinations matrices.
- `cols`: `ushort` Number of cols in durations/destinations matrices.

View File

@ -3,8 +3,8 @@
## OSRM
The `OSRM` method is the main constructor for creating an OSRM instance.
An OSRM instance requires a `.osrm` dataset, which is prepared by the OSRM toolchain.
You can create such a `.osrm` file by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
An OSRM instance requires a `.osrm.*` dataset(`.osrm.*` because it contains several files), which is prepared by the OSRM toolchain.
You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`:
node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
@ -12,7 +12,7 @@ profiles (e.g. for setting speeds and determining road types to route on) in `no
Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation for further details.
Once you have a complete `network.osrm` file, you can calculate routes in javascript with this object.
Once you have a complete `network.osrm.*` dataset, you can calculate routes in javascript with this object.
```javascript
var osrm = new OSRM('network.osrm');
@ -20,19 +20,26 @@ var osrm = new OSRM('network.osrm');
**Parameters**
- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
- `options.algorithm` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
- `options` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Options for creating an OSRM object or string to the `.osrm` file. (optional, default `{shared_memory:true}`)
- `options.algorithm` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The algorithm to use for routing. Can be 'CH', or 'MLD'. Default is 'CH'.
Make sure you prepared the dataset with the correct toolchain.
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
- `options.shared_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Connects to the persistent shared memory datastore.
This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
- `options.memory_file` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Path to a file on disk to store the memory using mmap.
- `options.path` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited).
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
- `options.max_alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max.number of alternatives supported in alternative routes query (default: 3).
- `options.dataset_name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Connects to the persistent shared memory datastore defined by `--dataset_name` option when running `osrm-datastore`.
This requires you to run `osrm-datastore --dataset_name` prior to creating an `OSRM` object.
- `options.memory_file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** **DEPRECATED**
Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
- `options.mmap_memory` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
- `options.path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
- `options.disable_feature_dataset` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Disables a feature dataset from being loaded into memory if not needed. Options: `ROUTE_STEPS`, `ROUTE_GEOMETRY`.
- `options.max_locations_trip` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in trip query (default: unlimited).
- `options.max_locations_viaroute` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in viaroute query (default: unlimited).
- `options.max_locations_distance_table` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in distance table query (default: unlimited).
- `options.max_locations_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. locations supported in map-matching query (default: unlimited).
- `options.max_radius_map_matching` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. radius size supported in map matching query (default: 5).
- `options.max_results_nearest` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. results supported in nearest query (default: unlimited).
- `options.max_alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Max. number of alternatives supported in alternative routes query (default: 3).
- `options.default_radius` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Default radius for queries (default: unlimited).
### route
@ -40,36 +47,42 @@ Returns the fastest route between two or more coordinates while visiting the way
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the route query.
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.alternatives` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
- `options.alternatives` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
- `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.exclude` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** List of classes to avoid, order does not matter.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.alternatives` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search for alternative routes. (optional, default `false`)
- `options.alternatives` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search for up to this many alternative routes.
_Please note that even if alternative routes are requested, a result cannot be guaranteed._ (optional, default `0`)
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route leg. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.continue_straight` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
`null`/`true`/`false`
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `options.skip_waypoints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of response and do not want to transfer waste data. (optional, default `false`)
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
```javascript
var osrm = new OSRM("berlin-latest.osrm");
osrm.route({coordinates: [[13.438640,52.519930], [13.415852,52.513191]]}, function(err, result) {
osrm.route({coordinates: [[52.519930,13.438640], [52.513191,13.415852]]}, function(err, result) {
if(err) throw err;
console.log(result.waypoints); // array of Waypoint objects representing all waypoints in order
console.log(result.routes); // array of Route objects ordered by descending recommendation rank
});
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank.
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An array of [Waypoint](#waypoint) objects representing all waypoints in order AND an array of [`Route`](#route) objects ordered by descending recommendation rank.
### nearest
@ -79,16 +92,19 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the nearest query.
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.number` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
- `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.number` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
Must be an integer greater than or equal to `1`. (optional, default `1`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@ -104,30 +120,34 @@ osrm.nearest(options, function(err, response) {
});
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`.
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints`.
**`waypoints`**: array of [`Ẁaypoint`](#waypoint) objects sorted by distance to the input coordinate.
Each object has an additional `distance` property, which is the distance in meters to the supplied input coordinate.
### table
Computes duration tables for the given locations. Allows for both symmetric and asymmetric
tables.
Computes duration table for the given locations. Allows for both symmetric and asymmetric tables.
Optionally returns distance table.
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the table query.
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.sources` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to
use
location with given index as source. Default is to use all.
- `options.destinations` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer <
#coordinates`) to use location with given index as destination. Default is to use all.
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `null` (unlimited, default) or `double >= 0`.
- `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use
location with given index as source. Default is to use all.
- `options.destinations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** An array of `index` elements (`0 <= integer < #coordinates`) to use location with given index as destination. Default is to use all.
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate.. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.fallback_speed` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Replace `null` responses in result with as-the-crow-flies estimates based on `fallback_speed`. Value is in metres/second.
- `options.fallback_coordinate` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Either `input` (default) or `snapped`. If using a `fallback_speed`, use either the user-supplied coordinate (`input`), or the snapped coordinate (`snapped`) for calculating the as-the-crow-flies distance between two points.
- `options.scale_factor` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Multiply the table duration values in the table by this number for more controlled input into a route optimization solver.
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `options.annotations` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Return the requested table or tables in response. Can be `['duration']` (return the duration matrix, default), `[distance']` (return the distance matrix), or `['duration', distance']` (return both the duration matrix and the distance matrix).
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@ -142,16 +162,20 @@ var options = {
};
osrm.table(options, function(err, response) {
console.log(response.durations); // array of arrays, matrix in row-major order
console.log(response.distances); // array of arrays, matrix in row-major order
console.log(response.sources); // array of Waypoint objects
console.log(response.destinations); // array of Waypoint objects
});
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `sources`, and `destinations`.
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `durations`, `distances`, `sources`, and `destinations`.
**`durations`**: array of arrays that stores the matrix in row-major order. `durations[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint.
Values are given in seconds.
**`distances`**: array of arrays that stores the matrix in row-major order. `distances[i][j]` gives the travel time from the i-th waypoint to the j-th waypoint.
Values are given in meters.
**`sources`**: array of [`Ẁaypoint`](#waypoint) objects describing all sources in order.
**`destinations`**: array of [`Ẁaypoint`](#waypoint) objects describing all destinations in order.
**`fallback_speed_cells`**: (optional) if `fallback_speed` is used, will be an array of arrays of `row,column` values, indicating which cells contain estimated values.
### tile
@ -164,10 +188,10 @@ and what weights they have applied.
**Parameters**
- `ZXY` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like
- `ZXY` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** an array consisting of `x`, `y`, and `z` values representing tile coordinates like
[wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames)
and are supported by vector tile viewers like [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/api/).
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@ -191,20 +215,23 @@ if they can not be matched successfully.
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the match query.
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.timestamps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`.
- `options.gaps` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore` (optional, default `split`).
- `options.tidy` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Allows the input track modification to obtain better matching quality for noisy tracks (optional, default `false`).
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` according to highest zoom level it could be display on, or not at all (`false`). (optional, default `simplified`)
- `options.timestamps` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Timestamp of the input location (integers, UNIX-like timestamp).
- `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy. Can be `null` for default value `5` meters or `double >= 0`.
- `options.gaps` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Allows the input track splitting based on huge timestamp gaps between points. Either `split` or `ignore`. (optional, default `split`)
- `options.tidy` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Allows the input track modification to obtain better matching quality for noisy tracks. (optional, default `false`)
- `options.waypoints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@ -221,12 +248,15 @@ osrm.match(options, function(err, response) {
});
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
If the trace point was ommited by map matching because it is an outlier, the entry will be null.
Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of
If the trace point was omitted by map matching because it is an outlier, the entry will be null.
Each `Waypoint` object has the following additional properties,
1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to,
2) `waypoint_index`: Index of
the waypoint inside the matched route.
3) `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching.
**`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property,
which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.
@ -254,21 +284,23 @@ Right now, the following combinations are possible:
**Parameters**
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
- `options.coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object literal containing parameters for the trip query.
- `options.coordinates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** The coordinates this request will use, coordinates as `[{lon},{lat}]` values, in decimal degrees.
- `options.bearings` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Can be `null` or an array of `[{value},{range}]` with `integer 0 .. 360,integer 0 .. 180`.
- `options.radiuses` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
- `options.hints` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.steps` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `options.radiuses` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Limits the coordinate snapping to streets in the given radius in meters. Can be `double >= 0` or `null` (unlimited, default).
- `options.hints` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Hints for the coordinate snapping. Array of base64 encoded strings.
- `options.generate_hints` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default `true`)
- `options.steps` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route steps for each route. (optional, default `false`)
- `options.annotations` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** An array with strings of `duration`, `nodes`, `distance`, `weight`, `datasources`, `speed` or boolean for enabling/disabling all. (optional, default `false`)
- `options.geometries` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Returned route geometry format (influences overview and per step). Can also be `geojson`. (optional, default `polyline`)
- `options.overview` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Add overview geometry either `full`, `simplified` (optional, default `simplified`)
- `options.roundtrip` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Return route is a roundtrip. (optional, default `true`)
- `options.source` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route starts at `any` or `first` coordinate. (optional, default `any`)
- `options.destination` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Return route ends at `any` or `last` coordinate. (optional, default `any`)
- `options.approaches` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Restrict the direction on the road network at a waypoint, relative to the input coordinate. Can be `null` (unrestricted, default), `curb` or `opposite`.
- `options.snapping` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
- `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
**Examples**
@ -290,16 +322,49 @@ osrm.trip(options, function(err, response) {
});
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`.
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `waypoints` and `trips`.
**`waypoints`**: an array of [`Waypoint`](#waypoint) objects representing all waypoints in input order.
Each Waypoint object has the following additional properties,
1) `trips_index`: index to trips of the sub-trip the point was matched to, and
2) `waypoint_index`: index of the point in the trip.
**`trips`**: an array of [`Route`](#route) objects that assemble the trace.
## Responses
## Configuration
Responses
All plugins support a second additional object that is available to configure some NodeJS
specific behaviours.
**Parameters**
- `plugin_config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query.
- `plugin_config.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls.
Valid options are `object` (default if `options.format` is
`json`), which returns a standard Javascript object, as described above, and `buffer`(default if
`options.format` is `flatbuffers`), which will return a NodeJS
**[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
object. The latter has the advantage that it can be immediately serialized to disk/sent over the
network, and the generation of the string is performed outside the main NodeJS event loop. This
option is ignored by the `tile` plugin. Also note that `options.format` set to `flatbuffers`
cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
`buffer`.
**Examples**
```javascript
var osrm = new OSRM('network.osrm');
var options = {
coordinates: [
[13.36761474609375, 52.51663871100423],
[13.374481201171875, 52.506191342034576]
]
};
osrm.route(options, { format: "buffer" }, function(err, response) {
if (err) throw err;
console.log(response.toString("utf-8"));
});
```
## Responses
### Route
@ -307,8 +372,8 @@ Represents a route through (potentially multiple) waypoints.
**Parameters**
- `exteral` **documentation** in
[`osrm-backend`](../http.md#route)
- `external` **documentation** in
[`osrm-backend`](../http.md#route-object)
### RouteLeg
@ -316,8 +381,8 @@ Represents a route between two waypoints.
**Parameters**
- `exteral` **documentation** in
[`osrm-backend`](../http.md#routeleg)
- `external` **documentation** in
[`osrm-backend`](../http.md#routeleg-object)
### RouteStep
@ -326,15 +391,15 @@ single way to the subsequent step.
**Parameters**
- `exteral` **documentation** in
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#routestep)
- `external` **documentation** in
[`osrm-backend`](../http.md#routestep-object)
### StepManeuver
**Parameters**
- `exteral` **documentation** in
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#stepmaneuver)
- `external` **documentation** in
[`osrm-backend`](../http.md#stepmaneuver-object)
### Waypoint
@ -342,5 +407,5 @@ Object used to describe waypoint on a route.
**Parameters**
- `exteral` **documentation** in
[`osrm-backend`](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint)
- `external` **documentation** in
[`osrm-backend`](../http.md#waypoint-object)

View File

@ -1,86 +0,0 @@
# Releasing
Releasing a new version of `node-osrm` is mostly automated using Travis CI.
The version of `node-osrm` is locked to the same version as `osrm-backend`. Every `node-osrm` should have a `osrm-backend` release of the same version. Of course, only release a `node-osrm` after the release has been tagged in `osrm-backend`.
These steps all happen on `master`. After the release is out, create a branch using the MAJOR.MINOR version of the release to document code changes made for that version.
### Steps to release
1. Update the `osrm_release` field in `package.json` to the corresonding git tag in `osrm-backend.`
Confirm the desired OSRM branch and commit to `master`.
1. Bump node-osrm version
Update the `CHANGELOG.md` and the `package.json` version if needed.
1. Check that Travis CI [builds are passing](https://travis-ci.org/Project-OSRM/node-osrm) for the latest commit on `master`.
1. Publishing binaries
If travis builds are passing then it's time to publish binaries by committing with a message containing `[publish binary]`. Use an empty commit for this.
```
git commit --allow-empty -m "[publish binary] vMAJOR.MINOR.PATCH"
```
1. Test
Locally you can now test binaries. Cleanup, re-install, and run the tests like:
```
make clean
npm install # will pull remote binaries
npm ls # confirm deps are correct
make test
```
1. Tag
Once binaries are published for Linux and OS X then its time to tag a new release and add the changelog to the tag:
```
git tag vMAJOR.MINOR.PATCH -a
git push --tags
```
1. Publish node-osrm. **we only do this for stable releases**
First ensure your local `node-pre-gyp` is up to date:
```
npm ls
```
This is important because it is bundled during packaging.
If you see any errors then do:
```
rm -rf node_modules/node-pre-gyp
npm install node-pre-gyp
```
Now we're ready to publish `node-osrm` to <https://www.npmjs.org/package/osrm>:
```
npm publish
```
Dependent apps can now pull from the npm registry like:
```
"dependencies": {
"osrm": "^MAJOR.MINOR.PATCH"
}
```
Or can still pull from the github tag like:
```
"dependencies": {
"osrm": "https://github.com/Project-OSRM/node-osrm/archive/vMAJOR.MINOR.PATCH.tar.gz"
}
```

View File

@ -68,7 +68,7 @@ If you want to prioritize certain streets, increase the rate on these.
## Elements
### api_version
A profile should set `api_version` at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If `api_version` is not defined, 0 will be assumed. The current api version is 2.
A profile should set `api_version` at the top of your profile. This is done to ensure that older profiles are still supported when the api changes. If `api_version` is not defined, 0 will be assumed. The current api version is 4.
### Library files
The folder [profiles/lib/](../profiles/lib/) contains LUA library files for handling many common processing tasks.
@ -89,7 +89,7 @@ They all return a table of functions when you use `require` to load them. You ca
### setup()
The `setup` function is called once when the profile is loaded and must return a table of configurations. It's also where you can do other global setup, like loading data sources that are used during processing.
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA iinterpreter will have its own set of globals.
Note that processing of data is parallelized and several unconnected LUA interpreters will be running at the same time. The `setup` function will be called once for each. Each LUA interpreter will have its own set of globals.
The following global properties can be set under `properties` in the hash you return in the `setup` function:
@ -98,7 +98,7 @@ Attribute | Type | Notes
weight_name | String | Name used in output for the routing weight property (default `'duration'`)
weight_precision | Unsigned | Decimal precision of edge weights (default `1`)
left_hand_driving | Boolean | Are vehicles assumed to drive on the left? (used in guidance, default `false`)
use_turn_restrictions | Boolean | Are turn instructions followed? (default `false`)
use_turn_restrictions | Boolean | Are turn restrictions followed? (default `false`)
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed? (default `true`)
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
max_turn_weight | Float | Maximum turn penalty weight
@ -113,7 +113,7 @@ excludable | Sequence of Sets | Determines which class
classes | Sequence | Determines the allowed classes that can be referenced using `{forward,backward}_classes` on the way in the `process_way` function.
restrictions | Sequence | Determines which turn restrictions will be used for this profile.
suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES".
relation_types | Sequence | Determines wich relations should be cached for processing in this profile. It contains relations types
relation_types | Sequence | Determines which relations should be cached for processing in this profile. It contains relations types
### process_node(profile, node, result, relations)
Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay.
@ -138,7 +138,7 @@ Given an OpenStreetMap way, the `process_way` function will either return nothin
Argument | Description
---------|-------------------------------------------------------
profile | The configuration table you returned in `setup`.
node | The input way to process (read-only).
way | The input way to process (read-only).
result | The output that you will modify.
relations| Storage of relations to access relations, where `way` is a member.
@ -178,7 +178,7 @@ exits | String | The ramp's exit numbers or
pronunciation | String | Name pronunciation
road_classification.motorway_class | Boolean | Guidance: way is a motorway
road_classification.link_class | Boolean | Guidance: way is a slip/link road
road_classification.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/guidance/road_classification.hpp`
road_classification.road_priority_class | Enum | Guidance: order in priority list. Defined in `include/extractor/road_classification.hpp`
road_classification.may_be_ignored | Boolean | Guidance: way is non-highway
road_classification.num_lanes | Unsigned | Guidance: total number of lanes in way
@ -199,7 +199,7 @@ source.lon | Read | Float | Co-ordinates of segment start
source.lat | Read | Float | ""
target.lon | Read | Float | Co-ordinates of segment end
target.lat | Read | Float | ""
target.distance | Read | Float | Length of segment
distance | Read | Float | Length of segment
weight | Read/write | Float | Routing weight for this segment
duration | Read/write | Float | Duration for this segment
@ -223,16 +223,16 @@ source_number_of_lanes | Read | Integer |
source_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
source_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
source_speed | Read | Integer | Speed on this source road in km/h
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/guidance/road_classification.hpp`
target_restricted | Read | Boolean | Is it from a restricted access road? (See definition in `process_way`)
target_mode | Read | Enum | Travel mode before the turn. Defined in `include/extractor/travel_mode.hpp`
source_priority_class | Read | Enum | The type of road priority class of the source. Defined in `include/extractor/road_classification.hpp`
target_restricted | Read | Boolean | Is the target a restricted access road? (See definition in `process_way`)
target_mode | Read | Enum | Travel mode after the turn. Defined in `include/extractor/travel_mode.hpp`
target_is_motorway | Read | Boolean | Is the target road a motorway?
target_is_link | Read | Boolean | Is the target road a link?
target_number_of_lanes | Read | Integer | How many lanes does the target road have? (default when not tagged: 0)
target_highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
target_access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15))
target_speed | Read | Integer | Speed on this target road in km/h
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/guidance/road_classification.hpp`
target_priority_class | Read | Enum | The type of road priority class of the target. Defined in `include/extractor/road_classification.hpp`
roads_on_the_right | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the right of the turn that are also connected at the intersection
roads_on_the_left | Read | Vector<ExtractionTurnLeg> | Vector with information about other roads on the left of the turn that are also connected at the intersection. If turn is a u turn, this is empty.
weight | Read/write | Float | Penalty to be applied for this turn (routing weight)
@ -252,7 +252,7 @@ number_of_lanes | Read | Integer | How many lanes does th
highway_turn_classification | Read | Integer | Classification based on highway tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
access_turn_classification | Read | Integer | Classification based on access tag defined by user during setup. (default when not set: 0, allowed classification values are: 0-15)
speed | Read | Integer | Speed on this road in km/h
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/guidance/road_classification.hpp`
priority_class | Read | Enum | The type of road priority class of the leg. Defined in `include/extractor/road_classification.hpp`
is_incoming | Read | Boolean | Is the road an incoming road of the intersection
is_outgoing | Read | Boolean | Is the road an outgoing road of the intersection
@ -349,7 +349,7 @@ The input data must an ASCII file with rows of integers. e.g.:
In your `segment_function` you can then access the raster source and use `raster:query()` to query to find the nearest data point, or `raster:interpolate()` to interpolate a value based on nearby data points.
You must check whether the result is valid before use it.
You must check whether the result is valid before using it.
Example:

View File

@ -43,16 +43,17 @@ We may introduce forward-compatible changes: query parameters and response prope
1. Check out the appropriate release branch `x.y`
2. Make sure `CHANGELOG.md` is up to date.
3. Make sure the `package.json` is up to date.
4. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
3. Make sure the `package.json` on branch `x.y` has been committed.
4. Make sure all tests are passing (e.g. Github Actions CI gives you a :heavy_check_mark:)
5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries. Commit should be one in which the `package.json` version matches the version you want to release.
6. Use `npm run docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
7. Push tags and commits: `git push; git push --tags`
8. On https://github.com/Project-OSRM/osrm-backend/releases press `Draft a new release`,
write the release tag `vx.y.z` in the `Tag version` field, write the changelog entries in the `Describe this release` field
and press `Publish release`.
and press `Publish release`. Note that Github Actions CI deployments will create a release when publishing node binaries, so the release
may already exist. In which case the description should be updated with the changelog entries.
9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
10. Wait until the travis build has been completed and check if the node binaries were published by doing:
10. Wait until the Github Actions build has been completed and check if the node binaries were published by doing:
`rm -rf node_modules && npm install` locally.
11. For final releases run `npm publish` or `npm publish --tag next` for release candidates.
12. Bump version in `package.json` to `{MAJOR}.{MINOR+1}.0-latest.1` on the `master` branch after the release.
12. Bump version in `package.json` to `{MAJOR}.{MINOR+1}.0-unreleased` on the `master` branch after the release.

View File

@ -300,7 +300,7 @@ And the relations
The setting looks perfectly fine at first glance. However, it is not well defined.
The forbidden right turn could be either a superfluous addition, forbidding the turn `cb` to `be`, or actually refer to the turn `ab` to `bd` to say that a turn is forbidden here.
To model turn-restrictions correctly and unique, we need to split segments that contribute to the restriction into the smallest possible parts.
To model turn-restrictions correctly and uniquely, we need to split segments that contribute to the restriction into the smallest possible parts.
E.g. the above scenario could correctly be expressed as:
```
@ -360,7 +360,7 @@ When I route I should get
And the test reports `turn right` for the route `a->e`, where before it said `slight right`.
If you changed the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
If you change the turn angles, obviously you can expect changes in the distinction between `slight right` and `right`.
In such a case it is, of course, reasonable to change the expected route to report `right` instead of `slight right`. You should consider inspecting the actual turn angles at `b` to see if you feel that change is justified.
However, you should never adjust the test itself.
@ -390,9 +390,9 @@ In this case we would see a very slight turn angle. If your change now reports d
### Consider Post-Processing Impacts
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can finde in `util/debug.hpp` (and potentially other related headers).
Some changes you might see could look completely unrelated. To understand the impact of your changes, you can make use of the debugging utilities you can find in `util/debug.hpp` (and potentially other related headers).
If your test is inspecting a series of turns (remember, a turn not necessarily equals an instruction), you could see interaction with post-processing.
If your test is inspecting a series of turns (remember, a turn does not necessarily equals an instruction), you could see interaction with post-processing.
To see the unprocessed turns, you should print the steps at the end of step assembly (`assembleSteps` in `engine/guidance/assemble_steps.hpp`).
If you see unexpected changes, you can consider adding the `locations` field to your test to study what location a turn is reported at.

31
docs/windows-deps.md Normal file
View File

@ -0,0 +1,31 @@
# Building OSRM for Windows
There is experimental support for building OSRM on Windows.
## Dependencies
You will need a modern Windows development stack (e.g. Visual Studio 17). The published binaries are built with
[Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md) Github hosted runners.
Dependencies are managed via [Conan](https://conan.io/) and built with [CMake](https://cmake.org/).
## Building
```bat
cmake -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "Visual Studio 17 2022" ..
msbuild OSRM.sln ^
/p:Configuration=%CONFIGURATION% ^
/p:Platform=x64 ^
/t:rebuild ^
/p:BuildInParallel=true ^
/m:%NUMBER_OF_PROCESSORS% ^
/toolsversion:Current ^
/clp:Verbosity=normal ^
/nologo
```

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.8)
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.
@ -12,20 +12,18 @@ 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")
set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(bitness 64)
message(STATUS "Building on a 64 bit system")
else()
message(STATUS "Building on a 32 bit system")
endif()
if(WIN32 AND MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
endif()
link_directories(${LibOSRM_LIBRARY_DIRS})
add_executable(osrm-example example.cpp)

View File

@ -1,283 +0,0 @@
# Locate Intel Threading Building Blocks include paths and libraries
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
# The MIT License
#
# Copyright (c) 2011 Hannes Hofmann
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
# in the TBB installation directory (TBB_INSTALL_DIR).
#
# GvdB: Mac OS X distribution places libraries directly in lib directory.
#
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
# which architecture to use
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
# which compiler to use (detected automatically on Windows)
# This module respects
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
# This module defines
# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
# TBB_INSTALL_DIR, the base TBB install directory
# TBB_LIBRARIES, the libraries to link against to use TBB.
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
# TBB_FOUND, If false, don't try to use TBB.
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
if (WIN32)
# has em64t/vc8 em64t/vc9
# has ia32/vc7.1 ia32/vc8 ia32/vc9
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
if (MSVC71)
set (_TBB_COMPILER "vc7.1")
endif(MSVC71)
if (MSVC80)
set(_TBB_COMPILER "vc8")
endif(MSVC80)
if (MSVC90)
set(_TBB_COMPILER "vc9")
endif(MSVC90)
if(MSVC10)
set(_TBB_COMPILER "vc10")
endif(MSVC10)
# Todo: add other Windows compilers such as ICL.
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (WIN32)
if (UNIX)
if (APPLE)
# MAC
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# default flavor on apple: ia32/cc4.0.1_os10.4.9
# Jiri: There is no reason to presume there is only one flavor and
# that user's setting of variables should be ignored.
if(NOT TBB_COMPILER)
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
elseif (NOT TBB_COMPILER)
set(_TBB_COMPILER ${TBB_COMPILER})
endif(NOT TBB_COMPILER)
if(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE "ia32")
elseif(NOT TBB_ARCHITECTURE)
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif(NOT TBB_ARCHITECTURE)
else (APPLE)
# LINUX
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
# has ia32/*
# has itanium/*
set(_TBB_COMPILER ${TBB_COMPILER})
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
endif (APPLE)
endif (UNIX)
if (CMAKE_SYSTEM MATCHES "SunOS.*")
# SUN
# not yet supported
# has em64t/cc3.4.3_kernel5.10
# has ia32/*
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
#-- Clear the public variables
set (TBB_FOUND "NO")
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
# first: use CMake variable TBB_INSTALL_DIR
if (TBB_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
endif (TBB_INSTALL_DIR)
# second: use environment variable
if (NOT _TBB_INSTALL_DIR)
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
# Intel recommends setting TBB21_INSTALL_DIR
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
endif (NOT _TBB_INSTALL_DIR)
# third: try to find path automatically
if (NOT _TBB_INSTALL_DIR)
if (_TBB_DEFAULT_INSTALL_DIR)
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
endif (_TBB_DEFAULT_INSTALL_DIR)
endif (NOT _TBB_INSTALL_DIR)
# sanity check
if (NOT _TBB_INSTALL_DIR)
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
else (NOT _TBB_INSTALL_DIR)
# finally: set the cached CMake variable TBB_INSTALL_DIR
if (NOT TBB_INSTALL_DIR)
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
mark_as_advanced(TBB_INSTALL_DIR)
endif (NOT TBB_INSTALL_DIR)
#-- A macro to rewrite the paths of the library. This is necessary, because
# find_library() always found the em64t/vc9 version of the TBB libs
macro(TBB_CORRECT_LIB_DIR var_name)
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
endmacro(TBB_CORRECT_LIB_DIR var_content)
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
# Jiri: tbbvars now sets the CPATH environment variable to the directory
# containing the headers.
find_path(TBB_INCLUDE_DIR
tbb/task_scheduler_init.h
PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
)
mark_as_advanced(TBB_INCLUDE_DIR)
#-- Look for libraries
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
set (_TBB_LIBRARY_DIR
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
)
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
# Jiri: This block isn't mutually exclusive with the previous one
# (hence no else), instead I test if the user really specified
# the variables in question.
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# HH: deprecated
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
# Jiri: It doesn't hurt to look in more places, so I store the hints from
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
# variables and search them both.
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
# GvdB: Mac OS X distribution places libraries directly in lib directory.
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
# Jiri: No reason not to check the default paths. From recent versions,
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
# variables, which now point to the directories of the lib files.
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
# argument instead of the implicit PATHS as it isn't hard-coded
# but computed by system introspection. Searching the LIBRARY_PATH
# and LD_LIBRARY_PATH environment variables is now even more important
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
# the use of TBB built from sources.
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
#Extract path from TBB_LIBRARY name
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
#-- Look for debug libraries
# Jiri: Changed the same way as for the release libraries.
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
# Extract path from TBB_LIBRARY_DEBUG name
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
if (TBB_INCLUDE_DIR)
if (TBB_LIBRARY)
set (TBB_FOUND "YES")
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
message(STATUS "Found Intel TBB")
endif (TBB_LIBRARY)
endif (TBB_INCLUDE_DIR)
if (NOT TBB_FOUND)
message("ERROR: Intel TBB NOT found!")
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
# do only throw fatal, if this pkg is REQUIRED
if (TBB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find TBB library.")
endif (TBB_FIND_REQUIRED)
endif (NOT TBB_FOUND)
endif (NOT _TBB_INSTALL_DIR)
if (TBB_FOUND)
set(TBB_INTERFACE_VERSION 0)
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
endif (TBB_FOUND)

1
example/cmake/FindTBB.cmake Symbolic link
View File

@ -0,0 +1 @@
../../cmake/FindTBB.cmake

View File

@ -52,19 +52,20 @@ int main(int argc, const char *argv[])
params.coordinates.push_back({util::FloatLongitude{7.419505}, util::FloatLatitude{43.736825}});
// Response is in JSON format
json::Object result;
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 = result.values["routes"].get<json::Array>();
auto &routes = std::get<json::Array>(json_result.values["routes"]);
// Let's just use the first route
auto &route = routes.values.at(0).get<json::Object>();
const auto distance = route.values["distance"].get<json::Number>().value;
const auto duration = route.values["duration"].get<json::Number>().value;
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)
@ -79,8 +80,8 @@ int main(int argc, const char *argv[])
}
else if (status == Status::Error)
{
const auto code = result.values["code"].get<json::String>().value;
const auto message = result.values["message"].get<json::String>().value;
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";

View File

@ -127,6 +127,7 @@ Feature: Bike - Access tags on ways
| | | agricultural | |
| | | forestry | |
| | | delivery | |
| | | use_sidepath | |
Scenario: Bike - Access tags on both node and way
Then routability should be

View File

@ -28,7 +28,7 @@ Feature: Bicycle - Route around alleys
When I route I should get
| from | to | a:nodes | weight | # |
| a | f | 1:2:3:6 | 200.4 | Avoids d,e,f |
| a | e | 1:2:5 | 176.4 | Take the alley b,e if neccessary |
| d | f | 4:1:2:3:6 | 252.6 | Avoids the alley d,e,f |
| a | f | 1:2:3:6 | 196.2 | Avoids d,e,f |
| a | e | 1:2:5 | 172.2 | Take the alley b,e if neccessary |
| d | f | 4:1:2:3:6 | 248.4 | Avoids the alley d,e,f |

View File

@ -19,7 +19,7 @@ Feature: Barriers
| entrance | x |
| wall | |
| fence | |
| some_tag | |
| some_tag | x |
| block | x |
Scenario: Bike - Access tag trumphs barriers

View File

@ -0,0 +1,92 @@
@routing @bicycle @mode
Feature: Bicycle - Mode flag
Background:
Given the profile "bicycle"
Scenario: Bicycle - We tag ferries with a class
Given the node map
"""
a b
c d
"""
And the ways
| nodes | highway | route |
| ab | primary | |
| bc | | ferry |
| cd | primary | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| d | a | cd,bc,ab,ab | depart,notification right,notification left,arrive | [()],[(ferry)],[()],[()] |
| c | a | bc,ab,ab | depart,notification left,arrive | [(ferry)],[()],[()] |
| d | b | cd,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| a | c | ab,bc,bc | depart,notification right,arrive | [()],[(ferry)],[()] |
| b | d | bc,cd,cd | depart,notification left,arrive | [(ferry)],[()],[()] |
Scenario: Bicycle - We tag tunnel with a class
Background:
Given a grid size of 200 meters
Given the node map
"""
a b
c d
"""
And the ways
| nodes | tunnel |
| ab | no |
| bc | yes |
| cd | |
When I route I should get
| from | to | route | turns | classes |
| a | d | ab,bc,cd,cd | depart,new name right,new name left,arrive | [()],[(tunnel)],[()],[()] |
Scenario: Bicycle - We tag classes without intersections
Background:
Given a grid size of 200 meters
Given the node map
"""
a b c d
"""
And the ways
| nodes | name | tunnel |
| ab | road | |
| bc | road | yes |
| cd | road | |
When I route I should get
| from | to | route | turns | classes |
| a | d | road,road | depart,arrive | [(),(tunnel),()],[()] |
Scenario: Bicycle - From roundabout on ferry
Given the node map
"""
c
/ \
a---b d---f--h
\ /
e
|
g
"""
And the ways
| nodes | oneway | highway | junction | route |
| ab | yes | service | | |
| cb | yes | service | roundabout | |
| dc | yes | service | roundabout | |
| be | yes | service | roundabout | |
| ed | yes | service | roundabout | |
| eg | yes | service | | |
| df | | | | ferry |
| fh | yes | service | | |
When I route I should get
| from | to | route | turns | classes |
| a | h | ab,df,df,fh,fh | depart,roundabout-exit-2,exit roundabout slight right,notification straight,arrive | [()],[(),()],[(ferry)],[()],[()] |

View File

@ -0,0 +1,55 @@
@routing @bicycle @exclude
Feature: Bicycle - Exclude flags
Background:
Given the profile file "bicycle" initialized with
"""
profile.excludable = Sequence { Set { 'ferry' } }
"""
Given the node map
"""
a....b~~~~~c...f
: :
d.....e
"""
And the ways
| nodes | highway | route | duration | # |
| ab | service | | | always drivable |
| bc | | ferry | 00:00:01 | not drivable for exclude=ferry, but fast. |
| bd | service | | | always drivable |
| de | service | | | always drivable |
| ec | service | | | always drivable |
| cf | service | | | always drivable |
Scenario: Bicycle - exclude nothing
When I route I should get
| from | to | route |
| a | f | ab,bc,cf,cf |
When I match I should get
| trace | matchings | duration |
| abcf | abcf | 109 |
When I request a travel time matrix I should get
| | a | f |
| a | 0 | 109 |
| f | 109 | 0 |
Scenario: Bicycle - exclude ferry
Given the query options
| exclude | ferry |
When I route I should get
| from | to | route |
| a | f | ab,bd,de,ec,cf,cf |
When I match I should get
| trace | matchings | duration |
| abcf | abcf | 301 |
When I request a travel time matrix I should get
| | a | f |
| a | 0 | 301 +- 1 |
| f | 301.2 +- 1 | 0 |

View File

@ -9,7 +9,7 @@ Feature: Bike - Max speed restrictions
Then routability should be
| highway | maxspeed | bothw |
| residential | | 15 km/h |
| residential | 10 | 9 km/h |
| residential | 10 | 10 km/h |
Scenario: Bicycle - Ignore maxspeed when higher than way speed
Then routability should be
@ -65,12 +65,12 @@ Feature: Bike - Max speed restrictions
Then routability should be
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
| | | | 15 km/h | 15 km/h |
| 10 | | | 9 km/h | 9 km/h |
| | 10 | | 9 km/h | 15 km/h |
| | | 10 | 14 km/h | 9 km/h |
| 2 | 10 | | 9 km/h | 2 km/h |
| 2 | | 10 | 2 km/h | 9 km/h |
| 2 | 5 | 10 | 5 km/h | 9 km/h |
| 10 | | | 10 km/h | 10 km/h |
| | 10 | | 10 km/h | 15 km/h |
| | | 10 | 15 km/h | 10 km/h |
| 2 | 10 | | 10 km/h | 2 km/h |
| 2 | | 10 | 2 km/h | 10 km/h |
| 2 | 5 | 10 | 5 km/h | 10 km/h |
Scenario: Bike - Maxspeed should not allow routing on unroutable ways
Then routability should be

View File

@ -78,6 +78,15 @@ Feature: Bike - Accessability of different way types
| construction | yes | | |
| construction | | yes | |
@proposed
Scenario: Bike - Don't allow routing on ways still being proposed
Then routability should be
| highway | foot | bicycle | proposed | bothw |
| primary | | | | x |
| proposed | | | | |
| proposed | yes | | yes | |
| proposed | | yes | yes | |
@roundabout
Scenario: Bike - Don't push bikes against oneway flow on roundabouts
Then routability should be

View File

@ -11,11 +11,11 @@ Feature: Bicycle - Adds penalties to unsafe roads
Then routability should be
| highway | cycleway | forw | backw | forw_rate | backw_rate |
| motorway | | | | | |
| primary | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| primary | | 15 km/h | 15 km/h | 2.1 | 2.1 |
| secondary | | 15 km/h | 15 km/h | 2.7 | 2.7 |
| tertiary | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| primary_link | | 15 km/h | 15 km/h | 2.9 | 2.9 |
| secondary_link | | 15 km/h | 15 km/h | 3.1 | 3.1 |
| primary_link | | 15 km/h | 15 km/h | 2.1 | 2.1 |
| secondary_link | | 15 km/h | 15 km/h | 2.7 | 2.7 |
| tertiary_link | | 15 km/h | 15 km/h | 3.3 | 3.3 |
| residential | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | 15 km/h | 15 km/h | 4.2 | 4.2 |
@ -33,7 +33,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
| tertiary_link | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | 14 km/h | 14 km/h | 4.2 | 4.2 |
| motorway | lane | 15 km/h | | 4.2 | |
| primary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
@ -41,7 +41,7 @@ Feature: Bicycle - Adds penalties to unsafe roads
| primary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| secondary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| tertiary_link | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | lane | 14 km/h | 14 km/h | 4.2 | 4.2 |
| cycleway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| motorway | shared_lane | 15 km/h | | 4.2 | |
@ -51,49 +51,49 @@ Feature: Bicycle - Adds penalties to unsafe roads
Then routability should be
| highway | cycleway:right | cycleway:left | forw | backw | forw_rate | backw_rate |
| motorway | track | | 15 km/h | | 4.2 | |
| primary | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| primary | track | | 15 km/h | 15 km/h | 4.2 | 2.1 |
| secondary | track | | 15 km/h | 15 km/h | 4.2 | 2.7 |
| tertiary | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | track | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| primary_link | track | | 15 km/h | 15 km/h | 4.2 | 2.1 |
| secondary_link | track | | 15 km/h | 15 km/h | 4.2 | 2.7 |
| tertiary_link | track | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | track | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | track | | 15 km/h | 4 km/h +-1 | 4.2 | 1.1 |
| footway | track | | 14 km/h | 4 km/h +-1 | 4.2 | 1.1 |
| motorway | | track | 15 km/h | | 4.2 | |
| primary | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| primary | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
| secondary | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
| tertiary | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | track | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | track | 15 km/h | 15 km/h | 3.1 | 4.2 |
| primary_link | | track | 15 km/h | 15 km/h | 2.1 | 4.2 |
| secondary_link | | track | 15 km/h | 15 km/h | 2.7 | 4.2 |
| tertiary_link | | track | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| residential | | track | 14 km/h | 14 km/h | 4.2 | 4.2 |
| cycleway | | track | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | track | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
| motorway | lane | | 15 km/h | | 4.2 | |
| primary | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| primary | lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
| secondary | lane | | 15 km/h | 15 km/h | 4.2 | 2.7 |
| tertiary | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| secondary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.1 |
| primary_link | lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
| secondary_link | lane | | 14 km/h | 14 km/h | 4.2 | 2.7 |
| tertiary_link | lane | | 15 km/h | 15 km/h | 4.2 | 3.3 |
| residential | lane | | 15 km/h +-1 | 15 km/h +-1 | 4.2 | 4.2 |
| cycleway | lane | | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | lane | | 15 km/h | 4 km/h +-1 | 4.2 | 1.1 |
| motorway | | lane | 15 km/h | | 4.2 | |
| primary | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 3.1 | 4.2 |
| primary | | lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
| secondary | | lane | 15 km/h +-1 | 15 km/h +-1 | 2.7 | 4.2 |
| tertiary | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| primary_link | | lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| secondary_link | | lane | 15 km/h | 15 km/h | 3.1 | 4.2 |
| primary_link | | lane | 14 km/h | 14 km/h | 2.1 | 4.2 |
| secondary_link | | lane | 15 km/h | 15 km/h | 2.7 | 4.2 |
| tertiary_link | | lane | 15 km/h | 15 km/h | 3.3 | 4.2 |
| residential | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| cycleway | | lane | 15 km/h | 15 km/h | 4.2 | 4.2 |
| footway | | lane | 4 km/h +-1 | 15 km/h | 1.1 | 4.2 |
| motorway | shared_lane | | 15 km/h | | 4.2 | |
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.9 |
| motorway | | shared_lane | 15 km/h | | 4.2 | |
| primary | | shared_lane | 15 km/h | 15 km/h | 2.9 | 4.2 |
| primary | shared_lane | | 15 km/h | 15 km/h | 4.2 | 2.1 |
| motorway | | shared_lane | 14 km/h | | 4.2 | |
| primary | | shared_lane | 15 km/h | 15 km/h | 2.1 | 4.2 |
Scenario: Bike - Don't apply penalties for all kind of cycleways

View File

@ -8,29 +8,38 @@ Feature: Bike - Surfaces
Then routability should be
| highway | surface | bothw |
| cycleway | | 48 s |
| cycleway | asphalt | 48 s |
| cycleway | asphalt | 47.9 s |
| cycleway | chipseal | 48 s |
| cycleway | concrete | 48 s |
| cycleway | concrete_lanes | 48 s |
| cycleway | cobblestone:flattened | 72 s |
| cycleway | paving_stones | 72 s |
| cycleway | wood | 72 s |
| cycleway | metal | 72 s |
| cycleway | compacted | 72 s |
| cycleway | cobblestone | 120 s |
| cycleway | fine_gravel | 120 s |
| cycleway | fine_gravel | 72 s |
| cycleway | ground | 72 s |
| cycleway | dirt | 90 s |
| cycleway | cobblestone | 102.9 s |
| cycleway | gravel | 120 s |
| cycleway | pebblestone | 120.1 s |
| cycleway | dirt | 120 s |
| cycleway | pebblestone | 120 s |
| cycleway | grass_paver | 120 s |
| cycleway | dirt | 90 s |
| cycleway | earth | 120 s |
| cycleway | grass | 120 s |
| cycleway | mud | 240 s |
| cycleway | sand | 240.1 s |
| cycleway | sett | 72 s |
| cycleway | sand | 240 s |
| cycleway | woodchips | 240 s |
| cycleway | sett | 80 s |
Scenario: Bicycle - Good surfaces on small paths
Then routability should be
| highway | surface | bothw |
| cycleway | | 48 s |
| path | | 60 s |
| track | | 60 s |
| track | asphalt | 60 s |
| path | asphalt | 60 s |
| highway | surface | bothw |
| cycleway | | 48 s |
| path | | 55.3 s |
| track | | 60 s |
| track | asphalt | 60 s |
| path | asphalt | 55.4 s |
Scenario: Bicycle - Surfaces should not make unknown ways routable
Then routability should be

View File

@ -37,6 +37,6 @@ Feature: Turn Penalties
| from | to | distance | weight | # |
| a | c | 900m +- 1 | 216 | Going straight has no penalties |
| a | d | 900m +- 1 | 220.2 | Turning right had penalties |
| e | g | 2100m +- 4| 503.9 | Going straght has no penalties |
| e | h | 2100m +- 4| 515.1 | Turn sharp right has even higher penalties|
| e | g | 2100m +- 5| 503.9 | Going straght has no penalties |
| e | h | 2100m +- 5| 515.1 | Turn sharp right has even higher penalties|

View File

@ -185,7 +185,7 @@ Feature: Car - Restricted access
Then routability should be
| highway | hov | bothw | forw_rate | backw_rate |
| primary | designated | x | 18.2 | 18.2 |
| primary | yes | x | 18.2 | 18.2 |
| primary | yes | x | 18.3 | 18.3 |
| primary | no | x | 18.2 | 18.2 |
# Models:
@ -196,7 +196,7 @@ Feature: Car - Restricted access
Then routability should be
| highway | hov | hov:lanes | lanes | access | oneway | forw | backw | forw_rate |
| motorway | designated | designated\|designated\|designated | 3 | hov | yes | x | | 25 |
| motorway | lane | | 3 | designated | yes | x | | 25 |
| motorway | lane | | 3 | designated | yes | x | | 25.3 |
@hov
Scenario: Car - a way with all lanes HOV-designated is highly penalized by default (similar to hov=designated)
@ -206,7 +206,7 @@ Feature: Car - Restricted access
# This test is flaky because non-deterministic turn generation sometimes emits a NoTurn here that is marked as restricted. #3769
#| primary | | designated | | | x | x | 18.2 | 18.2 |
#| primary | designated | | | | x | x | 18.2 | 18.2 |
| primary | designated\|designated | designated\|designated | | | x | x | 18.2 | 18.2 |
| primary | designated\|designated | designated\|designated | | | x | x | 18.3 | 18.3 |
| primary | designated\|no | designated\|no | | | x | x | 18.2 | 18.2 |
| primary | yes\|no | yes\|no | | | x | x | 18.2 | 18.2 |
| primary | | | | | x | x | 18.2 | 18.2 |

View File

@ -46,6 +46,18 @@ Feature: Car - Barriers
| bollard | rising | x |
| bollard | removable | |
# https://github.com/Project-OSRM/osrm-backend/issues/5996
Scenario: Car - Kerb exception for barriers
Then routability should be
| node/barrier | node/highway | node/kerb | bothw |
| kerb | | | |
| kerb | crossing | | x |
| kerb | crossing | yes | x |
| kerb | | lowered | x |
| kerb | | flush | x |
| kerb | | raised | |
| kerb | | yes | |
Scenario: Car - Height restrictions
Then routability should be
| node/barrier | node/maxheight | bothw |

View File

@ -387,217 +387,37 @@ Feature: Car - Turn restrictions
| m | p | mj,jp,jp |
@no_turning @conditionals
Scenario: Car - only_right_turn
Scenario: Car - Multiple conditional restrictions applicable to same turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
a
d j b
c
j
|
k - l - m
|
n
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
| nodes |
| kl |
| jl |
| ln |
| lm |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
| restriction | kl | lj | l | only_left_turn @ (Sa-Su 07:00-10:30) |
| restriction | kl | ln | l | only_right_turn @ (Mo-Fr 07:00-10:30) |
When I route I should get
| from | to | route |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,aj,aj,jd,jd |
| k | m | kl,ln,ln,lm,lm |
@no_turning @conditionals
Scenario: Car - No right turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get
| from | to | route | # |
| b | c | bj,jc,jc | normal turn |
| b | a | bj,jc,jc,aj,aj | avoids right turn |
| b | d | bj,jd,jd | normal maneuver |
@only_turning @conditionals
Scenario: Car - only_left_turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get
| from | to | route |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jc,jc,jd,jd |
@no_turning @conditionals
Scenario: Car - No left turn
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get
| from | to | route |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
Given the extract extra arguments "--parse-conditional-restrictions"
# time stamp for 10am on Tues, 02 May 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get
| from | to | route |
| b | c | bj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
Given the extract extra arguments "--parse-conditional-restrictions"
# 10am utc, wed
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map
"""
a
d j b
c
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get
| from | to | route |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
# 5pm Wed 02 May, 2017 GMT
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
Given the node map
"""
a
p |
\ |
j
| \
c m
"""
And the ways
| nodes | oneway |
| aj | no |
| jc | no |
| jp | yes |
| mj | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get
| from | to | route |
| a | p | aj,jc,jc,jp,jp |
| m | p | mj,jp,jp |
@restriction-way
Scenario: Car - prohibit turn
@ -719,7 +539,7 @@ Feature: Car - Turn restrictions
When I route I should get
| from | to | route | turns |
| a | e | cap south,florida nw,florida nw,florida ne | depart,turn right,continue uturn,arrive |
| f | d | cap north,florida nw,florida nw | depart,turn left,arrive |
| f | d | cap north,florida nw,florida nw | depart,turn left,arrive |
| e | c | florida ne,florida nw,cap south,cap south | depart,continue uturn,turn right,arrive |
@no_turning @conditionals
@ -796,8 +616,8 @@ Feature: Car - Turn restrictions
| nodes | name |
| ab | albic |
| bc | albic |
| db | dobe |
| be | dobe |
| db | dobe |
| be | dobe |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
@ -1047,7 +867,7 @@ Feature: Car - Turn restrictions
| type | way:from | node:via | way:to | restriction:conditional |
| restriction | be | e | de | no_right_turn @ (Mo-Fr 07:00-11:00) |
# node restrictino is off, way restriction is on
# node restriction is off, way restriction is on
When I route I should get
| from | to | route | turns | locations |
| a | d | ab,be,ef,ef,de,de | depart,turn right,turn left,continue uturn,new name straight,arrive | a,b,e,f,e,d |

View File

@ -7,10 +7,10 @@ Feature: Car - Destination only, no passing through
Scenario: Car - Destination only street
Given the node map
"""
a e
b c d
a e
b1 c 2d
x y
x y
"""
And the ways
@ -23,21 +23,21 @@ Feature: Car - Destination only, no passing through
When I route I should get
| from | to | route |
| a | b | ab,ab |
| a | c | ab,bcd |
| a | d | ab,bcd,bcd |
| a | c | ab,bcd,bcd |
| a | 2 | ab,bcd,bcd |
| a | e | axye,axye |
| e | d | de,de |
| e | c | de,bcd |
| e | b | de,bcd,bcd |
| e | c | de,bcd,bcd |
| e | 1 | de,bcd,bcd |
| e | a | axye,axye |
Scenario: Car - Destination only street
Given the node map
"""
a e
b c d
a e
b1 c 2d
x y
x y
"""
And the ways
@ -51,12 +51,12 @@ Feature: Car - Destination only, no passing through
When I route I should get
| from | to | route |
| a | b | ab,ab |
| a | c | ab,bc |
| a | d | ab,cd |
| a | c | ab,bc,bc |
| a | 2 | ab,bc,cd |
| a | e | axye,axye |
| e | d | de,de |
| e | c | de,cd |
| e | b | de,bc |
| e | c | de,cd,cd |
| e | 1 | de,cd,bc |
| e | a | axye,axye |
Scenario: Car - Routing inside a destination only area
@ -117,6 +117,7 @@ Feature: Car - Destination only, no passing through
+ \
+ |
d |
1 |
\___e
"""
@ -129,7 +130,7 @@ Feature: Car - Destination only, no passing through
When I route I should get
| from | to | route |
| e | a | acbe,acbe |
| d | a | de,acbe,acbe |
| 1 | a | de,acbe,acbe |
| c | d | cd,cd |
Scenario: Car - Routing through a parking lot tagged access=destination,service

View File

@ -46,10 +46,10 @@ Feature: Car - Handle ferry routes
When I route I should get
| from | to | route | modes | speed | time |
| a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.4s |
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.4s |
| c | e | cde,cde | ferry,ferry | 5 km/h | 151.4s |
| e | c | cde,cde | ferry,ferry | 5 km/h | 151.4s |
| a | g | abc,cde,efg,efg | driving,ferry,driving,driving | 12 km/h | 173.5s |
| b | f | abc,cde,efg,efg | driving,ferry,driving,driving | 9 km/h | 162.5s |
| c | e | cde,cde | ferry,ferry | 5 km/h | 151.5s |
| e | c | cde,cde | ferry,ferry | 5 km/h | 151.5s |
Scenario: Car - Properly handle simple durations
Given the node map
@ -109,3 +109,12 @@ Feature: Car - Handle ferry routes
When I route I should get
| from | to | route | modes | time |
| c | d | bcde,bcde | ferry,ferry | 600s |
Given the query options
| geometries | geojson |
| overview | full |
# Note that matching *should* work across unsnappable ferries
When I match I should get
| trace | geometry | duration |
| abcdef| 1,1,1.000898,1,1.000898,1,1.002695,1,1.002695,1,1.003594,1,1.003594,1,1.005391,1,1.005391,1,1.006289,1 | 611 |

View File

@ -86,54 +86,79 @@ OSRM will use 4/5 of the projected free-flow speed.
Then routability should be
| highway | maxspeed | width | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 |
| primary | | 3 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 |
| primary | 60 | 3 | | | 47 km/h | 47 km/h | 6.7 | 6.7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 |
| primary | | 3 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 |
| primary | | 3 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 |
| primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 |
| primary | 60 | 3 | | | 48 km/h | 48 km/h | 6.7 | 6.7 |
| primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 |
| primary | | 3 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 |
| primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 |
| primary | | 3 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 |
| primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 |
| primary | 15 | 3 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 |
| primary | 15 | 3 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 |
| primary | 15 | 3 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 |
| primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 |
| primary | 15 | 3 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 |
| primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 |
| primary | 15 | 3 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 |
Scenario: Car - Single lane streets be ignored or incur a penalty
Then routability should be
| highway | maxspeed | lanes | maxspeed:forward | maxspeed:backward | forw | backw | forw_rate | backw_rate |
| primary | | | | | 64 km/h | 64 km/h | 18 | 18 |
| primary | | | | | 64 km/h | 64 km/h | 18.1 | 18.1 |
| primary | | 1 | | | 64 km/h | 64 km/h | 9 | 9 |
| primary | 60 | | | | 47 km/h | 47 km/h | 13.3 | 13.3 |
| primary | 60 | 1 | | | 47 km/h | 47 km/h | 6.7 | 6.7 |
| primary | | | 60 | | 47 km/h | 64 km/h | 13.3 | 18 |
| primary | | 1 | 60 | | 47 km/h | 64 km/h | 6.7 | 9 |
| primary | | | | 60 | 64 km/h | 47 km/h | 18 | 13.3 |
| primary | | 1 | | 60 | 64 km/h | 47 km/h | 9 | 6.7 |
| primary | 15 | | 60 | | 47 km/h | 11 km/h | 13.3 | 3.3 |
| primary | 60 | | | | 48 km/h | 48 km/h | 13.3 | 13.3 |
| primary | 60 | 1 | | | 48 km/h | 48 km/h | 6.7 | 6.7 |
| primary | | | 60 | | 48 km/h | 64 km/h | 13.3 | 18.1 |
| primary | | 1 | 60 | | 48 km/h | 64 km/h | 6.7 | 9 |
| primary | | | | 60 | 64 km/h | 48 km/h | 18.1 | 13.3 |
| primary | | 1 | | 60 | 64 km/h | 48 km/h | 9 | 6.7 |
| primary | 15 | | 60 | | 48 km/h | 12 km/h | 13.3 | 3.3 |
| primary | 15 | 1 | 60 | | 48 km/h | 12 km/h | 6.7 | 1.7 |
| primary | 15 | | | 60 | 12 km/h | 47 km/h | 3.3 | 13.3 |
| primary | 15 | 1 | | 60 | 12 km/h | 47 km/h | 1.7 | 6.7 |
| primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | 6.7 | 13.3 |
| primary | 15 | 1 | 30 | 60 | 23 km/h | 47 km/h | 3.3 | 6.7 |
| primary | 15 | | | 60 | 12 km/h | 48 km/h | 3.3 | 13.3 |
| primary | 15 | 1 | | 60 | 12 km/h | 48 km/h | 1.7 | 6.7 |
| primary | 15 | | 30 | 60 | 24 km/h | 48 km/h | 6.7 | 13.3 |
| primary | 15 | 1 | 30 | 60 | 24 km/h | 48 km/h | 3.3 | 6.7 |
Scenario: Car - Single lane streets only incur a penalty for two-way streets
Then routability should be
| highway | maxspeed | lanes | oneway | forw | backw | forw_rate | backw_rate |
| primary | 30 | 1 | yes | 23 km/h | | 6.7 | |
| primary | 30 | 1 | -1 | | 23 km/h | | 6.7 |
| primary | 30 | 1 | | 23 km/h | 23 km/h | 3.3 | 3.3 |
| primary | 30 | 2 | | 23 km/h | 23 km/h | 6.7 | 6.7 |
| primary | 30 | 1 | yes | 24 km/h | | 6.7 | |
| primary | 30 | 1 | -1 | | 24 km/h | | 6.7 |
| primary | 30 | 1 | | 24 km/h | 24 km/h | 3.3 | 3.3 |
| primary | 30 | 2 | | 24 km/h | 24 km/h | 6.7 | 6.7 |
Scenario: Car - Forward/backward maxspeed on reverse oneways
Then routability should be
| highway | maxspeed | maxspeed:forward | maxspeed:backward | oneway | forw | backw | forw_rate | backw_rate |
| primary | | | | -1 | | 64 km/h | | 18 |
| primary | 30 | | | -1 | | 23 km/h | | 6.7 |
| primary | | 30 | | -1 | | 64 km/h | | 18 |
| primary | | | 30 | -1 | | 23 km/h | | 6.7 |
| primary | 20 | 30 | | -1 | | 15 km/h | | 4.4 |
| primary | 20 | | 30 | -1 | | 23 km/h | | 6.7 |
| primary | | | | -1 | | 64 km/h | | 18.1 |
| primary | 30 | | | -1 | | 24 km/h | | 6.7 |
| primary | | 30 | | -1 | | 64 km/h | | 18.1 |
| primary | | | 30 | -1 | | 24 km/h | | 6.7 |
| primary | 20 | 30 | | -1 | | 16 km/h | | 4.4 |
| primary | 20 | | 30 | -1 | | 24 km/h | | 6.7 |
Scenario: Car - Respect source:maxspeed
Given the node map
"""
a b c d e f g
"""
And the ways
| nodes | highway | source:maxspeed | maxspeed |
| ab | trunk | | |
| bc | trunk | | 60 |
| cd | trunk | FR:urban | |
| de | trunk | CH:rural | |
| ef | trunk | CH:trunk | |
| fg | trunk | CH:motorway | |
When I route I should get
| from | to | route | speed |
| a | b | ab,ab | 85 km/h |
| b | c | bc,bc | 48 km/h |
| c | d | cd,cd | 40 km/h |
| d | e | de,de | 64 km/h |
| e | f | ef,ef | 80 km/h |
| f | g | fg,fg | 96 km/h |

File diff suppressed because it is too large Load Diff

View File

@ -43,8 +43,29 @@ Feature: Car - Handle physical limitation
| primary | 1 | | |
| primary | 3 | | x |
| primary | | 1 | |
| primary | | 8' | x |
| primary | | 3 | x |
| primary | | default | x |
| primary | | none | x |
| primary | | no-sign | x |
| primary | | unsigned | x |
Scenario: Car - Limited by length
Then routability should be
| highway | maxlength | bothw |
| primary | | x |
| primary | 1 | |
| primary | 5 | x |
| primary | unsigned | x |
Scenario: Car - Limited by weight
Then routability should be
| highway | maxweight | bothw |
| primary | | x |
| primary | 1 | |
| primary | 2 | x |
| primary | 3.5 | x |
| primary | 35000 kg | x |
| primary | 8.9t | x |
| primary | 0.1 lbs | |
| primary | unsigned | x |

View File

@ -115,6 +115,36 @@ Feature: Car - Turn restrictions
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@no_turning
Scenario: Car - No u-turn
# https://www.openstreetmap.org/edit?node=54878482#map=19/34.05242/-117.19067
Given the node map
"""
c
3
a 1 x 2 b
4
d
"""
And the ways
| nodes |
| ax |
| xb |
| cx |
| xd |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ax | ax | x | no_u_turn |
| restriction | bx | bx | x | no_u_turn |
| restriction | cx | cx | x | no_u_turn |
| restriction | dx | dx | x | no_u_turn |
When I route I should get
| waypoints | route | turns |
| a,x,a | ax,xb,xb,xb,ax,ax | depart,new name straight,continue uturn,arrive,depart,arrive |
@no_turning
Scenario: Car - Handle any no_* relation
Given the node map
@ -411,7 +441,7 @@ Feature: Car - Turn restrictions
y
i j f b x a e g h
c d
c1 d
"""
And the ways
@ -438,7 +468,7 @@ Feature: Car - Turn restrictions
When I route I should get
| from | to | route |
| e | f | ae,xa,bx,fb,fb |
| c | f | dc,da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
| 1 | f | dc,da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
| d | f | da,ae,ge,hg,hg,ge,ae,xa,bx,fb,fb |
@except
@ -798,82 +828,6 @@ Feature: Car - Turn restrictions
| from | to | route |
| a | d | ab,be,de,de |
@restriction-way
Scenario: Multi Way restriction
Given the node map
"""
k j
| |
h - - g - f - - e
| |
| |
a - - b - c - - d
| |
l i
"""
And the ways
| nodes | name | oneway |
| ab | horiz | yes |
| bc | horiz | yes |
| cd | horiz | yes |
| ef | horiz | yes |
| fg | horiz | yes |
| gh | horiz | yes |
| ic | vert | yes |
| cf | vert | yes |
| fj | vert | yes |
| kg | vert | yes |
| gb | vert | yes |
| bl | vert | yes |
And the relations
| type | way:from | way:via | way:to | restriction |
| restriction | ab | bc,cf,fg | gh | no_u_turn |
When I route I should get
| from | to | route |
| a | h | horiz,vert,horiz,horiz |
@restriction-way
Scenario: Multi-Way overlapping single-way
Given the node map
"""
e
|
a - b - c - d
|
f - g
|
h
"""
And the ways
| nodes | name |
| ab | abcd |
| bc | abcd |
| cd | abcd |
| hf | hfb |
| fb | hfb |
| gf | gf |
| ce | ce |
And the relations
| type | way:from | way:via | way:to | restriction |
| restriction | ab | bc | ce | only_left_turn |
| restriction | gf | fb,bc | cd | only_u_turn |
When I route I should get
| from | to | route | turns | locations |
| a | d | abcd,ce,ce,abcd,abcd | depart,turn left,continue uturn,turn left,arrive | a,c,e,c,d |
| a | e | abcd,ce,ce | depart,turn left,arrive | a,c,e |
| a | f | abcd,hfb,hfb | depart,turn right,arrive | a,b,f |
| g | e | gf,hfb,abcd,ce,ce | depart,turn right,turn right,turn left,arrive | g,f,b,c,e |
| g | d | gf,hfb,abcd,abcd | depart,turn right,turn right,arrive | g,f,b,d |
| h | e | hfb,abcd,ce,ce | depart,end of road right,turn left,arrive | h,b,c,e |
| h | d | hfb,abcd,abcd | depart,end of road right,arrive | h,b,d |
@restriction-way
Scenario: Car - prohibit turn, traffic lights
Given the node map
@ -984,8 +938,6 @@ Feature: Car - Turn restrictions
| restriction | ab | bge | de | no_right_turn |
| restriction | bc | bge | ef | no_left_turn |
# this case is currently not handling the via-way restrictions and we need support for looking across traffic signals.
# It is mainly included to show limitations and to prove that we don't crash hard here
When I route I should get
| from | to | route |
| a | d | ab,bge,ef,ef,de,de |
@ -1086,3 +1038,123 @@ Feature: Car - Turn restrictions
| from | to | route |
| d | x | bd,abc,xa,xa |
| d | z | bd,abc,cz,cz |
Scenario: Multiple restricted entrances
Given the node map
"""
b
|
a----e----c
|
d
"""
And the ways
| nodes |
| ae |
| be |
| ce |
| de |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ae,be | ed | e | no_entry |
When I route I should get
| from | to | route |
| a | d | ae,ce,ce,de,de |
| b | d | be,ce,ce,de,de |
| c | d | ce,de,de |
Scenario: Multiple restricted exits
Given the node map
"""
b
|
a----e----c
|
d
"""
And the ways
| nodes |
| ae |
| be |
| ce |
| de |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ae | ce,de | e | no_exit |
When I route I should get
| from | to | route |
| a | b | ae,be,be |
| a | c | ae,be,be,ce,ce |
| a | d | ae,be,be,de,de |
Scenario: Invalid restricted entrances/exits
Given the node map
"""
b
|
a----e----c
|
d
"""
And the ways
| nodes |
| ae |
| be |
| ce |
| de |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ae | ce,de | e | no_entry |
| restriction | ae,be | ed | e | no_exit |
When I route I should get
| from | to | route |
| a | b | ae,be,be |
| a | c | ae,ce,ce |
| a | d | ae,de,de |
| b | d | be,de,de |
| c | d | ce,de,de |
Scenario: Invalid multi from/to restrictions
Given the node map
"""
b
|
a----e----c
|
d
"""
And the ways
| nodes |
| ae |
| be |
| ce |
| de |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | ae,de | ce,de | e | no_right_turn |
| restriction | ae,be | ce,de | e | no_straight_on |
| restriction | ae,be | be,ce | e | only_left_turn |
| restriction | ae,be | ce,de | e | only_straight_on |
When I route I should get
| from | to | route |
| a | b | ae,be,be |
| a | c | ae,ce,ce |
| a | d | ae,de,de |
| b | d | be,de,de |
| c | d | ce,de,de |

View File

@ -9,29 +9,29 @@ Feature: Car - speeds
Scenario: Car - speed of various way types
Then routability should be
| highway | oneway | bothw |
| motorway | no | 89 km/h |
| motorway_link | no | 44 km/h |
| trunk | no | 85 km/h |
| trunk_link | no | 39 km/h |
| motorway | no | 90 km/h |
| motorway_link | no | 45 km/h |
| trunk | no | 84 km/h |
| trunk_link | no | 40 km/h |
| primary | no | 64 km/h |
| primary_link | no | 29 km/h |
| secondary | no | 55 km/h |
| secondary_link | no | 24 km/h |
| tertiary | no | 39 km/h |
| primary_link | no | 30 km/h |
| secondary | no | 54 km/h |
| secondary_link | no | 25 km/h |
| tertiary | no | 40 km/h |
| tertiary_link | no | 20 km/h |
| unclassified | no | 24 km/h |
| residential | no | 24 km/h |
| living_street | no | 9 km/h |
| unclassified | no | 25 km/h |
| residential | no | 25 km/h |
| living_street | no | 10 km/h |
| service | no | 15 km/h |
# Alternating oneways scale rates but not speeds
Scenario: Car - scaled speeds for oneway=alternating
Then routability should be
| highway | oneway | junction | forw | backw | # |
| tertiary | | | 39 km/h | 39 km/h | |
| tertiary | alternating | | 39 km/h | 39 km/h | |
| motorway | | | 89 km/h | | implied oneway |
| motorway | alternating | | 89 km/h | | implied oneway |
| tertiary | | | 40 km/h | 40 km/h | |
| tertiary | alternating | | 40 km/h | 40 km/h | |
| motorway | | | 90 km/h | | implied oneway |
| motorway | alternating | | 90 km/h | | implied oneway |
| motorway | reversible | | | | unroutable |
| primary | | roundabout | 64 km/h | | implied oneway |
| primary | alternating | roundabout | 64 km/h | | implied oneway |
@ -42,12 +42,12 @@ Feature: Car - speeds
| highway | maxspeed | forw | backw |
| primary | | 64 km/h | 64 km/h |
| primary | 60 | 47 km/h | 47 km/h |
| primary | 60 | 47 km/h | 47 km/h |
| primary | 60 | 47 km/h | 47 km/h |
| primary | 60 | 48 km/h | 48 km/h |
| primary | 60 | 48 km/h | 48 km/h |
| primary | 60 | 48 km/h | 48 km/h |
Scenario: Car - Side road penalties
Then routability should be
| highway | side_road | forw | backw | forw_rate | backw_rate |
| primary | yes | 64 km/h | 64 km/h | 14.4 | 14.4 |
| primary | yes | 64 km/h | 64 km/h | 14.5 | 14.5 |

View File

@ -35,3 +35,91 @@ Feature: Car - Allowed start/end modes
| from | to | route | modes |
| 1 | 2 | ab,ab | driving,driving |
| 2 | 1 | ab,ab | driving,driving |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I request a travel time matrix I should get
| | 2 | c |
| 1 | 59.1 | 35.2 |
| b | 35 | 11.1 |
When I route I should get
| from | to | route |
| 1 | 2 | ab,bc,cd |
| 2 | 1 | cd,bc,ab |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
| bearings | 90,180; |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I route I should get
| from | to | route |
| 1 | 2 | ab,bc,cd |
| 2 | 1 | cd,bc,ab |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
| radiuses | 100;unlimited |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I route I should get
| from | to | route |
| 1 | 2 | ab,bc,cd |
| 2 | 1 | cd,bc,ab |
Scenario: Car - URL override of non-startpoints
Given the node map
"""
a 1 b c 2 d
"""
Given the query options
| snapping | any |
| bearings | 90,180;0,180;; |
And the ways
| nodes | highway | access |
| ab | service | private |
| bc | primary | |
| cd | service | private |
When I request a travel time matrix I should get
| | 2 | c |
| 1 | 59.1 | 35.2 |
| b | 35 | 11.1 |

View File

@ -65,7 +65,7 @@ Feature: Car - Surfaces
Then routability should be
| highway | oneway | surface | forw | backw |
| motorway | no | | 90 km/h | 90 km/h |
| motorway | no | asphalt | 90 km/h | 90 km/h +-1 |
| motorway | no | asphalt | 91 km/h | 90 km/h +-1 |
| motorway | no | concrete | 90 km/h +-1 | 90 km/h +-1 |
| motorway | no | concrete:plates | 90 km/h +-1 | 90 km/h +-1 |
| motorway | no | concrete:lanes | 90 km/h +-1 | 90 km/h +-1 |

View File

@ -32,14 +32,172 @@ Feature: Car - Handle traffic lights
| l | traffic_signals |
When I route I should get
| from | to | time | # |
| from | to | time | # |
| 1 | 2 | 11.1s | no turn with no traffic light |
| 3 | 4 | 13.1s | no turn with traffic light |
| g | j | 18.7s | turn with no traffic light |
| k | n | 20.7s | turn with traffic light |
Scenario: Tarrif Signal Geometry
Scenario: Car - Traffic signal direction straight
Given the node map
"""
a-1-b-2-c
d-3-e-4-f
g-5-h-6-i
j-7-k-8-l
"""
And the ways
| nodes | highway |
| abc | primary |
| def | primary |
| ghi | primary |
| jkl | primary |
And the nodes
| node | highway | traffic_signals:direction |
| e | traffic_signals | |
| h | traffic_signals | forward |
| k | traffic_signals | backward |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 11.1s | 11.1 | no turn with no traffic light |
| 2 | 1 | 11.1s | 11.1 | no turn with no traffic light |
| 3 | 4 | 13.1s | 13.1 | no turn with traffic light |
| 4 | 3 | 13.1s | 13.1 | no turn with traffic light |
| 5 | 6 | 13.1s | 13.1 | no turn with traffic light |
| 6 | 5 | 11.1s | 11.1 | no turn with no traffic light |
| 7 | 8 | 11.1s | 11.1 | no turn with no traffic light |
| 8 | 7 | 13.1s | 13.1 | no turn with traffic light |
Scenario: Car - Traffic signal direction with distance weight
Given the profile file "car" initialized with
"""
profile.properties.weight_name = 'distance'
profile.properties.traffic_light_penalty = 100000
"""
Given the node map
"""
a---b---c
1 2
| |
| |
| |
| |
| |
d-------f
"""
And the ways
| nodes | highway |
| abc | primary |
| adfc | primary |
And the nodes
| node | highway |
| b | traffic_signals |
When I route I should get
| from | to | time | distances | weight | # |
| 1 | 2 | 100033.2s | 599.9m,0m | 599.8 | goes via the expensive traffic signal |
Scenario: Car - Encounters a traffic light direction
Given the node map
"""
a f k p
| | | |
b-c-d h-g-i l-m-n q-r-s
| | | |
e j o t
"""
And the ways
| nodes | highway |
| bcd | primary |
| ace | primary |
| hgi | primary |
| fgj | primary |
| lmn | primary |
| kmo | primary |
| qrs | primary |
| prt | primary |
And the nodes
| node | highway | traffic_signals:direction |
| g | traffic_signals | |
| m | traffic_signals | forward |
| r | traffic_signals | backward |
When I route I should get
# Base case
| from | to | time | # |
| a | b | 18.7s | turn with no traffic light |
| a | e | 22.2s | no turn with no traffic light |
| a | d | 21.9s | turn with no traffic light |
| e | b | 21.9s | turn with no traffic light |
| e | a | 22.2s | no turn with no traffic light |
| e | d | 18.7s | turn with no traffic light |
| d | e | 21.9s | turn with no traffic light |
| d | b | 11s | no turn with no traffic light |
| d | a | 18.7s | turn with no traffic light |
| b | a | 21.9s | turn with no traffic light |
| b | d | 11s | no turn with no traffic light |
| b | e | 18.7s | turn with no traffic light |
# All have traffic lights - 2s penalty
| f | h | 20.7s | turn with traffic light |
| f | j | 24.2s | no turn with traffic light |
| f | i | 23.9s | turn with traffic light |
| j | h | 23.9s | turn with traffic light |
| j | f | 24.2s | no turn with traffic light |
| j | i | 20.7s | turn with traffic light |
| i | j | 23.9s | turn with traffic light |
| i | h | 13s | no turn with traffic light |
| i | f | 20.7s | turn with traffic light |
| h | f | 23.9s | turn with traffic light |
| h | i | 13s | no turn with traffic light |
| h | j | 20.7s | turn with traffic light |
# Front direction have traffic lights - 2s penalty
| k | l | 20.7s | turn with traffic light |
| k | o | 24.2s | no turn with traffic light |
| k | n | 23.9s | turn with traffic light |
| o | l | 21.9s | turn with no traffic light |
| o | k | 22.2s | no turn with no traffic light |
| o | n | 18.7s | turn with no traffic light |
| n | o | 21.9s | turn with no traffic light |
| n | l | 11s | no turn with no traffic light |
| n | k | 18.7s | turn with no traffic light |
| l | k | 23.9s | turn with traffic light |
| l | n | 13s | no turn with traffic light |
| l | o | 20.7s | turn with traffic light |
# Reverse direction have traffic lights - 2s penalty
| p | q | 18.7s | turn with no traffic light |
| p | t | 22.2s | no turn with no traffic light |
| p | s | 21.9s | turn with no traffic light |
| t | q | 23.9s | turn with traffic light |
| t | p | 24.2s | no turn with traffic light |
| t | s | 20.7s | turn with traffic light |
| s | t | 23.9s | turn with traffic light |
| s | q | 13s | no turn with traffic light |
| s | p | 20.7s | turn with traffic light |
| q | p | 21.9s | turn with no traffic light |
| q | s | 11s | no turn with no traffic light |
| q | t | 18.7s | turn with no traffic light |
Scenario: Traffic Signal Geometry
Given the query options
| overview | full |
| geometries | polyline |
@ -59,7 +217,54 @@ Feature: Car - Handle traffic lights
When I route I should get
| from | to | route | geometry |
| a | c | abc,abc | _ibE_ibE?gJ?gJ |
| a | c | abc,abc | _ibE_ibE?gJ?eJ |
Scenario: Traffic Signal Geometry - forward signal
Given the query options
| overview | full |
| geometries | polyline |
Given the node map
"""
a - b - c
"""
And the ways
| nodes | highway |
| abc | primary |
And the nodes
| node | highway | traffic_signals:direction |
| b | traffic_signals | forward |
When I route I should get
| from | to | route | geometry |
| a | c | abc,abc | _ibE_ibE?gJ?eJ |
Scenario: Traffic Signal Geometry - reverse signal
Given the query options
| overview | full |
| geometries | polyline |
Given the node map
"""
a - b - c
"""
And the ways
| nodes | highway |
| abc | primary |
And the nodes
| node | highway | traffic_signals:direction |
| b | traffic_signals | reverse |
When I route I should get
| from | to | route | geometry |
| a | c | abc,abc | _ibE_ibE?gJ?eJ |
@traffic
Scenario: Traffic update on the edge with a traffic signal
@ -89,5 +294,172 @@ Feature: Car - Handle traffic lights
When I route I should get
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
| a | c | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| c | a | abc,abc | 59 km/h | 24.2,0 | 24.2s | 399.9m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| a | c | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
@traffic
Scenario: Traffic update on the edge with a traffic signal - forward
Given the node map
"""
a - b - c
"""
And the ways
| nodes | highway |
| abc | primary |
And the nodes
| node | highway | traffic_signals:direction |
| b | traffic_signals | forward |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,65
2,1,65
"""
And the query options
| annotations | datasources,nodes,speed,duration,weight |
When I route I should get
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
| a | c | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| c | a | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
@traffic
Scenario: Traffic update on the edge with a traffic signal - backward
Given the node map
"""
a - b - c
"""
And the ways
| nodes | highway |
| abc | primary |
And the nodes
| node | highway | traffic_signals:direction |
| b | traffic_signals | backward |
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
1,2,65
2,1,65
"""
And the query options
| annotations | datasources,nodes,speed,duration,weight |
When I route I should get
| from | to | route | speed | weights | time | distances | a:datasources | a:nodes | a:speed | a:duration | a:weight |
| a | c | abc,abc | 65 km/h | 22.2,0 | 22.2s | 400m,0m | 1:0 | 1:2:3 | 18:18 | 11.1:11.1 | 11.1:11.1 |
| c | a | abc,abc | 60 km/h | 24.2,0 | 24.2s | 400m,0m | 0:1 | 3:2:1 | 18:18 | 11.1:11.1 | 11.1:11.1 |
Scenario: Car - Traffic signal straight direction with edge compression
Given the node map
"""
a-1-b - c - d-2-e
"""
And the ways
| nodes | highway |
| abcde | primary |
And the nodes
| node | highway | traffic_signals:direction |
| c | traffic_signals | forward |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 35.3s | 35.3 | no turn with traffic light |
| 2 | 1 | 33.3s | 33.3 | no turn with no traffic light |
Scenario: Car - Traffic signal turn direction with edge compression
Given the node map
"""
d
|
2
|
a-1-b - c - f
|
e
j
|
4
|
g-3-h - i - k
|
l
"""
And the ways
| nodes | highway |
| abc | primary |
| cf | primary |
| fd | primary |
| fe | primary |
| ghi | primary |
| ik | primary |
| kj | primary |
| kl | primary |
And the nodes
| node | highway | traffic_signals:direction |
| k | traffic_signals | forward |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 44.2s | 44.2 | turn with no traffic light |
| 2 | 1 | 41s | 41 | turn with no traffic light |
| 3 | 4 | 46.2s | 46.2 | turn with traffic light |
| 4 | 3 | 41s | 41 | turn with no traffic light |
Scenario: Car - Traffic signal turn direction with turn restriction
Given the node map
"""
d
|
2
|
a-1-b - c - f
|
e
"""
And the ways
| nodes | highway |
| abc | primary |
| cf | primary |
| fd | primary |
| fe | primary |
And the nodes
| node | highway | traffic_signals:direction |
| f | traffic_signals | forward |
And the relations
| type | way:from | way:to | way:via | restriction |
| restriction | abc | fe | cf | no_right_turn |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | df | fc | f | right_turn_only |
When I route I should get
| from | to | time | weight | # |
| 1 | 2 | 46.2s | 46.2 | turn with traffic light |
| 2 | 1 | 41s | 41 | turn with no traffic light |

View File

@ -83,4 +83,4 @@ Feature: Car - weights
| waypoints | bearings | route | distance | weights | times |
| a,b | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| b,c | 90 90 | abc,abc | 200m | 200,0 | 11.1s,0s |
| a,d | 90 180 | abc,bd,bd | 399.9m | 200,200,0 | 13.2s,11.1s,0s |
| a,d | 90 180 | abc,bd,bd | 400m | 200,200,0 | 13.2s,11.1s,0s |

View File

@ -26,7 +26,15 @@ Feature: Foot - Access tags on ways
| motorway | no | | |
| motorway | no | yes | x |
| motorway | no | no | |
| platform | | | x |
| platform | | yes | x |
| platform | | no | |
| platform | yes | | x |
| platform | yes | yes | x |
| platform | yes | no | |
| platform | no | | |
| platform | no | yes | x |
| platform | no | no | |
Scenario: Foot - Overwriting implied acccess on ways
Then routability should be

View File

@ -19,7 +19,7 @@ Feature: Barriers
| entrance | x |
| wall | |
| fence | |
| some_tag | |
| some_tag | x |
| block | x |
Scenario: Foot - Access tag trumphs barriers

View File

@ -0,0 +1,31 @@
@routing @foot
Feature: Foot - Intersections
Background:
Given the profile "foot"
Given a grid size of 2 meters
# https://github.com/Project-OSRM/osrm-backend/issues/6218
Scenario: Foot - Handles non-planar intersections
Given the node map
"""
f
|
a
|
b---c---d
|
e
"""
And the ways
| nodes | highway | foot | layer |
| ac | footway | yes | 0 |
| bc | footway | yes | 0 |
| cd | footway | yes | 0 |
| cef | footway | yes | 1 |
When I route I should get
| from | to | route |
| a | d | ac,cd,cd |

View File

@ -20,3 +20,20 @@ Feature: Foot - Street names in instructions
When I route I should get
| from | to | route | ref |
| a | c | My Way,, | ,A7,A7 |
Scenario: Foot - Combines named roads with suffix changes
Given the node map
"""
a b c d
"""
And the ways
| nodes | name |
| ab | High Street W |
| bc | High Street E |
| cd | Market Street |
When I route I should get
| from | to | route |
| a | d | High Street W,Market Street,Market Street |

View File

@ -29,7 +29,7 @@ Feature: Foot - Turn restrictions
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | sj,nj,nj |
| s | n | sj,nj |
| s | e | sj,ej,ej |
@only_turning
@ -55,7 +55,7 @@ Feature: Foot - Turn restrictions
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | sj,nj,nj |
| s | n | sj,nj |
| s | e | sj,ej,ej |
@except

View File

@ -36,3 +36,9 @@ Feature: Foot - Accessability of different way types
| highway | leisure | forw |
| (nil) | track | x |
Scenario: Foot - Proposed ways
Then routability should be
| highway | foot | proposed | forw |
| footway | | | x |
| proposed | | | |
| proposed | yes | yes | |

View File

@ -103,7 +103,7 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:false slight left:true,straight:false slight right:true, |
| a,d | On,Hwy,Off,Off | depart,merge slight right,off ramp right,arrive | ,slight left:true slight left:true,straight:false slight right:true, |
@anticipate
@ -364,8 +364,8 @@ Feature: Turn Lane Guidance
When I route I should get
| waypoints | route | turns | lanes |
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:false straight:true straight:false straight:false right:false;left:false straight:true straight:false right:false,left:true right:false, |
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:false straight:false straight:true straight:false right:false;left:false straight:false straight:true right:false,left:false right:true, |
| a,d | main,left,left | depart,end of road left,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:true right:false, |
| a,e | main,right,right | depart,end of road right,arrive | ;left:false straight:true straight:true straight:true straight:true right:false;left:false straight:true straight:true right:false,left:false right:true, |
@anticipate
Scenario: Anticipate Lanes for through with turn before / after
@ -390,15 +390,15 @@ Feature: Turn Lane Guidance
| il | | il | |
When I route I should get
| waypoints | route | turns | lanes | # |
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:false right:false right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:false right:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:false right:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:false right:false right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:false left:false,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:false left:false left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:false left:false left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:false left:false;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
| waypoints | route | turns | lanes | # |
| a,f | ab,bdehi,ef,ef | depart,turn right,turn right,arrive | ,right:true right:true right:true right:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| a,g | ab,bdehi,eg,eg | depart,turn right,turn left,arrive | ,right:true right:true right:true right:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| a,j | ab,bdehi,ij,ij | depart,turn right,end of road right,arrive | ,right:true right:true right:true right:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | |
| a,l | ab,bdehi,il,il | depart,turn right,end of road left,arrive | ,right:true right:true right:true right:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | not perfect |
| c,g | cb,bdehi,eg,eg | depart,turn left,turn left,arrive | ,left:true left:true left:true left:true,left:true left:true straight:false straight:false straight:false straight:false right:false right:false, | |
| c,f | cb,bdehi,ef,ef | depart,turn left,turn right,arrive | ,left:true left:true left:true left:true,left:false left:false straight:false straight:false straight:false straight:false right:true right:true, | |
| c,l | cb,bdehi,il,il | depart,turn left,end of road left,arrive | ,left:true left:true left:true left:true;left:false left:false straight:true straight:true straight:false straight:false right:false right:false,left:true left:true right:false right:false, | |
| c,j | cb,bdehi,ij,ij | depart,turn left,end of road right,arrive | ,left:true left:true left:true left:true;left:false left:false straight:false straight:false straight:true straight:true right:false right:false,left:false left:false right:true right:true, | not perfect |
@anticipate
Scenario: Anticipate Lanes for turns with through before and after
@ -811,9 +811,9 @@ Feature: Turn Lane Guidance
| hj | 7th | | no |
When I route I should get
| waypoints | route | turns | locations | lanes |
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:false;none:true none:true right:false, |
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true;left:false none:false none:false none:true,none:false none:false right:true, |
| waypoints | route | turns | locations | lanes |
| a,i | road,road | depart,arrive | a,i | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;none:true none:true right:false, |
| a,j | road,7th,7th | depart,turn right,arrive | a,h,j | ;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:true none:true none:true;left:false none:false none:false none:true,none:false none:false right:true, |
@anticipate
Scenario: Oak St, Franklin St

View File

@ -67,3 +67,37 @@ Feature: Features related to bugs
When I route I should get
| waypoints | route | intersections |
| a,c | Pear to Merrit,Merritt to Apricot,Merritt to Apricot | true:0;true:0 false:180;true:180 |
# https://github.com/Project-OSRM/osrm-backend/issues/6373
Scenario: Segregated intersection with no second intersection turns
Given the node map
"""
a b
| |
c--d--e--f
| |
g--h--i--j
"""
And the ways
| nodes | oneway | lanes | turn:lanes |
| dc | yes | 4 | |
| ed | yes | 4 | |
| fe | yes | 3 | |
| gh | yes | 4 | left\|left\|through\|through;right |
| hi | yes | 2 | |
| ij | yes | 3 | |
| ie | yes | 4 | |
| eb | yes | 2 | |
| ad | yes | 4 | reverse\|right\|right\|right |
| dh | yes | | |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | dh | hi | h | no_left_turn |
And the data has been saved to disk
When I try to run "osrm-extract {osm_file} --profile {profile_file}"
Then it should exit successfully

View File

@ -1061,7 +1061,7 @@ Feature: Collapse
# i
# """
And the node locations
Given the node locations
| node | lat | lon | #id |
| a | -33.9644254 | 151.1378673 | 33226063 |
| b | -33.9644373 | 151.1377172 | 1072787030 |

View File

@ -687,7 +687,7 @@ Feature: Slipways and Dedicated Turn Lanes
When I route I should get
| waypoints | route | turns | locations |
| s,f | sabc,ae,dbef,dbef | depart,fork slight right,turn right,arrive | s,a,e,f |
| s,f | sabc,ae,dbef,dbef | depart,turn straight,turn right,arrive | s,a,e,f |
@sliproads
Scenario: Traffic Signal on Sliproad

View File

@ -230,3 +230,100 @@ Feature: Maneuver tag support
| waypoints | route | turns |
| z,t | NY Ave,395,395 | depart,on ramp left,arrive |
| z,b | NY Ave,,4th St,4th St | depart,on ramp left,fork slight right,arrive |
Scenario: Gracefully handles maneuvers that are redundant for the profile
Given the node map
"""
a--b---c---d----f
|
|
e
"""
And the ways
| nodes | name | oneway | highway |
| abc | A Street | no | primary |
| ce | B Street | no | construction |
| cdf | A Street | no | primary |
And the relations
| type | way:from | node:via | way:to | maneuver | direction |
| maneuver | abc | c | cdf | turn | slight_left |
When I route I should get
| waypoints | route | turns |
| a,f | A Street,A Street | depart,arrive |
Scenario: Handles uncompressed nodes in maneuver path
Given the node map
"""
a--b---c---f
| |
| |
g d---h
|
|
i-------e-------j
"""
And the ways
| nodes | name | oneway |
| abc | A Street | no |
| cf | B Street | no |
| cde | C Street | no |
| bg | D Street | no |
| dh | E Street | no |
| ei | F Street | no |
| ej | G Street | no |
And the relations
| type | way:from | node:via | way:via | way:to | maneuver | direction |
| maneuver | abc | e | cde | ei | turn | sharp_right |
When I route I should get
| waypoints | route | turns |
| a,i | A Street,C Street,F Street,F Street | depart,turn right,turn sharp right,arrive |
Scenario: Can be used with turn restrictions
Given the node map
"""
a---b---c
|
|
d
|
e---f
|
|
h------g---i
"""
And the ways
| nodes | name | oneway |
| ab | A Street | no |
| bc | B Street | no |
| bde | C Street | no |
| ef | D Street | no |
| eg | E Street | no |
| hg | F Street | no |
| gi | G Street | no |
And the relations
| type | way:from | node:via | way:to | maneuver | direction | # |
| maneuver | ab | b | bde | turn | sharp_right | ending on a turn restriction via way |
| maneuver | bde | e | ef | turn | sharp_left | starting on a turn restriction via way |
And the relations
| type | way:from | node:via | way:via | way:to | maneuver | direction | # |
| maneuver | cb | g | bde,eg | gi | turn | slight_left | turn restricted |
| maneuver | cb | g | bde,eg | hg | turn | slight_right | not turn restricted |
And the relations
| type | way:from | way:via | way:to | restriction |
| restriction | ab | bde,eg | hg | no_right_turn |
| restriction | bc | bde,eg | gi | no_left_turn |
When I route I should get
| waypoints | route | turns |
| a,e | A Street,C Street,C Street | depart,turn sharp right,arrive |
| b,f | C Street,D Street,D Street | depart,turn sharp left,arrive |
| c,h | B Street,E Street,F Street,F Street | depart,turn left,turn slight right,arrive |
| c,i | B Street,A Street,E Street,G Street,G Street | depart,turn uturn,turn right,end of road left,arrive |

View File

@ -64,7 +64,7 @@ Feature: Merge Segregated Roads
When I route I should get
| waypoints | route | intersections |
| a,f | road,road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315;true:90 false:225 true:315;true:270 |
| a,f | road,road,road | true:90,false:45 true:135 false:270;true:45 true:180 false:315,true:90 false:225 true:315;true:270 |
#https://www.openstreetmap.org/#map=19/52.50003/13.33915
@negative
@ -193,7 +193,7 @@ Feature: Merge Segregated Roads
When I route I should get
| waypoints | route | intersections |
| a,g | road,road | true:90,false:90 true:150 false:270,true:90 false:270 true:345;true:270 |
| a,g | road,road | true:90,false:90 true:165 false:270,true:90 false:270 true:345;true:270 |
Scenario: Merging parallel roads with intermediate bridges
# https://www.mapillary.com/app/?lat=52.466483333333336&lng=13.431908333333332&z=17&focus=photo&pKey=LWXnKqoGqUNLnG0lofiO0Q
@ -332,10 +332,11 @@ Feature: Merge Segregated Roads
|
.b.
c h
1 |
| 4
| |
| |
1 2
| |
2 |
| 3
d g
'e'
|
@ -354,13 +355,13 @@ Feature: Merge Segregated Roads
| hb | road | yes |
When I route I should get
| waypoints | turns | route | intersections |
| waypoints | turns | route | intersections |
| a,f | depart,arrive | road,road | true:180,false:0 true:180,false:0 true:180;true:0 |
| c,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
| 1,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
| 2,f | depart,arrive | bridge,road | true:180,false:0 true:180;true:0 |
| f,a | depart,arrive | road,road | true:0,true:0 false:180,true:0 false:180;true:180 |
| g,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
| 2,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
| 3,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
| 4,a | depart,arrive | bridge,road | true:0,true:0 false:180;true:180 |
@negative
Scenario: Traffic Circle

View File

@ -277,7 +277,7 @@ Feature: Simple Turns
When I route I should get
| from | to | route | turns |
| a | c | menz,rem | depart,arrive |
| d | c | rem,rem,rem | depart,continue left,arrive |
| d | c | rem,rem | depart,arrive |
| c | d | rem,rem,rem | depart,continue right,arrive |
| c | a | rem,menz | depart,arrive |
@ -1209,3 +1209,33 @@ Feature: Simple Turns
| a | c | knob,knob | depart,arrive |
| d | e | soph,soph | depart,arrive |
| d | a | soph,knob,knob | depart,turn left,arrive |
# https://www.openstreetmap.org/node/30797565
Scenario: No turn instruction when turning from unnamed onto unnamed
Given the node map
"""
a
|
|
|
|
b----------------c
|
|
|
|
|
|
d
"""
And the ways
| nodes | highway | name | ref |
| ab | trunk_link | | |
| db | secondary | | L 460 |
| bc | secondary | | |
When I route I should get
| from | to | route | turns |
| d | c | ,, | depart,turn right,arrive |

View File

@ -160,8 +160,8 @@ Feature: Ramp Guidance
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
| a,c | ab,bc,bc | depart,turn left,arrive |
| a,d | ab,bd,bd | depart,on ramp right,arrive |
| a,c | ab,bc | depart,arrive |
Scenario: Fork Slight Ramp
Given the node map
@ -179,8 +179,8 @@ Feature: Ramp Guidance
When I route I should get
| waypoints | route | turns |
| a,d | ab,bd,bd | depart,on ramp slight right,arrive |
| a,c | ab,bc,bc | depart,turn slight left,arrive |
| a,d | ab,bd,bd | depart,on ramp slight right,arrive |
| a,c | ab,bc | depart,arrive |
Scenario: Fork Slight Ramp on Through Street
Given the node map

View File

@ -9,7 +9,7 @@ Feature: Basic Roundabout
"""
Scenario: Roundabout exit counting for left sided driving
And a grid size of 10 meters
Given a grid size of 10 meters
And the node map
"""
a
@ -33,7 +33,7 @@ Feature: Basic Roundabout
| a,h | ab,gh,gh | depart,roundabout turn right exit-3,arrive |
Scenario: Mixed Entry and Exit
And a grid size of 10 meters
Given a grid size of 10 meters
And the node map
"""
c a

View File

@ -791,10 +791,10 @@ Feature: Basic Roundabout
# the turn angles here are quite strange, so we do get uturns for exiting
When I route I should get
| from | to | route | turns | distance |
| e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80.1m |
| f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m |
| k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80.1m |
| l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120.1m |
| e | f | ed,af,af,af | depart,roundabout-exit-1,exit roundabout left,arrive | 80m |
| f | e | af,ed,ed,ed | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m |
| k | l | kg,hl,hl,hl | depart,roundabout-exit-1,exit roundabout right,arrive | 80m |
| l | k | hl,kg,kg,kg | depart,roundabout-exit-1,exit roundabout uturn,arrive | 120m |
@4030 @4075
Scenario: Service roundabout with service exits
@ -846,5 +846,5 @@ Feature: Basic Roundabout
When I route I should get
| from | to | route | turns | distance |
| e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.1m |
| e | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 189.2m |
| 1 | k | ebds,ufghl,ufghl,jhik,jhik | depart,rstur-exit-2,exit rotary right,turn right,arrive | 159.1m |

View File

@ -836,9 +836,9 @@ Feature: Turn Lane Guidance
| cf | secondary | bottom | |
When I route I should get
| waypoints | turns | route | lanes |
| a,d | depart,continue right,continue right,arrive | road,road,road,road | ,straight:false right:true,, |
| d,a | depart,continue left,continue left,arrive | road,road,road,road | ,left:true straight:false,, |
| waypoints | turns | route | lanes |
| a,d | depart,continue uturn,arrive | road,road,road | ,straight:false right:true;, |
| d,a | depart,continue uturn,arrive | road,road,road | ,left:true straight:false;, |
@simple
Scenario: Merge Lanes Onto Freeway

View File

@ -45,11 +45,12 @@ class OSRMBaseLoader{
var retryCount = 0;
let retry = (err) => {
if (err) {
if (retryCount < 10) {
if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) {
const timeoutMs = 10 * Math.pow(this.scope.OSRM_CONNECTION_EXP_BACKOFF_COEF, retryCount);
retryCount++;
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, 10);
setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, timeoutMs);
} else {
callback(new Error("Could not connect to osrm-routed after ten retries."));
callback(new Error(`Could not connect to osrm-routed after ${this.scope.OSRM_CONNECTION_RETRIES} retries.`));
}
}
else
@ -67,8 +68,9 @@ class OSRMDirectLoader extends OSRMBaseLoader {
super(scope);
}
load (inputFile, callback) {
this.inputFile = inputFile;
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.shutdown(() => {
this.launch(callback);
});
@ -77,14 +79,55 @@ class OSRMDirectLoader extends OSRMBaseLoader {
osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
const command_arguments = util.format('%s -p %d -i %s -a %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM);
const command_arguments = util.format('%s -p %d -i %s -a %s %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});
callback();
this.child.readyFunc = (data) => {
if (/running and waiting for requests/.test(data)) {
this.child.stdout.removeListener('data', this.child.readyFunc);
callback();
}
};
this.child.stdout.on('data',this.child.readyFunc);
}
};
class OSRMmmapLoader extends OSRMBaseLoader {
constructor (scope) {
super(scope);
}
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.shutdown(() => {
this.launch(callback);
});
}
osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
const command_arguments = util.format('%s -p %d -i %s -a %s --mmap %s', this.inputFile, this.scope.OSRM_PORT, this.scope.OSRM_IP, this.scope.ROUTING_ALGORITHM, this.loaderArgs);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});
this.child.readyFunc = (data) => {
if (/running and waiting for requests/.test(data)) {
this.child.stdout.removeListener('data', this.child.readyFunc);
callback();
}
};
this.child.stdout.on('data',this.child.readyFunc);
}
};
@ -93,8 +136,9 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
super(scope);
}
load (inputFile, callback) {
this.inputFile = inputFile;
load (ctx, callback) {
this.inputFile = ctx.inputFile;
this.loaderArgs = ctx.loaderArgs;
this.loadData((err) => {
if (err) return callback(err);
@ -107,7 +151,7 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
}
loadData (callback) {
const command_arguments = util.format('--dataset-name=%s %s', this.scope.DATASET_NAME, this.inputFile);
const command_arguments = util.format('--dataset-name=%s %s %s', this.scope.DATASET_NAME, this.inputFile, this.loaderArgs);
this.scope.runBin('osrm-datastore', command_arguments, this.scope.environment, (err) => {
if (err) return callback(new Error('*** osrm-datastore exited with ' + err.code + ': ' + err));
callback();
@ -135,22 +179,32 @@ class OSRMLoader {
this.scope = scope;
this.sharedLoader = new OSRMDatastoreLoader(this.scope);
this.directLoader = new OSRMDirectLoader(this.scope);
this.mmapLoader = new OSRMmmapLoader(this.scope);
this.method = scope.DEFAULT_LOAD_METHOD;
}
load (inputFile, callback) {
if (!this.loader) {
this.loader = {shutdown: (cb) => cb() };
}
if (this.method === 'datastore') {
this.directLoader.shutdown((err) => {
this.loader.shutdown((err) => {
if (err) return callback(err);
this.loader = this.sharedLoader;
this.sharedLoader.load(inputFile, callback);
});
} else if (this.method === 'directly') {
this.sharedLoader.shutdown((err) => {
this.loader.shutdown((err) => {
if (err) return callback(err);
this.loader = this.directLoader;
this.directLoader.load(inputFile, callback);
});
} else if (this.method === 'mmap') {
this.loader.shutdown((err) => {
if (err) return callback(err);
this.loader = this.mmapLoader;
this.mmapLoader.load(inputFile, callback);
});
} else {
callback(new Error('*** Unknown load method ' + method));
}

View File

@ -59,6 +59,31 @@ Feature: Locating Nearest node on a Way - pick closest way
| 3 | u |
| 4 | w |
Scenario: Nearest - inside a oneway triangle
Given the node map
"""
c
y z
0 1
2 3 4
a x u w b
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
| ca | yes |
When I request nearest I should get
| in | out |
| 0 | y |
| 1 | z |
| 2 | x |
| 3 | u |
| 4 | w |
Scenario: Nearest - High lat/lon
Given the node locations
| node | lat | lon |
@ -78,3 +103,30 @@ Feature: Locating Nearest node on a Way - pick closest way
| x | a |
| y | b |
| z | c |
Scenario: Nearest - data version
Given the node map
"""
c
y z
0 1
2 3 4
a x u w b
"""
And the ways
| nodes |
| ab |
| bc |
| ca |
And the extract extra arguments "--data_version cucumber_data_version"
When I request nearest I should get
| in | out | data_version |
| 0 | y | cucumber_data_version |
| 1 | z | cucumber_data_version |
| 2 | x | cucumber_data_version |
| 3 | u | cucumber_data_version |
| 4 | w | cucumber_data_version |

View File

@ -111,3 +111,28 @@ Feature: Locating Nearest node on a Way - basic projection onto way
| 7 | b |
| 8 | a |
| 9 | b |
Scenario: Nearest - easy-west way with flatbuffers
Given the node map
"""
0 1 2 3 4
a x b
5 6 7 8 9
"""
And the ways
| nodes |
| ab |
When I request nearest with flatbuffers I should get
| in | out |
| 0 | a |
| 1 | a |
| 2 | x |
| 3 | b |
| 4 | b |
| 5 | a |
| 6 | a |
| 7 | x |
| 8 | b |
| 9 | b |

View File

@ -1,44 +0,0 @@
@prepare @options @help
Feature: osrm-contract command line options: help
Scenario: osrm-contract - Help should be shown when no options are passed
When I try to run "osrm-contract"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit with an error
Scenario: osrm-contract - Help, short
When I run "osrm-contract -h"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit successfully
Scenario: osrm-contract - Help, long
When I run "osrm-contract --help"
Then stderr should be empty
And stdout should contain /osrm-contract(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--core"
And stdout should contain "--segment-speed-file"
And it should exit successfully

View File

@ -1,38 +0,0 @@
@contract @options @help
Feature: osrm-customize command line options: help
Scenario: osrm-customize - Help should be shown when no options are passed
When I try to run "osrm-customize"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit with an error
Scenario: osrm-customize - Help, short
When I run "osrm-customize -h"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully
Scenario: osrm-customize - Help, long
When I run "osrm-customize --help"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully

View File

@ -0,0 +1,141 @@
@routing @disable-feature-dataset
Feature: disable-feature-dataset command line options
Background:
Given the profile "testbot"
And the node map
"""
0
a b c
"""
And the ways
| nodes |
| ab |
| bc |
Scenario: disable-feature-dataset - geometry disabled error
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
# The default values
And the query options
| overview | simplified |
| annotations | false |
| steps | false |
| skip_waypoints | false |
When I route I should get
| from | to | code |
| a | c | DisabledDataset |
When I plan a trip I should get
| waypoints | code |
| a,b,c | DisabledDataset |
When I match I should get
| trace | code |
| abc | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
When I request nearest I should get
| in | code |
| 0 | DisabledDataset |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled success
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
# No geometry values returned
And the query options
| overview | false |
| annotations | false |
| steps | false |
| skip_waypoints | true |
When I route I should get
| from | to | code |
| a | c | Ok |
When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |
When I match I should get
| trace | code |
| abc | Ok |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_GEOMETRY"
And the query options
| skip_waypoints | true |
# You would never do this, but just to prove the point.
When I request nearest I should get
| in | code |
| 0 | Ok |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | Ok |
Scenario: disable-feature-dataset - steps disabled error
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
# Default + annotations, steps
And the query options
| overview | simplified |
| annotations | true |
| steps | true |
When I route I should get
| from | to | code |
| a | c | DisabledDataset |
When I plan a trip I should get
| waypoints | code |
| a,b,c | DisabledDataset |
When I match I should get
| trace | code |
| abc | DisabledDataset |
Scenario: disable-feature-dataset - geometry disabled error table
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
When I request nearest I should get
| in | code |
| 0 | Ok |
When I request a travel time matrix with these waypoints I should get the response code
| waypoints | code |
| a,b,c | Ok |
Scenario: disable-feature-dataset - steps disabled success
Given the data load extra arguments "--disable-feature-dataset ROUTE_STEPS"
# Default + steps
And the query options
| overview | simplified |
| annotations | true |
| steps | false |
When I route I should get
| from | to | code |
| a | c | Ok |
When I plan a trip I should get
| waypoints | code |
| a,b,c | Ok |
When I match I should get
| trace | code |
| abc | Ok |

View File

@ -33,10 +33,6 @@ Feature: osrm-datastore command line options
When I try to run "osrm-datastore {processed_file} --dataset-name cucumber/only_metric_test --only-metric"
Then it should exit successfully
Scenario: osrm-datastore - Displaying help should work
When I try to run "osrm-datastore {processed_file} --help"
Then it should exit successfully
Scenario: osrm-datastore - Errors on invalid path
When I try to run "osrm-datastore invalid_path.osrm"
Then stderr should contain "[error] Config contains invalid file paths."

View File

@ -1,47 +0,0 @@
@extract @options @help
Feature: osrm-extract command line options: help
Background:
Given the profile "testbot"
Scenario: osrm-extract - Help should be shown when no options are passed
When I run "osrm-extract"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully
Scenario: osrm-extract - Help, short
When I run "osrm-extract -h"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully
Scenario: osrm-extract - Help, long
When I run "osrm-extract --help"
Then stderr should be empty
And stdout should contain /osrm-extract(.exe)? <input.osm/.osm.bz2/.osm.pbf> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "--verbosity"
And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads"
And stdout should contain "--small-component-size"
And it should exit successfully

View File

@ -154,3 +154,27 @@ Feature: osrm-extract lua ways:get_nodes()
Then it should exit successfully
And stdout should contain "node 42"
And stdout should contain "way 42"
Scenario: osrm-extract flags accessible in process_segment function
Given the profile file
"""
functions = require('testbot')
functions.process_segment = function (profile, segment)
print('segment forward ' .. tostring(segment.flags.forward) .. ' backward ' .. tostring(segment.flags.backward))
end
return functions
"""
And the node map
"""
a b
"""
And the ways
| nodes | oneway |
| ab | yes |
And the data has been saved to disk
When I run "osrm-extract --profile {profile_file} {osm_file}"
Then it should exit successfully
And stdout should contain "segment forward true backward false"

Some files were not shown because too many files have changed in this diff Show More