Skip to content

Commit a168564

Browse files
committed
Fix linking neon-runtime on windows.
-l is only intended to communicate the names of libraries See rust-lang/rust#38850 for more details.
1 parent dc91f46 commit a168564

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/neon-runtime/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ extern crate gcc;
22

33
use std::process::Command;
44
use std::env;
5+
use std::path::Path;
56

67
fn main() {
78
// 1. Build the object file from source using node-gyp.
@@ -57,8 +58,11 @@ fn build_object_file() {
5758
.find(node_lib_file_flag_pattern)
5859
.map(|i| i + node_lib_file_flag_pattern.len())
5960
.expect("Couldn't find node_lib_file in node-gyp output.");
60-
let node_lib_file_end_index = node_gyp_output[node_lib_file_start_index..].find(".lib").unwrap() + node_lib_file_start_index;
61-
println!("cargo:node_lib_file={}", &node_gyp_output[node_lib_file_start_index..node_lib_file_end_index]);
61+
let node_lib_file_end_index = node_gyp_output[node_lib_file_start_index..].find("',").unwrap() + node_lib_file_start_index;
62+
let node_lib_file = &node_gyp_output[node_lib_file_start_index..node_lib_file_end_index];
63+
let file = Path::new(node_lib_file);
64+
println!("cargo:rustc-link-search=native={}", file.parent().unwrap().display());
65+
println!("cargo:rustc-link-lib={}", file.file_stem().unwrap().to_str().unwrap());
6266
}
6367

6468
// Run `node-gyp build`.

0 commit comments

Comments
 (0)