Add build script to set target configuration variable

This commit is contained in:
Ethan Girouard 2024-01-23 22:30:06 -05:00
parent 18e2a8c634
commit 1d7f27a491
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
2 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,7 @@
name = "libretunes"
version = "0.1.0"
edition = "2021"
build = "src/build.rs"
[lib]
crate-type = ["cdylib", "rlib"]

9
src/build.rs Normal file
View File

@ -0,0 +1,9 @@
// Set the target config variable to the target triple of the current build
// This is used so we can determine the target triple at compile time
// See https://stackoverflow.com/a/51311222
fn main() {
println!(
"cargo:rustc-cfg=target=\"{}\"",
std::env::var("TARGET").unwrap()
);
}