Skip to content

Commit

Permalink
Turn back to .cargo/config.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
branchseer committed Oct 29, 2021
1 parent 9b31449 commit 955e1e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[target.x86_64-apple-darwin]
rustflags = [ "-Clink-args=-rdynamic" ]

[target.aarch64-apple-darwin]
rustflags = [ "-Clink-args=-rdynamic" ]

[target.x86_64-unknown-linux-gnu]
rustflags = [ "-Clink-args=-rdynamic" ]

[target.i686-unknown-linux-gnu]
rustflags = [ "-Clink-args=-rdynamic" ]

[target.x86_64-pc-windows-msvc]
rustflags = [ "-Ctarget-feature=+crt-static" ]

[target.i686-pc-windows-msvc]
rustflags = [ "-Clink-args=/SAFESEH:NO", "-Ctarget-feature=+crt-static" ]
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.3.1-alpha.0"
authors = ["patr0nus <[email protected]>"]
license = "MIT"
description = "Embedding Node.js in Rust"
edition = "2021"
edition = "2018"
keywords = [ "node", "nodejs", "js", "javascript", "embedding" ]
homepage = "https://github.com/patr0nus/rust-nodejs"
repository = "https://github.com/patr0nus/rust-nodejs"
Expand Down Expand Up @@ -34,6 +34,6 @@ once_cell = "1"
strum = { version = "0.20", features = [ "derive" ] }

[build-dependencies.attohttpc]
version = "0.17"
version = "0.18"
default-features = false # No need for the compress feature
features = [ "tls-rustls" ]
features = [ "rustls" ]
18 changes: 3 additions & 15 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ fn main() -> anyhow::Result<()> {
let arch = match env::var("CARGO_CFG_TARGET_ARCH")?.as_str() {
"x86" => Ok(TargetArch::X86),
"x86_64" => Ok(TargetArch::X64),
other => Err(other.to_string())
other => Err(other.to_string()),
};
if let Ok(TargetOS::Win32) = os {
let target_env = env::var("CARGO_CFG_TARGET_ENV")?;
if target_env != "msvc" { // Can't link to Nodejs under windows-gnu
if target_env != "msvc" {
// Can't link to Nodejs under windows-gnu
anyhow::bail!("Unsupported Environment ABI: {}", target_env)
}
}
Expand Down Expand Up @@ -180,18 +181,5 @@ fn main() -> anyhow::Result<()> {
println!("cargo:rustc-link-lib={}", lib_name);
}

let link_args = match os {
Ok(TargetOS::Darwin | TargetOS::Linux) => vec!["-rdynamic"],
Ok(TargetOS::Win32) => match arch {
Ok(TargetArch::X86) => vec!["/SAFESEH:NO"],
_ => vec![]
},
_ => vec![]
};

for link_arg in link_args {
println!("cargo:rustc-link-arg={}", link_arg);
}

Ok(())
}

0 comments on commit 955e1e4

Please sign in to comment.