Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit 4f1ac2a

Browse files
committed
simplified build
1 parent 845e381 commit 4f1ac2a

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

bindings/rust/evmc-loader/build.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ extern crate cmake;
77

88
use cmake::Config;
99
use std::env;
10-
use std::path::{Path, PathBuf};
10+
use std::path::PathBuf;
11+
12+
fn main() {
13+
let dst = Config::new("../../../").build();
14+
15+
println!("cargo:rustc-link-lib=static=evmc-loader");
16+
println!(
17+
"cargo:rustc-link-search=native={}/build/lib/loader",
18+
dst.display()
19+
);
1120

12-
fn gen_bindings() {
1321
let bindings = bindgen::Builder::default()
1422
.header("loader.h")
1523
.generate_comments(false)
1624
// do not generate an empty enum for EVMC_ABI_VERSION
1725
.constified_enum("")
1826
// generate Rust enums for each evmc enum
1927
.rustified_enum("*")
20-
// force deriving the Hash trait on basic types (address, bytes32)
21-
.derive_hash(true)
22-
// force deriving the PratialEq trait on basic types (address, bytes32)
23-
.derive_partialeq(true)
2428
.allowlist_type("evmc_.*")
2529
.allowlist_function("evmc_.*")
2630
// TODO: consider removing this
@@ -31,17 +35,5 @@ fn gen_bindings() {
3135
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
3236
bindings
3337
.write_to_file(out_path.join("bindings.rs"))
34-
.expect("Couldn't write bindings!");
35-
}
36-
37-
fn gen_loader() {
38-
let build_dir = Config::new("../../../").build();
39-
let loader_path = Path::new(&build_dir).join("build/lib/loader");
40-
println!("cargo:rustc-link-search=native={}", loader_path.display());
41-
println!("cargo:rustc-link-lib=static=evmc-loader");
42-
}
43-
44-
fn main() {
45-
gen_loader();
46-
gen_bindings();
38+
.expect("Could not write bindings");
4739
}

0 commit comments

Comments
 (0)