2023-02-28 02:51:39 +00:00
|
|
|
use std::error::Error;
|
2023-02-27 11:06:18 +00:00
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
bindgen::Builder::default()
|
2023-02-26 18:31:44 +00:00
|
|
|
.header("c/lz4/lz4.h")
|
2023-02-28 05:49:04 +00:00
|
|
|
.header("c/lz4/lz4hc.h")
|
|
|
|
.header("c/lz4/lz4frame.h")
|
|
|
|
.header("c/lz4/xxhash.h")
|
2023-02-27 11:06:18 +00:00
|
|
|
.generate()?
|
2023-02-27 23:08:46 +00:00
|
|
|
.write_to_file("src/lz4.rs")?;
|
2023-02-26 18:31:44 +00:00
|
|
|
|
2023-02-28 05:49:04 +00:00
|
|
|
cc::Build::new()
|
|
|
|
.files([
|
|
|
|
"c/lz4/lz4.c",
|
|
|
|
"c/lz4/lz4hc.c",
|
|
|
|
"c/lz4/lz4frame.c",
|
|
|
|
"c/lz4/xxhash.c",
|
|
|
|
])
|
|
|
|
.compile("lz4");
|
2023-02-26 18:31:44 +00:00
|
|
|
|
2023-02-27 23:08:46 +00:00
|
|
|
// bindgen::Builder::default()
|
|
|
|
// .header("c/zstd/zstd.h")
|
|
|
|
// .generate()?
|
|
|
|
// .write_to_file("src/zstd.rs")?;
|
2023-02-27 11:06:18 +00:00
|
|
|
|
2023-02-27 22:18:10 +00:00
|
|
|
// bindgen::Builder::default()
|
|
|
|
// .header("c/quiche/quiche.h")
|
|
|
|
// .generate()?
|
|
|
|
// .write_to_file("src/quiche.rs")?;
|
|
|
|
|
|
|
|
// bindgen::Builder::default()
|
|
|
|
// .header("c/bullet3/PhysicsClientC_API.h")
|
|
|
|
// .header("c/bullet3/PhysicsClientSharedMemory_C_API.h")
|
|
|
|
// .header("c/bullet3/PhysicsClientSharedMemory2_C_API.h")
|
|
|
|
// .header("c/bullet3/PhysicsDirectC_API.h")
|
|
|
|
// .header("c/bullet3/SharedMemoryPublic.h")
|
|
|
|
// .generate()?
|
|
|
|
// .write_to_file("src/bullet3.rs")?;
|
|
|
|
|
2023-02-28 05:49:04 +00:00
|
|
|
csbindgen::Builder::default()
|
2023-02-27 23:08:46 +00:00
|
|
|
.input_bindgen_file("src/lz4.rs")
|
2023-02-27 10:44:03 +00:00
|
|
|
.rust_method_prefix("csbindgen_")
|
2023-02-27 23:08:46 +00:00
|
|
|
.rust_file_header("use super::lz4;")
|
|
|
|
.rust_method_type_path("lz4")
|
2023-02-27 22:18:10 +00:00
|
|
|
.csharp_class_name("LibLz4")
|
2023-02-28 01:22:34 +00:00
|
|
|
.csharp_dll_name("csbindgen_tests")
|
2023-02-28 01:50:15 +00:00
|
|
|
.csharp_dll_name_if("UNITY_IOS && !UNITY_EDITOR", "__Internal")
|
|
|
|
.csharp_entry_point_prefix("csbindgen_")
|
|
|
|
.csharp_method_prefix("")
|
2023-02-27 23:08:46 +00:00
|
|
|
.generate_to_file("src/lz4_ffi.rs", "../dotnet-sandbox/lz4_bindgen.cs")?;
|
2023-02-27 11:06:18 +00:00
|
|
|
|
2023-02-28 05:49:04 +00:00
|
|
|
csbindgen::Builder::default()
|
|
|
|
.input_extern_file("src/lib.rs")
|
|
|
|
.csharp_class_name("LibRust")
|
|
|
|
.csharp_dll_name("csbindgen_tests")
|
|
|
|
.generate_csharp_file("../dotnet-sandbox/method_call.cs")?;
|
|
|
|
|
2023-02-27 23:08:46 +00:00
|
|
|
// csbindgen::Builder::new()
|
|
|
|
// .input_bindgen_file("src/zstd.rs")
|
|
|
|
// .rust_method_prefix("csbindgen_zstd_")
|
|
|
|
// .csharp_class_name("LibZstd")
|
|
|
|
// .csharp_dll_name("libzsd")
|
|
|
|
// .generate_to_file("src/zstd_ffi.rs", "../dotnet-sandbox/zstd_bindgen.cs")?;
|
2023-02-27 22:18:10 +00:00
|
|
|
|
2023-02-27 23:08:46 +00:00
|
|
|
// csbindgen::Builder::new()
|
|
|
|
// .input_bindgen_file("src/quiche.rs")
|
|
|
|
// .rust_method_prefix("csbindgen_quiche_")
|
|
|
|
// .csharp_class_name("LibQuiche")
|
|
|
|
// .csharp_dll_name("libquiche")
|
|
|
|
// .generate_to_file("src/quiche_ffi.rs", "../dotnet-sandbox/quiche_bindgen.cs")?;
|
2023-02-27 22:18:10 +00:00
|
|
|
|
2023-02-27 23:08:46 +00:00
|
|
|
// csbindgen::Builder::new()
|
|
|
|
// .input_bindgen_file("src/bullet3.rs")
|
|
|
|
// .rust_method_prefix("csbindgen_bullet3_")
|
|
|
|
// .csharp_class_name("LibBullet3")
|
|
|
|
// .csharp_dll_name("libbullet3")
|
|
|
|
// .generate_to_file("src/bullet3_ffi.rs", "../dotnet-sandbox/bullet3_bindgen.cs")?;
|
2023-02-27 11:06:18 +00:00
|
|
|
|
|
|
|
Ok(())
|
2023-02-26 18:31:44 +00:00
|
|
|
}
|