Skip to content

Commit db5d124

Browse files
committed
fix(libquickjs-sys): copy appropriate bindings file based on target architecture
1 parent e96d41e commit db5d124

File tree

2 files changed

+1824
-3
lines changed

2 files changed

+1824
-3
lines changed

libquickjs-sys/build.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ fn main() {
3939
};
4040

4141
// Instruct cargo to statically link quickjs.
42-
println!("cargo:rustc-link-search=native=D:\\Workspace\\quickjspp\\.bin\\Release\\x64\\");
4342
println!("cargo:rustc-link-search=native={}", lib);
4443
println!("cargo:rustc-link-lib=static={}", LIB_NAME);
4544

@@ -124,8 +123,18 @@ fn main() {
124123
.opt_level(2)
125124
.compile(LIB_NAME);
126125

127-
std::fs::copy(embed_path.join("bindings.rs"), out_path.join("bindings.rs"))
128-
.expect("Could not copy bindings.rs");
126+
// if in 32bit target copy bindings-32.rs, else copy bindings.rs
127+
let target = env::var("TARGET").unwrap();
128+
if target.contains("i686") {
129+
std::fs::copy(
130+
embed_path.join("bindings-32.rs"),
131+
out_path.join("bindings.rs"),
132+
)
133+
.expect("Could not copy bindings-32.rs");
134+
} else {
135+
std::fs::copy(embed_path.join("bindings.rs"), out_path.join("bindings.rs"))
136+
.expect("Could not copy bindings.rs");
137+
}
129138
}
130139

131140
#[cfg(feature = "patched")]

0 commit comments

Comments
 (0)