You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tourmaline/build.rs

21 lines
518 B
Rust

2 years ago
use serde::Deserialize;
use std::path::PathBuf;
use cargo_toml::Manifest;
#[derive(Clone, Debug, Deserialize)]
struct Metadata {
codename: String,
}
fn main() {
let manifest = Manifest::<Metadata>::from_path_with_metadata(PathBuf::from("Cargo.toml"))
.expect("Failed to read manifest (Cargo.toml)");
if let Some(package) = manifest.package {
if let Some(metadata) = package.metadata {
println!("cargo:rustc-env=TOURMALINE_CODENAME={}", metadata.codename);
}
}
}