mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-24 06:49:17 +00:00
fix: avoid implicit clang target on native builds
This commit is contained in:
@@ -609,10 +609,14 @@ fn build_project_at_inner(
|
||||
tc_as.as_deref(),
|
||||
);
|
||||
let resolved_linker = resolve_tool("DCR_LD", tc_ld.as_deref());
|
||||
prepend_clang_target_flag(&mut build_cflags, build_target, &resolved_compiler);
|
||||
// The host triple is still used for native target-specific configuration and
|
||||
// artifact paths, but native Clang must select the platform SDK implicitly.
|
||||
// Pass --target only when the user/config explicitly requested a target.
|
||||
let compiler_target = if explicit_target { build_target } else { None };
|
||||
prepend_clang_target_flag(&mut build_cflags, compiler_target, &resolved_compiler);
|
||||
prepend_clang_target_flag(
|
||||
&mut build_ldflags,
|
||||
build_target,
|
||||
compiler_target,
|
||||
resolved_linker.as_deref().unwrap_or(&resolved_compiler),
|
||||
);
|
||||
let resolved_archiver = resolve_tool("DCR_AR", tc_ar.as_deref());
|
||||
|
||||
@@ -782,6 +782,13 @@ mod tests {
|
||||
assert_eq!(flags, vec!["-O2".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_clang_target_is_not_added_without_explicit_target() {
|
||||
let mut flags = vec!["-O3".to_string()];
|
||||
prepend_clang_target_flag(&mut flags, None, "clang");
|
||||
assert_eq!(flags, vec!["-O3".to_string()]);
|
||||
}
|
||||
|
||||
/// Test for parse_version_parts function.
|
||||
#[test]
|
||||
fn parse_version_parts() {
|
||||
|
||||
Reference in New Issue
Block a user