-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14d8899
commit ea62390
Showing
9 changed files
with
61 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
pub fn setup_gnu() { | ||
let libnode_path = search_libnode_path(); | ||
if let Some(libnode_dir) = libnode_path { | ||
let node_lib_path = libnode_dir.join("libnode.dll"); | ||
if node_lib_path.exists() { | ||
println!("cargo:rustc-link-search=native={}", libnode_dir.display()); | ||
println!("cargo:rustc-link-lib=node"); | ||
} else { | ||
panic!("libnode.dll not found in {}", libnode_dir.display()); | ||
} | ||
} else { | ||
panic!("libnode.dll not found in any search path"); | ||
} | ||
} | ||
|
||
fn search_libnode_path() -> Option<PathBuf> { | ||
if let Ok(path) = env::var("LIBNODE_PATH") { | ||
let libnode_dir = PathBuf::from(path); | ||
if libnode_dir.exists() { | ||
return Some(libnode_dir); | ||
} | ||
} | ||
|
||
if let Ok(paths) = env::var("LIBPATH") { | ||
for path in env::split_paths(&paths) { | ||
if path.join("libnode.dll").exists() { | ||
return Some(path); | ||
} | ||
} | ||
} | ||
|
||
if let Ok(paths) = env::var("PATH") { | ||
for path in env::split_paths(&paths) { | ||
if path.join("libnode.dll").exists() { | ||
return Some(path); | ||
} | ||
} | ||
} | ||
|
||
None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
extern crate napi_build; | ||
|
||
fn main() { | ||
napi_build::setup(); | ||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); | ||
let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap(); | ||
if target_os == "windows" && target_env == "gnu" { | ||
napi_build::setup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters