garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /.cargo/config.toml

raw

# SIMD baselines. Nothing in the tree writes intrinsics; what these flags buy is
# the SIMD that is *already there* but compiled out. `tiny-skia`'s raster pipeline
# is built on `f32x8`/`u32x8`, and its `wide/f32x8_t.rs` selects `__m256` only
# under `target_feature = "avx"` — on the default `x86-64` baseline (SSE2) every
# 256-bit op in the tile rasteriser is emulated as two 128-bit ones. `image`'s
# resamplers and our own per-pixel loops autovectorise wider for the same reason.
# Measured on this workload: ~30% off the 1024² mask raster and off `image`'s
# Triangle resize, ~2x off the shore-field tail map.
#
# `x86-64-v3` = AVX2 + FMA + BMI2: Haswell (2013) / Excavator (2015) and later.
[target.x86_64-unknown-linux-gnu]
linker = "clang"
# lld: `pacman -S lld clang`. For faster links on large binaries, try mold instead of lld (`pacman -S mold`).
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=x86-64-v3"]

# Cross-compile to Windows from Linux (CI: the `cartopolis-ci` image carries the
# mingw-w64 toolchain + `rustup target add x86_64-pc-windows-gnu`). Link with the
# mingw gcc; `build.rs` embeds the .exe icon via winresource, which uses the
# matching `x86_64-w64-mingw32-windres` from the same package.
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
rustflags = ["-C", "target-cpu=x86-64-v3"]

[target.x86_64-apple-darwin]
rustflags = ["-C", "target-cpu=x86-64-v3"]

# aarch64 (Apple silicon, ARM Linux) needs nothing: NEON is baseline on the
# architecture, so tiny-skia's `target_feature = "neon"` arm is already live.

# The web target matters most of all here (ADR-033). `simd128` is *not* on by
# default, and without it tiny-skia falls through both its SSE2 and its wasm arms
# to the fully scalar fallback in `wide/f32x4_t.rs` — 4-wide arithmetic executed
# one lane at a time, on the one target that has no worker threads to hide it
# behind. This is the difference between SIMD and no SIMD, not a widening.
#
# simd128 is baseline in every browser we target (Chrome 91+, Firefox 89+,
# Safari 16.4+).
#
# `web_sys_unstable_apis` is not a preference either — it is the only way to reach
# the Geolocation API, which `platform::location` is built on (driver mode's
# position fix on the web). web-sys puts the whole family — `Geolocation`,
# `GeolocationPosition`, `GeolocationCoordinates`, `GeolocationPositionError` —
# behind `#[cfg(web_sys_unstable_apis)]`, and the Cargo features of the same names
# are necessary but **not sufficient**: with the features on and the cfg off the
# types simply do not exist, and the error says `cannot find type ... in crate
# web_sys` rather than anything about a cfg. The cfg gates web-sys's own source, so
# it cannot come from our `build.rs` — it has to be a rustflag, which means every
# place that sets RUSTFLAGS for wasm needs it (see below). "Unstable" here is
# wasm-bindgen's own churn warning, not a browser one: `navigator.geolocation` has
# shipped everywhere for fifteen years.
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+simd128", "--cfg=web_sys_unstable_apis"]

# There is deliberately no `[build] incremental` key here.
#
# There was one (`incremental = true`, added 2025-12-05), and it was quietly
# overriding three profiles that ask for the opposite. Cargo resolves a profile's
# `incremental` setting against `build.incremental` and `CARGO_INCREMENTAL`, and
# the config value **wins over the manifest** — so `[profile.release] incremental
# = false`, inherited by `web-release` and `android-release`, was not in force for
# anything built from this checkout.
#
# Two consequences, one per lane. `ci.yml` sets `CARGO_INCREMENTAL: "0"` in its
# env and was unaffected — and its own comment explains why it must: "sccache
# cannot cache an incremental compilation and silently declines to". The three
# workflows that ship artifacts (`release.yml`, `deploy-wasm.yml`,
# `deploy-android.yml`) set neither, so every shipped binary, wasm module and APK
# was built incrementally on top of thin LTO: slower, more fragmented, and
# uncacheable by any sccache added later.
#
# `[profile.dev] incremental = true` in the root Cargo.toml already covers the one
# case that wants it, which is the edit loop, and it is measured there
# (docs/notes/client-build-cost.md). Setting it here as well only reaches the
# profiles that had said no.

[alias]
# Regenerate the documentation images from the remembered camera positions in
# `docs/shots.toml` — headless, one launch, no window. Extra flags pass through:
#   cargo shots --only globe,route
#   cargo shots --size 2560x1440 --csv /tmp/shots.csv
shots = ["run", "-p", "cartopolis", "--", "--shots"]

# Run the performance suite from `docs/perf.toml` — every scenario flown, settled,
# captured and then measured still and turning. Extra flags pass through to the *binary*:
#   cargo perf --only orbit
#   cargo perf --repeat 3 --only orbit   # median and range, not one sample
#
# **The GPU-pass and allocation columns cannot be reached through this alias.** A
# cargo alias appends, and this one ends in `--`, so `cargo perf --features perf`
# expands to `… -- --perf --features perf` and clap rejects it with "unexpected
# argument '--features'". A cargo flag has to go before the `--`, i.e. spell the
# run out:
#   cargo run -p cartopolis --features perf -- --perf
# `docs/notes/performance-suite.md` says what each column may be trusted for.
perf = ["run", "-p", "cartopolis", "--", "--perf"]