From 6ae7608183bcfa8f007f0c8a3ace74d58d19b0fa Mon Sep 17 00:00:00 2001 From: lifegpc Date: Tue, 19 Jul 2022 11:49:23 +0800 Subject: [PATCH] pass stack size via build script on Windows system. ( Fix #123 --- build.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.rs b/build.rs index 9946336..c451f9d 100644 --- a/build.rs +++ b/build.rs @@ -10,6 +10,16 @@ use std::io::Read; use std::path::PathBuf; fn main() { + #[cfg(windows)] + { + let stack_size = std::env::var("STACK_SIZE").unwrap_or("4194304".to_string()); + let stack_size = stack_size.parse::().unwrap(); + println!("cargo:rerun-if-env-changed=STACK_SIZE"); + #[cfg(target_env = "msvc")] + println!("cargo:rustc-link-arg=/STACK:{}", stack_size); + #[cfg(target_env = "gnu")] + println!("cargo:rustc-link-arg=-Wl,-stack,{}", stack_size); + } #[cfg(any(feature = "exif", feature = "ugoira"))] { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());