forked from eira-fransham/astcenc-sys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
52 lines (46 loc) · 2.11 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
49
50
51
52
fn main() {
let mut build = cc::Build::new();
build.files([
"astc-encoder/Source/astcenc_averages_and_directions.cpp",
"astc-encoder/Source/astcenc_block_sizes.cpp",
"astc-encoder/Source/astcenc_color_quantize.cpp",
"astc-encoder/Source/astcenc_color_unquantize.cpp",
"astc-encoder/Source/astcenc_compress_symbolic.cpp",
"astc-encoder/Source/astcenc_compute_variance.cpp",
"astc-encoder/Source/astcenc_decompress_symbolic.cpp",
"astc-encoder/Source/astcenc_diagnostic_trace.cpp",
"astc-encoder/Source/astcenc_entry.cpp",
"astc-encoder/Source/astcenc_find_best_partitioning.cpp",
"astc-encoder/Source/astcenc_ideal_endpoints_and_weights.cpp",
"astc-encoder/Source/astcenc_image.cpp",
"astc-encoder/Source/astcenc_integer_sequence.cpp",
"astc-encoder/Source/astcenc_mathlib.cpp",
"astc-encoder/Source/astcenc_mathlib_softfloat.cpp",
"astc-encoder/Source/astcenc_partition_tables.cpp",
"astc-encoder/Source/astcenc_percentile_tables.cpp",
"astc-encoder/Source/astcenc_pick_best_endpoint_format.cpp",
"astc-encoder/Source/astcenc_quantization.cpp",
"astc-encoder/Source/astcenc_symbolic_physical.cpp",
"astc-encoder/Source/astcenc_weight_align.cpp",
"astc-encoder/Source/astcenc_weight_quant_xfer_tables.cpp",
]);
build.compile("astcenc");
let main_header = "astc-encoder/Source/astcenc.h";
let bindings = bindgen::Builder::default()
.clang_arg("-xc++")
.header(main_header)
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.derive_partialeq(true)
.derive_eq(true)
.derive_hash(true)
.derive_debug(true)
.formatter(bindgen::Formatter::Prettyplease)
// Bypasses an issue with bindgen that makes it generate invalid Rust code.
.allowlist_file(main_header)
.generate()
.expect("Unable to generate bindings");
bindings
.write_to_file("src/bindings.rs")
.expect("Couldn't write bindings");
println!("cargo:rerun-if-changed=build.rs");
}