From 94f9ad68162208ef8fab9f3f540cd429be298fe0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 8 May 2025 13:45:15 +0200 Subject: [PATCH] Add comment --- tools/cross-compiler/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/cross-compiler/src/main.rs b/tools/cross-compiler/src/main.rs index b7eb296f1..ebcfe0f54 100644 --- a/tools/cross-compiler/src/main.rs +++ b/tools/cross-compiler/src/main.rs @@ -35,6 +35,21 @@ fn main() -> anyhow::Result<()> { let mut rust_flags = String::new(); rust_flags.push_str("-D warnings"); + // This is part of a workaround to make `getrandom` build when compiling + // for WASM. See comment in `fj-viewer`'s `Cargo.toml` for more + // information. + // + // Setting the flag like this might not be appropriate, as it might + // require a similar workaround from users of `fj-viewer`. However, as + // of this writing (2025-05-08), `fj-viewer doesn't support the WASM + // target in any meaningful way. It is only compiled to that target + // during the CI build, to prevent regressions that would inhibit adding + // support harder from slipping in. + // + // So given this context, the following workaround is probably fine. + // Once real support for `fj-viewer` in WASM environments is added, we + // probably have to come up with a different solution. (And then, we'll + // be in a better position to actually test these different solutions.) if target.triple == "wasm32-unknown-unknown" { rust_flags.push_str(" --cfg getrandom_backend=\"wasm_js\""); }