-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
42 lines (41 loc) · 1.56 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
use std::path::PathBuf;
fn main() {
let bindings = bindgen::Builder::default()
.default_enum_style(bindgen::EnumVariation::Rust {
non_exhaustive: false,
})
.raw_line("#![allow(dead_code, non_camel_case_types, non_snake_case)]")
.raw_line("#![allow(clippy::unreadable_literal, clippy::upper_case_acronyms)]")
.header("src/win.h")
.header("src/ViGEmClient/include/ViGEm/Client.h")
.clang_args(&["-I", "src/ViGEmClient/include"])
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from("src/vigem_api_gen.rs");
bindings
.write_to_file(out_path)
.expect("Couldn't write bindings!");
cc::Build::new()
.cpp(true)
.static_crt(true)
.include("src/ViGEmClient/include")
.file("src/ViGEmClient/src/ViGEmClient.cpp")
.define("VIGEM_DYNAMIC", None)
.define("VIGEM_EXPORTS", None)
.define("NDEBUG", None)
.define("_LIB", None)
.define("_WINDLL", None)
.define("_UNICODE", None)
.define("UNICODE", None)
.define("WIN32_LEAN_AND_MEAN", None)
.flag("/EHsc") //needed for C++ error unwinding
.object("setupapi.lib")
// standard MSVC flags
/* .flag("/Gd").flag("/TP").flag("/FC")
.flag("/Zi").flag("/W3").flag("/WX-")
.flag("/sdl").flag("/Oi").flag("/GL")
.flag("/Zc:wchar_t").flag("/Zc:forScope")
.flag("/Zc:inline").flag("/Gm-")
.flag("/GS").flag("/Gy")*/
.compile("ViGEmClient");
}