mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
Make pre-bindgened output more portable and support no_std (still requires a libc, though)
This commit is contained in:
parent
4f5eba718f
commit
820a197bab
@ -13,6 +13,9 @@ links = "imgui"
|
||||
# exclude json, lua, and the imgui subdirs (imgui/examples, imgui/docs, etc)
|
||||
exclude = ["third-party/*.json", "third-party/*.lua", "third-party/imgui/*/"]
|
||||
|
||||
[dependencies]
|
||||
cty = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
#![no_std]
|
||||
#[cfg(feature = "wasm")]
|
||||
mod wasm_bindings;
|
||||
|
||||
@ -95,7 +96,7 @@ impl Into<(f32, f32, f32, f32)> for ImVec4 {
|
||||
|
||||
#[test]
|
||||
fn test_imvec2_memory_layout() {
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
assert_eq!(mem::size_of::<ImVec2>(), mem::size_of::<[f32; 2]>());
|
||||
assert_eq!(mem::align_of::<ImVec2>(), mem::align_of::<[f32; 2]>());
|
||||
let test = ImVec2::new(1.0, 2.0);
|
||||
@ -107,7 +108,7 @@ fn test_imvec2_memory_layout() {
|
||||
|
||||
#[test]
|
||||
fn test_imvec4_memory_layout() {
|
||||
use std::mem;
|
||||
use core::mem;
|
||||
assert_eq!(mem::size_of::<ImVec4>(), mem::size_of::<[f32; 4]>());
|
||||
assert_eq!(mem::align_of::<ImVec4>(), mem::align_of::<[f32; 4]>());
|
||||
let test = ImVec4::new(1.0, 2.0, 3.0, 4.0);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -107,16 +107,22 @@ fn generate_binding_file(
|
||||
"--size_t-is-usize",
|
||||
"--no-prepend-enum-name",
|
||||
"--no-doc-comments",
|
||||
// Layout tests aren't portable (they hardcode type sizes), and for
|
||||
// our case they just serve to sanity check rustc's implementation of
|
||||
// `#[repr(C)]`. If we bind directly to C++ ever, we should reconsider this.
|
||||
"--no-layout-tests",
|
||||
"--with-derive-default",
|
||||
"--with-derive-partialeq",
|
||||
"--with-derive-eq",
|
||||
"--with-derive-hash",
|
||||
"--impl-debug",
|
||||
"--use-core",
|
||||
];
|
||||
cmd.args(a);
|
||||
cmd.args(&["--blacklist-type", "__darwin_size_t"]);
|
||||
cmd.args(&["--raw-line", "#![allow(nonstandard_style, clippy::all)]"]);
|
||||
cmd.arg("--output").arg(output);
|
||||
cmd.args(&["--ctypes-prefix", "cty"]);
|
||||
|
||||
if let Some(name) = wasm_import_mod {
|
||||
cmd.args(&["--wasm-import-module-name", &name]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user