Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alula committed Dec 1, 2022
0 parents commit acddd17
Show file tree
Hide file tree
Showing 7 changed files with 4,401 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "deko3d"
version = "0.1.0"
edition = "2021"

[dependencies]
deko3d-sys = { version = "0.1.0", path = "./deko3d-sys" }
bitflags = "1.3"
11 changes: 11 additions & 0 deletions deko3d-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "deko3d-sys"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[build-dependencies]
bindgen = "0.62"
27 changes: 27 additions & 0 deletions deko3d-sys/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
println!("cargo:rustc-link-search={}/libnx/lib", env::var("DEVKITPRO").unwrap());

if cfg!(debug_assertions) {
println!("cargo:rustc-link-lib=static=deko3dd");
} else {
println!("cargo:rustc-link-lib=static=deko3d");
}
println!("cargo:rustc-link-lib=nx");
println!("cargo:rerun-if-changed=wrapper.h");

let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg(format!("--sysroot={}/devkitA64/aarch64-none-elf", env::var("DEVKITPRO").unwrap()))
.clang_arg(format!("-I{}/libnx/include", env::var("DEVKITPRO").unwrap()))
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.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!");
}
6 changes: 6 additions & 0 deletions deko3d-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
//include!("./bindings.rs");
Loading

0 comments on commit acddd17

Please sign in to comment.