ngen/src/deser.rs

44 lines
1.2 KiB
Rust

use serde::Deserialize;
use std::collections::HashMap;
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeserTarget {
pub outfile: Option<String>,
pub compiler: Option<String>,
pub compiler_flags: Option<Vec<String>>,
pub linker: Option<String>,
pub linker_flags: Option<Vec<String>>,
pub linker_libs: Option<Vec<String>>,
pub sources: Option<Vec<String>>,
pub opts: Option<DeserTargetOptions>,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeserTargetOptions {
pub inherit: Option<bool>,
pub inherit_from: Option<String>,
pub depend_on: Option<Vec<String>>,
pub default: Option<bool>,
pub compile_cmd_fmt: Option<String>,
pub link_cmd_fmt: Option<String>,
pub object_suffix: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeserConfig {
pub build_dir: Option<String>,
pub compile_commands: Option<bool>,
pub compile_commands_target: Option<String>,
}
pub type DeserTargetList = HashMap<String, DeserTarget>;
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeserNgenToml {
pub config: Option<DeserConfig>,
pub targets: Option<DeserTargetList>,
}