Skip to content

Commit 682ec13

Browse files
committed
use env vars on build.rs
1 parent 4627d55 commit 682ec13

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

build.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ use std::env;
44
use std::path::PathBuf;
55

66
pub fn main() {
7+
let devkitpro_path = env::var("DEVKITPRO").unwrap();
8+
let devkitarm_path = env::var("DEVKITARM").unwrap();
9+
710
println!("cargo:rustc-link-lib=static=nx");
8-
println!("cargo:rustc-link-search=native=/opt/devkitpro/libnx/lib");
11+
println!("cargo:rustc-link-search=native={}/libnx/lib", devkitpro_path);
12+
913
// The bindgen::Builder is the main entry point
1014
// to bindgen, and lets you build up options for
1115
// the resulting bindings.
@@ -18,10 +22,10 @@ pub fn main() {
1822

1923
.header("wrapper.h")
2024

21-
.clang_arg("-I/opt/devkitpro/libnx/include")
22-
.clang_arg("-I/opt/devkitpro/devkitA64/aarch64-none-elf/include")
23-
24-
.clang_arg("-I/opt/devkitpro/devkitA64/lib/gcc/aarch64-none-elf/7.3.0/include")
25+
.clang_arg(format!("-I{}/libnx/include", devkitpro_path))
26+
.clang_arg(format!("-I{}/aarch64-none-elf/include", devkitarm_path))
27+
.clang_arg(format!("-I{}/lib/gcc/aarch64-none-elf/7.3.0/include", devkitarm_path))
28+
2529
// .whitelist_function("consoleInit")
2630
// .whitelist_function("hidKeysDown")
2731
.bitfield_enum("HidMouseButton")

0 commit comments

Comments
 (0)