Skip to content

Commit

Permalink
Add support for C/C++ compiler for Neutrino QNX: qcc
Browse files Browse the repository at this point in the history
  • Loading branch information
flba-eb committed Dec 12, 2024
1 parent afb6d60 commit bd5758d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,26 @@ impl Build {
cmd.push_cc_arg("-pthread".into());
}
}

if target.os == "nto" {
// Select the target with `-V`, see qcc documentation:
// QNX 7.1: https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.utilities/topic/q/qcc.html
// QNX 8.0: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/q/qcc.html
// This assumes qcc/q++ as compiler, which is currently the only supported compiler for QNX.
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
let arg = match target.arch {
"i586" => "-Vgcc_ntox86_cxx",
"aarch64" => "-Vgcc_ntoaarch64le_cxx",
"x86_64" => "-Vgcc_ntox86_64_cxx",
_ => {
return Err(Error::new(
ErrorKind::InvalidTarget,
format!("Unknown architecture for Neutrino QNX: {}", target.arch),
))
}
};
cmd.push_cc_arg(arg.into());
}
}
}

Expand Down Expand Up @@ -2803,6 +2823,13 @@ impl Build {
format!("arm-kmc-eabi-{}", gnu)
} else if target.arch == "aarch64" && target.vendor == "kmc" {
format!("aarch64-kmc-elf-{}", gnu)
} else if target.os == "nto" {
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
if self.cpp {
"q++".to_string()
} else {
"qcc".to_string()
}
} else if self.get_is_cross_compile()? {
let prefix = self.prefix_for_target(&raw_target);
match prefix {
Expand Down

0 comments on commit bd5758d

Please sign in to comment.