Browse Source

Handle linking in ctru-rs build script

pull/10/head
Fenrir 8 years ago
parent
commit
0f919b248f
  1. 1
      ctru-rs/Cargo.toml
  2. 13
      ctru-rs/build.rs
  3. 1
      ctru-sys/Cargo.toml
  4. 7
      ctru-sys/build.rs

1
ctru-rs/Cargo.toml

@ -4,6 +4,7 @@ description = "A safe wrapper around smealum's ctrulib."
license = "https://en.wikipedia.org/wiki/Zlib_License" license = "https://en.wikipedia.org/wiki/Zlib_License"
name = "ctru-rs" name = "ctru-rs"
version = "0.5.0" version = "0.5.0"
links = "ctru"
[lib] [lib]
crate-type = ["rlib"] crate-type = ["rlib"]

13
ctru-rs/build.rs

@ -0,0 +1,13 @@
use std::env;
use std::path::PathBuf;
fn main() {
let devkitpro_path = PathBuf::from(env::var("DEVKITPRO").unwrap());
println!("cargo:rustc-link-search=native={}", devkitpro_path.join("libctru/lib").display());
println!("cargo:rustc-link-lib=static={}", match env::var("PROFILE").unwrap().as_str() {
"release" => "ctru",
"debug" => "ctrud",
_ => unreachable!(),
});
}

1
ctru-sys/Cargo.toml

@ -3,7 +3,6 @@ name = "ctru-sys"
version = "0.4.0" version = "0.4.0"
authors = ["Ronald Kinard <furyhunter600@gmail.com>"] authors = ["Ronald Kinard <furyhunter600@gmail.com>"]
license = "https://en.wikipedia.org/wiki/Zlib_License" license = "https://en.wikipedia.org/wiki/Zlib_License"
links = "ctru"
[dependencies.libc] [dependencies.libc]
version = "0.2" version = "0.2"

7
ctru-sys/build.rs

@ -6,13 +6,6 @@ use std::path::PathBuf;
fn main() { fn main() {
let devkitpro_path = PathBuf::from(env::var("DEVKITPRO").unwrap()); let devkitpro_path = PathBuf::from(env::var("DEVKITPRO").unwrap());
println!("cargo:rustc-link-search=native={}", devkitpro_path.join("libctru/lib").display());
println!("cargo:rustc-link-lib=static={}", match env::var("PROFILE").unwrap().as_str() {
"release" => "ctru",
"debug" => "ctrud",
_ => unreachable!(),
});
let bindings = bindgen::Builder::default() let bindings = bindgen::Builder::default()
.use_core() .use_core()
.trust_clang_mangling(false) .trust_clang_mangling(false)

Loading…
Cancel
Save