From f9e7afdee20fad98ab1afc2ea9c28b4a1e38695e Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 17 Aug 2026 22:46:50 +0300 Subject: [PATCH] fix(build): scope Windows debug stack Apply /STACK only to the debug app binary instead of every Windows target artifact. --- .cargo/config.toml | 7 ------- build.rs | 11 +++++++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 7a85fa59e..88c43407a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -18,10 +18,3 @@ rustflags = [ # WebAssembly stack while developing with `trunk serve`. '-Clink-arg=-zstack-size=4194304', ] - -[target.x86_64-pc-windows-msvc] -rustflags = [ - # Debug builds of the host have a deeper call stack than the default 1 MiB - # Windows stack allows; increase it to avoid stack overflow on startup. - '-Clink-arg=/STACK:16777216', -] diff --git a/build.rs b/build.rs index 5c616ab2e..15142595f 100644 --- a/build.rs +++ b/build.rs @@ -33,10 +33,13 @@ fn main() { revision }; println!("cargo:rustc-env=OCS_GIT_REV={revision}"); - println!( - "cargo:rustc-env=OCS_BUILD_PROFILE={}", - std::env::var("PROFILE").unwrap_or_else(|_| "unknown".to_string()) - ); + let profile = std::env::var("PROFILE").unwrap_or_else(|_| "unknown".to_string()); + println!("cargo:rustc-env=OCS_BUILD_PROFILE={profile}"); + if std::env::var("TARGET").ok().as_deref() == Some("x86_64-pc-windows-msvc") + && profile == "debug" + { + println!("cargo:rustc-link-arg-bin=OpenCADStudio=/STACK:16777216"); + } let mut features: Vec = std::env::vars() .filter_map(|(name, value)| { (value == "1")