feat: added header file for communicating config
This commit is contained in:
@@ -4,3 +4,6 @@ edition = "2021"
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69"
|
||||
|
||||
15
sparse-actions/build.rs
Normal file
15
sparse-actions/build.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use std::{env, path::Path};
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
|
||||
let dest_bindings = Path::new(&out_dir).join("bindings.rs");
|
||||
|
||||
bindgen::Builder::default()
|
||||
.header("../unix-loader/src/abi.h")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.generate()
|
||||
.expect("unable to generate bindings")
|
||||
.write_to_file(dest_bindings)
|
||||
.expect("could not write bidnings");
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub mod payload_types {
|
||||
include!(concat!(std::env!("OUT_DIR"), "/bindings.rs"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user