diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 18:12:49 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 18:12:49 +1000 |
commit | 5d1750d9adfc45b53c75310c58e31dfdbd8a6e15 (patch) | |
tree | 96b30140b33744a4392af091e79e65bcfc5886d5 | |
parent | 8ce117f0b3fd4ceeb1d7058dde8793e4421ec076 (diff) |
static link
-rw-r--r-- | bindgen/rust/celeritas-sys/Cargo.toml | 8 | ||||
-rw-r--r-- | bindgen/rust/celeritas-sys/README.md | 3 | ||||
-rw-r--r-- | bindgen/rust/celeritas-sys/build.rs | 12 | ||||
-rw-r--r-- | bindgen/rust/celeritas-sys/examples/main_loop.rs | 108 | ||||
-rw-r--r-- | bindgen/rust/src/prelude.rs | 10 | ||||
-rw-r--r-- | src/core.c | 2 |
6 files changed, 18 insertions, 125 deletions
diff --git a/bindgen/rust/celeritas-sys/Cargo.toml b/bindgen/rust/celeritas-sys/Cargo.toml index 51837a1..803b65e 100644 --- a/bindgen/rust/celeritas-sys/Cargo.toml +++ b/bindgen/rust/celeritas-sys/Cargo.toml @@ -11,7 +11,7 @@ serde = { version = "1.0.204", features = ["derive"] } bindgen = "0.69.4" [dev-dependencies] -egui = "0.27.1" -egui_glfw = { git = "https://github.com/omnisci3nce/egui_glfw.git", rev = "67b432695433feb59761f3ae984b966ca3da31db" } -gl = "0.14.0" -serde_json = "1.0.120" +# egui = "0.27.1" +# egui_glfw = { git = "https://github.com/omnisci3nce/egui_glfw.git", rev = "67b432695433feb59761f3ae984b966ca3da31db" } +# gl = "0.14.0" +# serde_json = "1.0.120" diff --git a/bindgen/rust/celeritas-sys/README.md b/bindgen/rust/celeritas-sys/README.md deleted file mode 100644 index f4b4a01..0000000 --- a/bindgen/rust/celeritas-sys/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Rust bindings + examples. - -**WIP**: GLFW passthrough to egui
\ No newline at end of file diff --git a/bindgen/rust/celeritas-sys/build.rs b/bindgen/rust/celeritas-sys/build.rs index e8c54bd..8fdc9c4 100644 --- a/bindgen/rust/celeritas-sys/build.rs +++ b/bindgen/rust/celeritas-sys/build.rs @@ -46,15 +46,19 @@ fn main() { // TODO: we need to look based on OS // Tell cargo to look for shared libraries in the specified directory - let static_lib_path = "/Users/josh/code/CodenameVentus/deps/cel-core/build".to_string(); // let static_lib_path = std::env::var("CELERITAS_CORE_LIB") // .unwrap_or("../../../build/macosx/arm64/debug".to_string()); - println!("cargo:rustc-link-search={static_lib_path}"); + // println!("cargo:rustc-link-search={static_lib_path}"); + + let lib_path = PathBuf::from("/Users/josh/code/CodenameVentus/deps/cel-core/build"); + + // Tell cargo to look for shared libraries in the specified directory + println!("cargo:rustc-link-search={}", lib_path.to_str().unwrap()); // Tell cargo to tell rustc to link the necc. libraries - println!("cargo:rustc-link-lib=celeritas"); - println!("cargo:rustc-link-lib=glfw"); + println!("cargo:rustc-link-lib=static=celeritas"); + // println!("cargo:rustc-link-lib=glfw"); // The bindgen::Builder is the main entry point // to bindgen, and lets you build up options for diff --git a/bindgen/rust/celeritas-sys/examples/main_loop.rs b/bindgen/rust/celeritas-sys/examples/main_loop.rs deleted file mode 100644 index 6bb923f..0000000 --- a/bindgen/rust/celeritas-sys/examples/main_loop.rs +++ /dev/null @@ -1,108 +0,0 @@ -// use std::{ -// ffi::CString, -// ptr::{self, addr_of_mut}, -// }; - -// use celeritas::*; - -// unsafe fn run_game() { -// // init -// let p: *mut GLFWwindow = ptr::null_mut(); -// Core_Bringup(p); - -// let core = get_global_core(); -// let glfw_window_ptr = Core_GetGlfwWindowPtr(core); - -// // cam pos: 18.871811 10.658584 11.643305 cam frontL -0.644326 -0.209243 -0.735569 -// let camera_pos = Vec3 { -// x: 18.9, -// y: 10.6, -// z: 11.6, -// }; -// let camera_front = Vec3 { -// x: -0.6, -// y: -0.2, -// z: -0.7, -// }; -// let camera = Camera_Create( -// camera_pos, -// camera_front, -// Vec3 { -// x: 0.0, -// y: 1.0, -// z: 0.0, -// }, -// 45.0, -// ); -// SetCamera(camera); - -// let mut cube_geo = Geo_CreateCuboid(f32x3 { -// x: 2.0, -// y: 2.0, -// z: 2.0, -// }); -// let mut crate_mesh = Mesh_Create(addr_of_mut!(cube_geo), false); -// let albedo_map = TextureLoadFromFile( -// CString::new("assets/demo/crate/Wood_Crate_001_basecolor.jpg") -// .unwrap() -// .as_ptr() as *const i8, -// ); -// let roughness_map = TextureLoadFromFile( -// CString::new("assets/demo/crate/Wood_Crate_001_roughness.jpg") -// .unwrap() -// .as_ptr() as *const i8, -// ); -// let normal_map = TextureLoadFromFile( -// CString::new("assets/demo/crate/Wood_Crate_001_normal.jpg") -// .unwrap() -// .as_ptr() as *const i8, -// ); -// let ao_map = TextureLoadFromFile( -// CString::new("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg") -// .unwrap() -// .as_ptr() as *const i8, -// ); -// let name: [i8; 64] = [0; 64]; -// let mut crate_mat = Material { -// name: name, -// kind: 0, -// param_albedo: Vec3 { -// x: 0.0, -// y: 0.0, -// z: 0.0, -// }, -// param_metallic: 0.0, -// param_roughness: 0.0, -// param_ao: 0.0, -// pbr_albedo_map: albedo_map, -// pbr_normal_map: normal_map, -// metal_roughness_combined: true, -// pbr_metallic_map: TextureHandle { raw: 99999 }, -// pbr_roughness_map: roughness_map, -// pbr_ao_map: ao_map, -// }; -// let crate_renderent = RenderEnt { -// mesh: addr_of_mut!(crate_mesh), -// material: addr_of_mut!(crate_mat), -// affine: mat4_ident(), -// casts_shadows: true, -// }; -// let mut render_entities: [RenderEnt; 1] = [crate_renderent]; - -// // main loop -// while !ShouldExit() { -// Frame_Begin(); - -// Render_RenderEntities(render_entities.as_mut_ptr(), render_entities.len()); - -// Frame_End(); -// } -// } - -fn main() { - println!("Running from Rust!"); - - // unsafe { - // run_game(); - // } -} diff --git a/bindgen/rust/src/prelude.rs b/bindgen/rust/src/prelude.rs index 90a5df5..7adf11b 100644 --- a/bindgen/rust/src/prelude.rs +++ b/bindgen/rust/src/prelude.rs @@ -1,18 +1,18 @@ +pub use celeritas_sys::Mat4; +pub use celeritas_sys::Quat; +pub use celeritas_sys::Transform; /// --- maths types pub use celeritas_sys::Vec2; pub use celeritas_sys::Vec3; pub use celeritas_sys::Vec4; -pub use celeritas_sys::Quat; -pub use celeritas_sys::Mat4; -pub use celeritas_sys::Transform; -// // --- handles +// --- handles pub use celeritas_sys::BufHandle; -pub use celeritas_sys::TexHandle; pub use celeritas_sys::MaterialHandle; pub use celeritas_sys::MeshHandle; pub use celeritas_sys::ModelHandle; pub use celeritas_sys::PipelineHandle; +pub use celeritas_sys::TexHandle; // pub use celeritas_sys::PipelineLayoutHandle; // pub use celeritas_sys::RenderpassHandle; @@ -12,4 +12,4 @@ void Core_Bringup(const char* window_name, struct GLFWwindow* optional_window) { } void Core_Shutdown() {} -bool AppShouldExit() { return true; } +bool AppShouldExit() { return false; } |