Skip to content

Commit 2c3669b

Browse files
committedMar 4, 2021
adapted fix from sam217pa. libstdc++ name varies with target_os
1 parent 5df389f commit 2c3669b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
 

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "edlib_rs"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
authors = ["jeanpierre.both@gmail.com"]
55
edition = "2018"
66
build = "build.rs"

‎build.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ fn main() {
3232
let wrapper_path = out_path.join("wrapper.h");
3333
//
3434
write_wrapper(&wrapper_path);
35-
//
35+
// adapted fix from sam217pa. libstdc++ name varies...
36+
let lib_std : &str;
37+
if cfg!(target_os = "macos") {
38+
lib_std = "cargo:rustc-link-lib=c++";
39+
}
40+
else {
41+
lib_std = "cargo:rustc-link-lib=stdc++";
42+
}
43+
3644
let mut libdir = String::from("cargo:rustc-link-search=");
3745
libdir.push_str(out_path.to_str().unwrap());
3846
libdir.push_str("/lib");
3947
println!("{}",libdir);
4048
println!("cargo:rustc-link-lib=edlib");
41-
println!("cargo:rustc-link-lib=stdc++");
49+
println!("{}", lib_std);
4250

4351
// The bindgen::Builder is the main entry point
4452
// to bindgen, and lets you build up options for

0 commit comments

Comments
 (0)
Please sign in to comment.