mirror of https://github.com/status-im/evmc.git
Add basic Rust bindings
This commit is contained in:
parent
f6b10594ce
commit
58906e218b
|
@ -24,3 +24,6 @@ serialize = {major}
|
|||
search = EVMC_ABI_VERSION = {current_version}
|
||||
replace = EVMC_ABI_VERSION = {new_version}
|
||||
|
||||
[bumpversion:file:bindings/rust/Cargo.toml]
|
||||
search = version = \"{current_version}\"
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/target
|
||||
**/*.rs.bk
|
||||
/Cargo.lock
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "evmc-sys"
|
||||
version = "6.2.0-dev"
|
||||
authors = ["Alex Beregszaszi <alex@rtfs.hu>"]
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/ethereum/evmc"
|
||||
description = "Bindings to EVMC (low-level)"
|
||||
categories = ["external-ffi-bindings"]
|
||||
edition = "2018"
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.48.0"
|
|
@ -0,0 +1,25 @@
|
|||
extern crate bindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn gen_bindings() {
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("evmc.h")
|
||||
// See https://github.com/rust-lang-nursery/rust-bindgen/issues/947
|
||||
.trust_clang_mangling(false)
|
||||
.generate_comments(true)
|
||||
// https://github.com/rust-lang-nursery/rust-bindgen/issues/947#issuecomment-327100002
|
||||
.layout_tests(false)
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
gen_bindings();
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../../include/evmc/evmc.h
|
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
Loading…
Reference in New Issue