refactor separate framework from game code, add demo3d
This commit is contained in:
parent
19ae869769
commit
40f5cdcaa5
92 changed files with 2665 additions and 6547 deletions
68
demo3d/server/build.rs
Normal file
68
demo3d/server/build.rs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let root = PathBuf::from(&manifest_dir).join("../..");
|
||||
let framework_src = root.join("src");
|
||||
let game_client = root.join("demo3d/client");
|
||||
|
||||
println!("cargo:rerun-if-changed=../client/bsp/demo3d_bsp.h");
|
||||
println!("cargo:rerun-if-changed=../client/protocol/demo3d_protocol.c");
|
||||
println!("cargo:rerun-if-changed=../client/protocol/demo3d_protocol.h");
|
||||
println!("cargo:rerun-if-changed=../client/sim/demo3d_sim.c");
|
||||
println!("cargo:rerun-if-changed=../client/sim/demo3d_sim.h");
|
||||
println!("cargo:rerun-if-changed=../../src/core/pxl8_log.c");
|
||||
println!("cargo:rerun-if-changed=../../src/core/pxl8_log.h");
|
||||
println!("cargo:rerun-if-changed=../../src/core/pxl8_types.h");
|
||||
println!("cargo:rerun-if-changed=../../src/math/pxl8_math.c");
|
||||
println!("cargo:rerun-if-changed=../../src/math/pxl8_math.h");
|
||||
|
||||
cc::Build::new()
|
||||
.file(framework_src.join("core/pxl8_log.c"))
|
||||
.file(framework_src.join("platform/pxl8_mem.c"))
|
||||
.file(framework_src.join("math/pxl8_math.c"))
|
||||
.file(framework_src.join("math/pxl8_noise.c"))
|
||||
.file(game_client.join("sim/demo3d_sim.c"))
|
||||
.include(framework_src.join("core"))
|
||||
.include(framework_src.join("math"))
|
||||
.include(framework_src.join("platform"))
|
||||
.include(game_client.join("bsp"))
|
||||
.include(game_client.join("net"))
|
||||
.include(game_client.join("sim"))
|
||||
.compile("pxl8");
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header(framework_src.join("core/pxl8_log.h").to_str().unwrap())
|
||||
.header(framework_src.join("math/pxl8_noise.h").to_str().unwrap())
|
||||
.header(game_client.join("sim/demo3d_sim.h").to_str().unwrap())
|
||||
.clang_arg(format!("-I{}", framework_src.join("core").display()))
|
||||
.clang_arg(format!("-I{}", framework_src.join("math").display()))
|
||||
.clang_arg(format!("-I{}", framework_src.join("platform").display()))
|
||||
.clang_arg(format!("-I{}", game_client.join("bsp").display()))
|
||||
.clang_arg(format!("-I{}", game_client.join("net").display()))
|
||||
.clang_arg(format!("-I{}", game_client.join("sim").display()))
|
||||
.blocklist_item("FP_NAN")
|
||||
.blocklist_item("FP_INFINITE")
|
||||
.blocklist_item("FP_ZERO")
|
||||
.blocklist_item("FP_SUBNORMAL")
|
||||
.blocklist_item("FP_NORMAL")
|
||||
.blocklist_type("pxl8_vec2")
|
||||
.blocklist_type("pxl8_vec3")
|
||||
.blocklist_type("pxl8_vec4")
|
||||
.blocklist_type("pxl8_mat4")
|
||||
.blocklist_item(".*_simd.*")
|
||||
.blocklist_item("PXL8_SIMD.*")
|
||||
.blocklist_type("__m128.*")
|
||||
.blocklist_type(".*32x4_t|.*16x8_t")
|
||||
.raw_line("pub use crate::math::{pxl8_vec2, pxl8_vec3, pxl8_vec4, pxl8_mat4};")
|
||||
.use_core()
|
||||
.rustified_enum(".*")
|
||||
.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");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue