Skip to content

Commit

Permalink
Fix create_compile_object_cmd
Browse files Browse the repository at this point in the history
Signed-off-by: Jiahao XU <[email protected]>
NobodyXu committed Mar 30, 2024
1 parent 6237e2e commit f573a66
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1579,6 +1579,8 @@ impl Build {
let target = self.get_target()?;
let msvc = target.contains("msvc");
let compiler = self.try_get_compiler()?;
let clang = compiler.is_like_clang();
let gnu = compiler.family == ToolFamily::Gnu;

let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm);
let (mut cmd, name) = if is_assembler_msvc {
@@ -1600,13 +1602,16 @@ impl Build {
)
};
let is_arm = target.contains("aarch64") || target.contains("arm");
if is_assembler_msvc || compiler.is_like_msvc() {
let mut out_arg = OsString::from("-Fo");
out_arg.push(&obj.dst);
cmd.arg(out_arg);
} else {
cmd.arg("-o").arg(&obj.dst);
}
command_add_output_file(
&mut cmd,
&obj.dst,
self.cuda,
is_assembler_msvc || compiler.is_like_msvc(),
clang,
gnu,
is_asm,
is_arm,
);
// armasm and armasm64 don't requrie -c option
if !is_assembler_msvc || !is_arm {
cmd.arg("-c");

0 comments on commit f573a66

Please sign in to comment.