|
|
@ -19,19 +19,28 @@ impl ParseCallbacks for CustomCallbacks { |
|
|
|
fn main() { |
|
|
|
fn main() { |
|
|
|
let devkitpro = env::var("DEVKITPRO").unwrap(); |
|
|
|
let devkitpro = env::var("DEVKITPRO").unwrap(); |
|
|
|
let devkitarm = env::var("DEVKITARM").unwrap(); |
|
|
|
let devkitarm = env::var("DEVKITARM").unwrap(); |
|
|
|
let profile = env::var("PROFILE").unwrap(); |
|
|
|
let debuginfo = env::var("DEBUG").unwrap(); |
|
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); |
|
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); |
|
|
|
|
|
|
|
|
|
|
|
println!("cargo:rerun-if-changed=build.rs"); |
|
|
|
println!("cargo:rerun-if-changed=build.rs"); |
|
|
|
println!("cargo:rerun-if-env-changed=DEVKITPRO"); |
|
|
|
println!("cargo:rerun-if-env-changed=DEVKITPRO"); |
|
|
|
println!("cargo:rustc-link-search=native={devkitpro}/libctru/lib"); |
|
|
|
println!("cargo:rustc-link-search=native={devkitpro}/libctru/lib"); |
|
|
|
println!( |
|
|
|
|
|
|
|
"cargo:rustc-link-lib=static={}", |
|
|
|
let linked_libctru = match debuginfo.as_str() { |
|
|
|
match profile.as_str() { |
|
|
|
// Normally this should just be "true" or "false", but just in case,
|
|
|
|
"debug" => "ctrud", |
|
|
|
// we don't support all the different options documented in
|
|
|
|
_ => "ctru", |
|
|
|
// https://doc.rust-lang.org/cargo/reference/profiles.html#debug
|
|
|
|
} |
|
|
|
// so just default to linking with debuginfo if it wasn't disabled
|
|
|
|
); |
|
|
|
"0" | "false" | "none" => "ctru", |
|
|
|
|
|
|
|
// TODO https://github.com/rust3ds/cargo-3ds/issues/14#issuecomment-1783991872
|
|
|
|
|
|
|
|
// To link properly, this must be the same as the library linked by cargo-3ds
|
|
|
|
|
|
|
|
// building the standard library, which is always `ctru` in practice.
|
|
|
|
|
|
|
|
// Ideally we should link `ctrud` if debug symbols are requested though:
|
|
|
|
|
|
|
|
_ => "ctru", |
|
|
|
|
|
|
|
// _ => "ctrud",
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
println!("cargo:rustc-link-lib=static={linked_libctru}"); |
|
|
|
|
|
|
|
|
|
|
|
detect_and_track_libctru(); |
|
|
|
detect_and_track_libctru(); |
|
|
|
|
|
|
|
|
|
|
|