From 97f4835c17dafdae4ad9bd49d14062cc52ffb8a7 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Sun, 1 Oct 2023 00:33:44 -0400 Subject: [PATCH] Include gcc libdir when building Assume devkitARM ships with only a single version, so then find the first entry matching `${DEVKITARM}/lib/gcc/arm-none-eabi/*/include` and add it to the -isystem includes. --- citro3d-sys/Cargo.toml | 3 ++- citro3d-sys/build.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/citro3d-sys/Cargo.toml b/citro3d-sys/Cargo.toml index 9c55a60..62b31d8 100644 --- a/citro3d-sys/Cargo.toml +++ b/citro3d-sys/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "citro3d-sys" version = "0.1.0" -authors = [ "Rust3DS Org", "panicbit " ] +authors = ["Rust3DS Org", "panicbit "] edition = "2021" license = "Zlib" +links = "citro3d" [dependencies] libc = "0.2.116" diff --git a/citro3d-sys/build.rs b/citro3d-sys/build.rs index 1210f08..c429ee9 100644 --- a/citro3d-sys/build.rs +++ b/citro3d-sys/build.rs @@ -42,6 +42,18 @@ fn main() { let system_include = sysroot.join("include"); let static_fns_path = Path::new("citro3d_statics_wrapper"); + let gcc_dir = PathBuf::from_iter([devkitarm.as_str(), "lib", "gcc", "arm-none-eabi"]); + + let gcc_include = gcc_dir + .read_dir() + .unwrap() + // Assuming that there is only one gcc version of libs under the devkitARM dir + .next() + .unwrap() + .unwrap() + .path() + .join("include"); + let bindings = Builder::default() .header(three_ds_h.to_str().unwrap()) .header(citro3d_h.to_str().unwrap()) @@ -70,6 +82,8 @@ fn main() { sysroot.to_str().unwrap(), "-isystem", system_include.to_str().unwrap(), + "-isystem", + gcc_include.to_str().unwrap(), "-I", include_path.to_str().unwrap(), "-mfloat-abi=hard",