forked from abdelhasib/RedBPF-Team-Kingoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
41 lines (33 loc) · 974 Bytes
/
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
use std::env;
use std::path::{Path, PathBuf};
use cargo_bpf_lib as cargo_bpf;
const CAPNP_SCHEMA: &'static str = "schema/ingraind.capnp";
fn main() {
let cargo = PathBuf::from(env::var("CARGO").unwrap());
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let probes = Path::new("ingraind-probes");
cargo_bpf::build(
&cargo,
&probes,
&out_dir.join("target"),
Vec::new(),
)
.expect("couldn't compile ingraind-probes");
build_capnp();
cargo_bpf::probe_files(&probes)
.expect("couldn't list probe files")
.iter()
.for_each(|file| {
println!("cargo:rerun-if-changed={}", file);
});
}
#[cfg(feature = "capnp-encoding")]
fn build_capnp() {
use capnpc::CompilerCommand;
CompilerCommand::new()
.file(CAPNP_SCHEMA)
.run()
.expect("capnp schema generation failed");
}
#[cfg(not(feature = "capnp-encoding"))]
fn build_capnp() {}