summaryrefslogtreecommitdiff
path: root/bindgen/rust/celeritas-sys/build.rs
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 23:15:22 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 23:15:22 +1000
commit2e2c57a8c04575eec164279a49947cfdba250853 (patch)
treeb5d20aa256de40ebd9bad7c59ab1e8ebb1c47b52 /bindgen/rust/celeritas-sys/build.rs
parentf5e5a6fdf58f3135f3211135bfbcb6e70630309f (diff)
scenes and pbr cleanup to handle missing texture of param
Diffstat (limited to 'bindgen/rust/celeritas-sys/build.rs')
-rw-r--r--bindgen/rust/celeritas-sys/build.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/bindgen/rust/celeritas-sys/build.rs b/bindgen/rust/celeritas-sys/build.rs
index 097e26b..f7bf741 100644
--- a/bindgen/rust/celeritas-sys/build.rs
+++ b/bindgen/rust/celeritas-sys/build.rs
@@ -1,7 +1,33 @@
use std::env;
use std::path::PathBuf;
+use bindgen::callbacks::ParseCallbacks;
+
+const serializable_types: &[&'static str] = &[
+ "Vec2",
+ "Vec3",
+ "Vec4",
+ "Mat4",
+ "Quat",
+ "DirectionalLight",
+ "PointLight",
+];
+
+#[derive(Debug)]
+struct DeriveSerialize;
+impl ParseCallbacks for DeriveSerialize {
+ fn add_derives(&self, info: &bindgen::callbacks::DeriveInfo<'_>) -> Vec<String> {
+ if (serializable_types.contains(&info.name)) {
+ vec!["Serialize".to_string(), "Deserialize".to_string()]
+ } else {
+ vec![]
+ }
+ }
+}
+
fn main() {
+ /* */
+
// Tell cargo to look for shared libraries in the specified directory
// TODO: we need to look based on OS
println!("cargo:rustc-link-search=../../../build/macosx/arm64/debug");
@@ -43,6 +69,7 @@ fn main() {
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
+ .parse_callbacks(Box::new(DeriveSerialize))
// Finish the builder and generate the bindings.
.generate()
// Unwrap the Result and panic on failure.