Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / library / map / src / main / rust / Cargo.toml

Cargo.toml69 lines · 3.4 KiBRaw
1# The Vulkan vector-tile renderer for `:library:map`.
2#
3# Replaces the CARTO raster basemap in findfamily, photos, weather, taxi and
4# fooddelivery (#615) with our own renderer over the planet-scale v7
5# single-file planet3.mamaps archive.
6#
7# Why Vulkan and not `androidx.webgpu`: that wrapper bundles Dawn as a 5.79 MB
8# `libwebgpu_c_bundled.so` per ABI, to translate to the Vulkan that is already on
9# every device we target (minSdk 31). `ash` with `features = ["loaded"]` links
10# nothing and dlopen's `libvulkan.so` at run time, so the only native code we ship
11# is our own. It also drops a `1.0.0-alpha05` dependency whose API changes between
12# alphas, and lets us feed SPIR-V straight to the driver instead of through Dawn's
13# SPIR-V path, which is gated behind an unsafe-API toggle in some configurations.
14#
15# `games/voxels` is the in-repo precedent for all of this and the same ash version.
16
17[package]
18name = "map_renderer"
19version = "0.1.0"
20edition = "2021"
21publish = false
22license = "GPL-2.0-only"
23description = "Vulkan vector-tile map renderer: planet3.mamaps v7 in, triangles out"
24
25[lib]
26name = "map_renderer"
27# cdylib for the JNI surface; rlib so the host test binary can link it and run the
28# whole CPU pipeline — tessellation, tile selection, the cache — without a device.
29crate-type = ["cdylib", "rlib"]
30
31[dependencies]
32jni.workspace = true
33# Cache keys are SHA-256(url + range), as the Kotlin cache in `maps` uses. Already a
34# workspace dependency, so this adds nothing to the lockfile.
35sha2.workspace = true
36# The authored MapLibre style is parsed at startup rather than transcribed into constants.
37# Hand-copying it could not converge: MapLibre renders this exact file correctly, so the
38# file is the source of truth and the only way to match it is to evaluate it.
39serde_json.workspace = true
40
41# The .mamaps codec, shared with `scripts/maps`, which builds the
42# planet3.mamaps archive this reads. One implementation, so the two cannot drift.
43tilecodec = { path = "../../../../tilecodec/src/main/rust" }
44
45# HTTP goes back out through Kotlin: this crate opens no sockets and carries no TLS
46# stack, so pmtiles range requests keep `library:network`'s reduced CA bundle.
47jni_http = { path = "../../../../jni-http/src/main/rust" }
48ab_glyph.workspace = true
49# The POI sprite sheet is a PNG, and nothing else in this crate can decode one. Already in
50# the workspace lock file, so this promotes an existing transitive crate to a direct
51# dependency rather than adding to the tree. Decoding at first use ships the 28 KB
52# compressed sheet instead of the 466 KB of raw RGBA a `build.rs` decode would bake into
53# the `.so` — the same trade the fonts make with `ab_glyph`.
54png.workspace = true
55# Whole-file mmap for the pushed on-device `.mamaps` archive (see `tile::source::file`):
56# range reads are slices of the mapping, so tile fetch pays no syscalls and the OS pages
57# the multi-GB archive in and out rather than us copying it through `read_at`.
58memmap2.workspace = true
59
60# `default-features = false` drops the `linked` feature, so nothing links against
61# libvulkan at build time; `loaded` dlopen's it, which is what an Android app must
62# do anyway.
63[target.'cfg(target_os = "android")'.dependencies]
64ash = { workspace = true, default-features = false, features = ["loaded"] }
65
66# The same codec with its writer, for host tests only. The device build links
67# the read half and nothing else.
68[dev-dependencies]
69tilecodec = { path = "../../../../tilecodec/src/main/rust", features = ["write"] }