Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / scripts / maps / osm_ingest / Cargo.toml
Cargo.toml78 lines · 3.1 KiBRaw
| 1 | # Host-side OSM ingest tools for the Maps offline packs. |
| 2 | # |
| 3 | # Replaces the former `scripts/maps/generator.cpp` (road graph) and |
| 4 | # `scripts/maps/poi_extract.cpp` (POI layer), which needed g++ + libosmium and |
| 5 | # therefore WSL, plus the `osmium tags-filter | osmium export | normalize_*.py` |
| 6 | # chain that built the baked vector layers. This crate reads `.osm.pbf` natively, |
| 7 | # so all three tools run on Windows. |
| 8 | # |
| 9 | # Deliberately DETACHED from the Android Rust workspace (the empty [workspace] |
| 10 | # table below), exactly like `scripts/maps/gtfs_ingest`: it is a host binary, so |
| 11 | # `cargo build` here never pulls the aarch64-android toolchain or the app crates' |
| 12 | # lints. |
| 13 | # |
| 14 | # Both dependencies are pure Rust and no C toolchain is involved: |
| 15 | # |
| 16 | # miniz_oxide DECODE-ONLY inflate. We only ever decompress the zlib blobs |
| 17 | # inside a .osm.pbf, so the deflate side is not needed here (unlike |
| 18 | # tile_build, which writes gzip). |
| 19 | # rayon the work-stealing pool behind the spatial sort and the graph |
| 20 | # writer. Sized by `par::threads()`, so `--threads` and |
| 21 | # `MAPS_THREADS` govern it rather than the whole box. |
| 22 | # |
| 23 | # `cargo build --offline` resolves both from the local registry cache, along with |
| 24 | # rayon's own tree (rayon-core, crossbeam-deque, crossbeam-utils, crossbeam-epoch, |
| 25 | # either). That is a statement about THIS box's cache, not a guarantee: a clean |
| 26 | # machine needs one online `cargo fetch` before it can build offline. |
| 27 | [package] |
| 28 | name = "osm_ingest" |
| 29 | version = "0.1.0" |
| 30 | edition = "2021" |
| 31 | publish = false |
| 32 | license = "GPL-2.0-only" |
| 33 | description = "OSM .osm.pbf -> Maps routing graph, POI side files and baked vector layers" |
| 34 | |
| 35 | [lib] |
| 36 | name = "osm_ingest" |
| 37 | path = "src/lib.rs" |
| 38 | |
| 39 | [[bin]] |
| 40 | name = "road_graph" |
| 41 | path = "src/bin/road_graph.rs" |
| 42 | [[bin]] |
| 43 | name = "road_overlay" |
| 44 | path = "src/bin/road_overlay.rs" |
| 45 | |
| 46 | [[bin]] |
| 47 | name = "poi_extract" |
| 48 | path = "src/bin/poi_extract.rs" |
| 49 | |
| 50 | [[bin]] |
| 51 | name = "osm_extract" |
| 52 | path = "src/bin/osm_extract.rs" |
| 53 | |
| 54 | [dependencies] |
| 55 | # Pure-Rust inflate. We only ever DECOMPRESS the zlib blobs inside a .osm.pbf, |
| 56 | # so a decode-only crate is enough and keeps the C toolchain out of the build. |
| 57 | miniz_oxide.workspace = true |
| 58 | rayon.workspace = true |
| 59 | # Pure Rust, one thin wrapper over the platform call, and no C toolchain — which is the bar every |
| 60 | # other dependency here clears too. |
| 61 | # |
| 62 | # It backs `nodeloc`'s coordinate array with a file instead of the heap. That array is 8 bytes per |
| 63 | # needed node, so 1.23 GB on a California extract, and it was half of `mamaps_build`'s whole peak. |
| 64 | # Mapped, the resident cost is whatever the OS decides to keep, and the access pattern is friendly to |
| 65 | # that: materialisation walks ways in id order and a way's nodes are close together in a PBF. |
| 66 | memmap2.workspace = true |
| 67 | |
| 68 | # Blocked-section writer for the v7 graph (`tilecodec::blocked`, write side). |
| 69 | # Host tool only — same pure-Rust bar as every other dependency here. |
| 70 | tilecodec = { workspace = true, features = ["write"] } |
| 71 | |
| 72 | # `libc::statvfs` for the budget gate (`mem::disk_free_bytes`): already in the |
| 73 | # lockfile via memmap2, so this adds a name to link, not a crate to fetch. |
| 74 | [target.'cfg(target_os = "linux")'.dependencies] |
| 75 | libc.workspace = true |
| 76 | |
| 77 | [profile.release] |
| 78 | opt-level = 3 |