summaryrefslogtreecommitdiff
path: root/libs/all_in_one/build.rs
diff options
context:
space:
mode:
authorMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-16 15:43:10 +0400
committerMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-16 15:43:10 +0400
commit0f90d0f3d30a728457e6bc5c4d1d933a8014e099 (patch)
treeb1468081a32546e8d01fba622f978cdd326cf6fd /libs/all_in_one/build.rs
parent277f38bbe89e4db57b73a4e28bf1be2f5c50ce27 (diff)
new build system
Diffstat (limited to 'libs/all_in_one/build.rs')
-rw-r--r--libs/all_in_one/build.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/all_in_one/build.rs b/libs/all_in_one/build.rs
new file mode 100644
index 0000000..25a4b99
--- /dev/null
+++ b/libs/all_in_one/build.rs
@@ -0,0 +1,27 @@
+extern crate cbindgen;
+
+use cbindgen::{Config, Language};
+use std::env;
+use std::error::Error;
+use std::path::PathBuf;
+
+/// Generates the headers for the go program.
+fn main() -> Result<(), Box<dyn Error>> {
+ let crate_dir = env::var("CARGO_MANIFEST_DIR")?;
+ let package_name = env::var("CARGO_PKG_NAME")?;
+
+ // We export the header file to build/{package_name}.h
+ let output_file = PathBuf::from("../../internal/pkg/all-in-one")
+ .join(format!("{}.h", package_name))
+ .display()
+ .to_string();
+
+ let config = Config {
+ language: Language::C,
+ ..Default::default()
+ };
+
+ cbindgen::generate_with_config(crate_dir, config)?.write_to_file(output_file);
+
+ Ok(())
+}