From 40b27e3b80866cf90200bef75af340eb3d3a5b3d Mon Sep 17 00:00:00 2001 From: Jesse Brault Date: Fri, 22 Nov 2024 17:48:52 -0600 Subject: [PATCH] Add build script to build using Cargo. --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 3 +++ build.rs | 7 +++++++ 3 files changed, 28 insertions(+) create mode 100644 build.rs diff --git a/Cargo.lock b/Cargo.lock index d20b56c..9f62e53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,24 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "cc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "shlex", +] + [[package]] name = "first-rust" version = "0.1.0" +dependencies = [ + "cc", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" diff --git a/Cargo.toml b/Cargo.toml index 6325912..ee8be39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] + +[build-dependencies] +cc = '1.2.1' diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..b7c2e31 --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +fn main() { + // Tell Cargo to rerun if the c file is changed + println!("cargo:rerun-if-changed=src/test.c"); + cc::Build::new() + .file("src/test.c") + .compile("test"); +} \ No newline at end of file