-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
48 lines (44 loc) · 1.43 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::*;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let file = path::Path::new(&out_dir).join("imgui_gen.rs");
bindgen::Builder::default()
.clang_arg("-x")
.clang_arg("c++")
.clang_arg("-std=gnu++17")
.clang_arg("-fno-rtti")
.clang_arg("-fno-exceptions")
.clang_arg("-fno-threadsafe-statics")
.clang_arg("-fno-use-cxa-atexit")
.clang_arg("-Wno-unused-parameter")
.clang_arg("-DNDEBUG")
.clang_arg("-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS")
.enable_cxx_namespaces()
.header("imgui/imgui.h")
.whitelist_function("Im.*")
.whitelist_type("Im.*")
.whitelist_var("Im.*")
.blacklist_item("std.*")
.prepend_enum_name(false)
.generate()
.unwrap()
.write_to_file(&file)
.unwrap();
cc::Build::new()
.cpp(true)
.cpp_link_stdlib(None)
.flag("-std=gnu++17")
.flag("-fno-rtti")
.flag("-fno-exceptions")
.flag("-fno-threadsafe-statics")
.flag("-fno-use-cxa-atexit")
.flag("-Wno-unused-parameter")
.define("NDEBUG", None)
.define("IMGUI_DISABLE_OBSOLETE_FUNCTIONS", None)
.file("imgui/imgui.cpp")
.file("imgui/imgui_draw.cpp")
.file("imgui/imgui_widgets.cpp")
.file("imgui/imgui_tables.cpp")
.compile("libimgui.a");
println!("cargo:rerun-if-changed=imgui/");
}