Use parse-size to parse stack size

This commit is contained in:
2022-07-20 04:27:35 +00:00
committed by GitHub
parent 39c4876a93
commit a6baa876c0
2 changed files with 4 additions and 1 deletions

View File

@@ -59,5 +59,8 @@ debug = true
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["winnls", "stringapiset"] }
[target.'cfg(windows)'.build-dependencies]
parse-size = "1"
[target.'cfg(target_env = "gnu")'.dependencies]
link-cplusplus = { version = "1.0", features = ["libstdc++"], optional = true }

View File

@@ -13,7 +13,7 @@ fn main() {
#[cfg(windows)]
{
let stack_size = std::env::var("STACK_SIZE").unwrap_or("4194304".to_string());
let stack_size = stack_size.parse::<usize>().unwrap();
let stack_size = parse_size::parse_size(stack_size).unwrap();
println!("cargo:rerun-if-env-changed=STACK_SIZE");
#[cfg(target_env = "msvc")]
println!("cargo:rustc-link-arg=/STACK:{}", stack_size);