cleaning up

This commit is contained in:
2024-06-01 00:50:02 +02:00
parent f2610dcbb6
commit 1159fca0ec
16 changed files with 467 additions and 126 deletions

1
examples/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

View File

@ -14,9 +14,11 @@
#define CSP_BUFFER_COUNT 15
#define CSP_RDP_MAX_WINDOW 5
#define CSP_RTABLE_SIZE 10
#define CSP_USE_RDP 1
#define CSP_USE_HMAC 1
#define CSP_USE_PROMISC 1
#define CSP_USE_RTABLE 0
#define CSP_HAVE_LIBSOCKETCAN 0
#define CSP_HAVE_LIBZMQ 0

View File

@ -6,12 +6,19 @@ fn main() {
let out_dir = env::var("OUT_DIR").unwrap_or_default();
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap_or_default();
let manifest_path = PathBuf::from(&manifest_dir);
let lib_cfg_dir = "../lib/cfg/csp";
let libcsp_path = "../lib/libcsp";
let mut csp_builder = Builder::new(PathBuf::from(libcsp_path), PathBuf::from(&out_dir));
csp_builder.compiler_warnings = false;
// We always re-generate the header file.
generate_autoconf_header_file(manifest_path.clone(), &csp_builder.cfg)
.expect("generating header file failed");
// Copy the file to lib/csp/cfg as well for binding generation.
std::fs::copy(
manifest_path.join("autoconfig.h"),
PathBuf::from(&lib_cfg_dir).join("autoconfig.h"),
)
.expect("copying autoconfig.h failed");
csp_builder
.generate_autoconf_rust_file(manifest_path)
.expect("generating autoconfig.rs failed");