From 993e7ea88ac96d3c839adf5dc4e4435f474f822f Mon Sep 17 00:00:00 2001 From: Harrm Date: Tue, 23 Jul 2024 13:19:40 +0300 Subject: [PATCH] Remove orphan build script and add a README --- README.md | 7 +++++++ build.rs | 17 ----------------- 2 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 README.md delete mode 100644 build.rs diff --git a/README.md b/README.md new file mode 100644 index 0000000..fbd3404 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Kagome Rust Dependencies +This repo contains wrappers for rust library which KAGOME uses. +The crates in crates/ dir declare C API wrappers for Rust libraries and use cbindgen to generate an actual C header. +They need to be in the same CMake project so that Hunter, KAGOME's package manager, always builds them all with the same Rust compiler, otherwise conflicts in Rust runtime symbols happen when linking. +In case any of those are required in projects other than KAGOME, this repo may be repurposed in one of the following ways: + - Extract cmake/add_rust_library.cmake, cmakeConfig.cmake.in and cbingden.toml, along with crates/build-helper crate to a separate repo and use it as a dependency here and for the new project. + - Rewrite CMakeLists.txt here so that the list of the rust crates is not hardcoded, but passed as an argument to CMake, so that projects that depend on the current one may just pass the desired list of Rust-to-C binding repos. diff --git a/build.rs b/build.rs deleted file mode 100644 index a927e17..0000000 --- a/build.rs +++ /dev/null @@ -1,17 +0,0 @@ -use cbindgen::Config; -use std::env; - -fn main() { - let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let crate_dir = std::path::Path::new(&crate_dir); - - let header_file = env::var("HEADER_FILE").unwrap(); - let cbindgen_config = env::var("CBINDGEN_CONFIG").unwrap(); - - cbindgen::Builder::new() - .with_crate(crate_dir) - .with_config(Config::from_file(cbindgen_config).expect("Parsing config failed")) - .generate() - .expect("Unable to generate bindings") - .write_to_file(header_file); -}