-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Techie-Pi/docs/improve-docs-v3
Add `bindgen-ctru-sys` package and update bindings
- Loading branch information
Showing
8 changed files
with
3,703 additions
and
8,272 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ctru-sys" | ||
version = "21.2.0+2.1.2-1" | ||
version = "22.0.0+2.2.0" | ||
authors = [ "Rust3DS Org", "Ronald Kinard <[email protected]>" ] | ||
license = "Zlib" | ||
links = "ctru" | ||
|
5 changes: 3 additions & 2 deletions
5
ctru-sys/docstring-to-rustdoc/Cargo.toml → ctru-sys/bindgen-ctru-sys/Cargo.toml
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,7 +1,8 @@ | ||
[package] | ||
name = "docstring-to-rustdoc" | ||
name = "bindgen-ctru-sys" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
doxygen-rs = "0.3.1" | ||
bindgen = "0.64" | ||
doxygen-rs = "0.4" |
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,60 @@ | ||
use bindgen::callbacks::ParseCallbacks; | ||
use bindgen::{Builder, RustTarget}; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Debug)] | ||
struct CustomCallbacks; | ||
|
||
impl ParseCallbacks for CustomCallbacks { | ||
fn process_comment(&self, comment: &str) -> Option<String> { | ||
Some(doxygen_rs::transform(comment)) | ||
} | ||
} | ||
|
||
fn main() { | ||
let devkitpro = std::env::var("DEVKITPRO").expect("DEVKITPRO not set in environment"); | ||
let devkitarm = std::env::var("DEVKITARM").expect("DEVKITARM not set in environment"); | ||
|
||
let include_path = PathBuf::from_iter([devkitpro.as_str(), "libctru", "include"]); | ||
let header = include_path.join("3ds.h"); | ||
|
||
let sysroot = PathBuf::from(devkitarm).join("arm-none-eabi"); | ||
let system_include = sysroot.join("include"); | ||
|
||
let bindings = Builder::default() | ||
.header(header.to_str().unwrap()) | ||
.rust_target(RustTarget::Nightly) | ||
.use_core() | ||
.trust_clang_mangling(false) | ||
.must_use_type("Result") | ||
.layout_tests(false) | ||
.ctypes_prefix("::libc") | ||
.prepend_enum_name(false) | ||
.blocklist_type("u(8|16|32|64)") | ||
.blocklist_type("__builtin_va_list") | ||
.blocklist_type("__va_list") | ||
.opaque_type("MiiData") | ||
.derive_default(true) | ||
.clang_args([ | ||
"--target=arm-none-eabi", | ||
"--sysroot", | ||
sysroot.to_str().unwrap(), | ||
"-isystem", | ||
system_include.to_str().unwrap(), | ||
"-I", | ||
include_path.to_str().unwrap(), | ||
"-mfloat-abi=hard", | ||
"-march=armv6k", | ||
"-mtune=mpcore", | ||
"-mfpu=vfp", | ||
"-DARM11", | ||
"-D__3DS__", | ||
]) | ||
.parse_callbacks(Box::new(CustomCallbacks)) | ||
.generate() | ||
.expect("unable to generate bindings"); | ||
|
||
bindings | ||
.write(Box::new(std::io::stdout())) | ||
.expect("failed to write bindings"); | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.