Skip to content

Commit

Permalink
Parameterize node_lib_file in addition to node_root_dir
Browse files Browse the repository at this point in the history
...because on newer Electron versions node-gyp stores the library as
`iojs.lib` and not as `node.lib`.
  • Loading branch information
Antonio Scandurra authored and Dave Herman committed Jan 24, 2017
1 parent 4b84318 commit 08f0b7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.rs
Expand Up @@ -3,5 +3,6 @@ use std::env;
fn main() {
if cfg!(windows) {
println!("cargo:node_root_dir={}", env::var("DEP_NEON_NODE_ROOT_DIR").unwrap());
println!("cargo:node_lib_file={}", env::var("DEP_NEON_NODE_LIB_FILE").unwrap());
}
}
7 changes: 7 additions & 0 deletions crates/neon-sys/build.rs
Expand Up @@ -48,6 +48,13 @@ fn build_object_file() {
.expect("Couldn't find node_root_dir in node-gyp output.");
let node_root_dir_end_index = node_gyp_output[node_root_dir_start_index..].find("'").unwrap() + node_root_dir_start_index;
println!("cargo:node_root_dir={}", &node_gyp_output[node_root_dir_start_index..node_root_dir_end_index]);
let node_lib_file_flag_pattern = "'-Dnode_lib_file=";
let node_lib_file_start_index = node_gyp_output
.find(node_lib_file_flag_pattern)
.map(|i| i + node_lib_file_flag_pattern.len())
.expect("Couldn't find node_lib_file in node-gyp output.");
let node_lib_file_end_index = node_gyp_output[node_lib_file_start_index..].find(".lib").unwrap() + node_lib_file_start_index;
println!("cargo:node_lib_file={}", &node_gyp_output[node_lib_file_start_index..node_lib_file_end_index]);
}

// Run `node-gyp build` (appending -d in debug mode).
Expand Down

0 comments on commit 08f0b7a

Please sign in to comment.