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.
malachite/build.rs

21 lines
517 B
Rust

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=MALACHITE_CODENAME={}", metadata.codename);
}
}
}