Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

Windows: klad gets the 8 MB main stack it has elsewhere, and three tests stop assuming unix

Indicode BV5cf26c30aefb
diff --git a/crates/app/src/editor/export.rs b/crates/app/src/editor/export.rs
index 91d5b07..eeeddb3 100644
--- a/crates/app/src/editor/export.rs
+++ b/crates/app/src/editor/export.rs
@@ -251,7 +251,10 @@ mod tests {
};
assert_eq!(
args(bundle, home, 3, &image).join(" "),
- "export /w/art.klad --frame 3 --scale 2 --background -o /w/out/hero.png"
+ format!(
+ "export /w/art.klad --frame 3 --scale 2 --background -o {}",
+ home.join("out/hero.png").display()
+ )
);
let sheet = Form {
what: What::Sheet,
diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rs
index b74a6b3..3baf8ed 100644
--- a/crates/app/src/editor/ui_tests.rs
+++ b/crates/app/src/editor/ui_tests.rs
@@ -806,7 +806,11 @@ fn ui_time_per_frame() {
let stress = std::env::temp_dir().join(format!("draw-ui-stress-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&stress);
let exe = std::env::current_exe().unwrap();
- let draw = exe.parent().and_then(Path::parent).unwrap().join("klad");
+ let draw = exe
+ .parent()
+ .and_then(Path::parent)
+ .unwrap()
+ .join(format!("klad{}", std::env::consts::EXE_SUFFIX));
if draw.exists() {
let made = std::process::Command::new(&draw)
.args(["stress", stress.to_str().unwrap(), "--frames", "48"])
@@ -2246,7 +2250,11 @@ fn a_heavy_animation_keeps_the_ui_responsive_while_frames_load() {
let stress = std::env::temp_dir().join(format!("draw-ui-heavy-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&stress);
let exe = std::env::current_exe().unwrap();
- let draw = exe.parent().and_then(Path::parent).unwrap().join("klad");
+ let draw = exe
+ .parent()
+ .and_then(Path::parent)
+ .unwrap()
+ .join(format!("klad{}", std::env::consts::EXE_SUFFIX));
let size = std::env::var("KLAD_HEAVY_SIZE").unwrap_or_else(|_| "2048".into());
let made = std::process::Command::new(&draw)
.args(["stress", stress.to_str().unwrap(), "--frames", "12", "--size", &size])
@@ -2915,7 +2923,11 @@ fn heavy_edits_and_revisits_keep_the_ui_free() {
let stress = std::env::temp_dir().join(format!("draw-ui-heavy-edit-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&stress);
let exe = std::env::current_exe().unwrap();
- let draw = exe.parent().and_then(Path::parent).unwrap().join("klad");
+ let draw = exe
+ .parent()
+ .and_then(Path::parent)
+ .unwrap()
+ .join(format!("klad{}", std::env::consts::EXE_SUFFIX));
let size = std::env::var("KLAD_HEAVY_SIZE").unwrap_or_else(|_| "2048".into());
let made = std::process::Command::new(&draw)
.args(["stress", stress.to_str().unwrap(), "--frames", "12", "--size", &size])
diff --git a/crates/app/src/jobs.rs b/crates/app/src/jobs.rs
index 00d0ae8..b956d16 100644
--- a/crates/app/src/jobs.rs
+++ b/crates/app/src/jobs.rs
@@ -273,7 +273,11 @@ mod tests {
fn draw_binary() -> PathBuf {
let exe = std::env::current_exe().unwrap();
- let bin = exe.parent().and_then(Path::parent).unwrap().join("klad");
+ let bin = exe
+ .parent()
+ .and_then(Path::parent)
+ .unwrap()
+ .join(format!("klad{}", std::env::consts::EXE_SUFFIX));
assert!(
bin.exists(),
"{} is missing: cargo test --workspace builds it (the klad-cli binary test needs it)",
diff --git a/crates/cli/build.rs b/crates/cli/build.rs
new file mode 100644
index 0000000..af822e9
--- /dev/null
+++ b/crates/cli/build.rs
@@ -0,0 +1,11 @@
+const MAIN_STACK: u32 = 8 * 1024 * 1024;
+
+fn main() {
+ if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
+ return;
+ }
+ match std::env::var("CARGO_CFG_TARGET_ENV").as_deref() {
+ Ok("msvc") => println!("cargo:rustc-link-arg-bins=/STACK:{MAIN_STACK}"),
+ _ => println!("cargo:rustc-link-arg-bins=-Wl,--stack,{MAIN_STACK}"),
+ }
+}