mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 12:18:30 +00:00
feat: Implement cross-compilation with target inheritance and host defaults
This commit is contained in:
@@ -33,10 +33,24 @@ pub fn build(args: &[String]) -> i32 {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
let flags = match parse_build_run_flags(args) {
|
||||
let mut flags = match parse_build_run_flags(args) {
|
||||
Ok(v) => v,
|
||||
Err(code) => return code,
|
||||
};
|
||||
|
||||
// If no target specified, use default host target for target-specific config
|
||||
if flags.target.is_none() {
|
||||
let default_target = if cfg!(target_os = "linux") {
|
||||
"x86_64-unknown-linux-gnu"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"x86_64-apple-darwin"
|
||||
} else if cfg!(target_os = "windows") {
|
||||
"x86_64-pc-windows-msvc"
|
||||
} else {
|
||||
"unknown"
|
||||
};
|
||||
flags.target = Some(default_target.to_string());
|
||||
}
|
||||
if flags.clean {
|
||||
let mut clean_args = Vec::new();
|
||||
clean_args.push(format!("--{}", flags.profile));
|
||||
@@ -756,7 +770,7 @@ pub fn normalize_target_os(target: &str) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
fn normalize_target(target: &str, profile: &str) -> Option<String> {
|
||||
pub fn normalize_target(target: &str, profile: &str) -> Option<String> {
|
||||
let trimmed = normalize_target_os(target.trim());
|
||||
if trimmed.is_empty() {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user