Browse Source

Go back to using pre-generated bindings

Bindgen takes a long time to compile, and we only ever need to update
bindings for new ctrulib releases anyway.
pull/10/head
Fenrir 8 years ago
parent
commit
370650f4b6
  1. 2
      ctru-rs/Cargo.toml
  2. 4
      ctru-rs/build.rs
  3. 29
      ctru-sys/build.rs
  4. 9689
      ctru-sys/src/bindings.rs
  5. 2
      ctru-sys/src/lib.rs

2
ctru-rs/Cargo.toml

@ -3,6 +3,7 @@ authors = ["Ronald Kinard <furyhunter600@gmail.com>"]
description = "A safe wrapper around smealum's ctrulib." 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"
links = "ctru"
version = "0.5.1" version = "0.5.1"
[lib] [lib]
@ -11,6 +12,7 @@ name = "ctru"
[dependencies.ctru-sys] [dependencies.ctru-sys]
path = "../ctru-sys" path = "../ctru-sys"
version = "0.4"
[dependencies.bitflags] [dependencies.bitflags]
version = "0.7.0" version = "0.7.0"

4
ctru-rs/build.rs

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

29
ctru-sys/build.rs

@ -1,29 +0,0 @@
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
let devkitpro_path = PathBuf::from(env::var("DEVKITPRO").unwrap());
let bindings = bindgen::Builder::default()
.use_core()
.trust_clang_mangling(false)
.generate_comments(false)
.ctypes_prefix("libc")
.header(devkitpro_path.join("libctru/include/3ds.h").to_str().unwrap())
.hide_type("u8")
.hide_type("u16")
.hide_type("u32")
.hide_type("u64")
.clang_arg(format!("--sysroot={}/devkitARM/arm-none-eabi", devkitpro_path.display()))
.clang_arg(format!("-I{}/libctru/include", devkitpro_path.display()))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings");
}

9689
ctru-sys/src/bindings.rs

File diff suppressed because it is too large Load Diff

2
ctru-sys/src/lib.rs

@ -9,4 +9,4 @@
extern crate libc; extern crate libc;
include!(concat!(env!("OUT_DIR"), "/bindings.rs")); include!("bindings.rs");

Loading…
Cancel
Save