desktop/web: Increase stack size on Windows and wasm
This works around a stack overflow with Bloonts Tower Defense 5, where we have over 400 stack frames at once due to deep `construct_frame` recursion in `goto` execution.
This commit is contained in:
parent
59b219cda6
commit
66f3198f50
|
@ -24,6 +24,14 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
}
|
}
|
||||||
println!("cargo:rustc-env=CFG_RELEASE_CHANNEL={channel}");
|
println!("cargo:rustc-env=CFG_RELEASE_CHANNEL={channel}");
|
||||||
|
|
||||||
|
// Some SWFS have a large amount of recursion (particularly
|
||||||
|
// around `goto`s). Increase the stack size on Windows
|
||||||
|
// accommodate this (the default on Linux is high enough). We
|
||||||
|
// do the same thing for wasm in web/build.rs.
|
||||||
|
if std::env::var("TARGET").unwrap().contains("windows") {
|
||||||
|
println!("cargo:rustc-link-arg=/STACK:4000000");
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
fn main() {
|
||||||
|
// See 'desktop/build.rs' for more information.
|
||||||
|
if std::env::var("TARGET").unwrap().contains("wasm") {
|
||||||
|
println!("cargo:rustc-link-arg=-z");
|
||||||
|
println!("cargo:rustc-link-arg=stack-size=2000000");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue