* 内核编译配置

* 将kernel.config的解析代码搬入crate

* 将设置feature函数放入CargoHandler中
This commit is contained in:
Jomo
2023-11-17 21:23:01 +08:00
committed by GitHub
parent 11f78b73e7
commit e4600f7f7d
9 changed files with 331 additions and 2 deletions

View File

@ -1,5 +1,7 @@
use std::{env, path::PathBuf};
use crate::kconfig::Feature;
lazy_static! {
static ref CARGO_HANDLER_DATA: CargoHandlerData = CargoHandlerData::new();
}
@ -43,6 +45,19 @@ impl CargoHandler {
println!("cargo:rerun-if-changed={}", f.to_str().unwrap());
}
}
/// 添加features
///
/// ## Parameters
///
/// - `features` - The features to be set
pub fn emit_features(features: &[Feature]) {
for f in features.iter() {
if f.enable() {
println!("cargo:rustc-cfg=feature=\"{}\"", f.name());
}
}
}
}
/// 目标架构