-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
50 lines (44 loc) · 1.57 KB
/
build.rs
File metadata and controls
50 lines (44 loc) · 1.57 KB
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
use std::{env, path::Path};
fn require_file(path: &str) {
assert!(
Path::new(path).is_file(),
"required native input is missing: {path}"
);
}
fn main() {
let simdjson_header = "third_party/simdjson/singleheader/simdjson.h";
let simdjson_source = "third_party/simdjson/singleheader/simdjson.cpp";
let bridge_header = "src/native/simdjson_bridge.h";
let bridge_source = "src/native/simdjson_bridge.cpp";
let telemetry_header = "src/native/native_alloc_telemetry.h";
let telemetry_source = "src/native/native_alloc_telemetry.cpp";
for path in [
"build.rs",
bridge_header,
bridge_source,
telemetry_header,
telemetry_source,
simdjson_header,
simdjson_source,
] {
println!("cargo:rerun-if-changed={path}");
require_file(path);
}
let target = env::var("TARGET").expect("TARGET must be set by Cargo");
// glibc only; musl targets need a different libstdc++/libc++ story and
// are out of scope for the current ABI v0.1 build contract.
if target.contains("linux-gnu") {
println!("cargo:rustc-link-arg-cdylib=-static-libstdc++");
println!("cargo:rustc-link-arg-cdylib=-static-libgcc");
println!("cargo:rustc-link-arg-cdylib=-Wl,--exclude-libs,ALL");
}
cc::Build::new()
.cpp(true)
.std("c++17")
.include("third_party/simdjson/singleheader")
.include("src/native")
.file(simdjson_source)
.file(bridge_source)
.file(telemetry_source)
.compile("pure_simdjson_native");
}