Skip to content

Commit bd5758d

Browse files
committed
Add support for C/C++ compiler for Neutrino QNX: qcc
1 parent afb6d60 commit bd5758d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/lib.rs

+27
Original file line numberDiff line numberDiff line change
@@ -2092,6 +2092,26 @@ impl Build {
20922092
cmd.push_cc_arg("-pthread".into());
20932093
}
20942094
}
2095+
2096+
if target.os == "nto" {
2097+
// Select the target with `-V`, see qcc documentation:
2098+
// QNX 7.1: https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.utilities/topic/q/qcc.html
2099+
// QNX 8.0: https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/q/qcc.html
2100+
// This assumes qcc/q++ as compiler, which is currently the only supported compiler for QNX.
2101+
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
2102+
let arg = match target.arch {
2103+
"i586" => "-Vgcc_ntox86_cxx",
2104+
"aarch64" => "-Vgcc_ntoaarch64le_cxx",
2105+
"x86_64" => "-Vgcc_ntox86_64_cxx",
2106+
_ => {
2107+
return Err(Error::new(
2108+
ErrorKind::InvalidTarget,
2109+
format!("Unknown architecture for Neutrino QNX: {}", target.arch),
2110+
))
2111+
}
2112+
};
2113+
cmd.push_cc_arg(arg.into());
2114+
}
20952115
}
20962116
}
20972117

@@ -2803,6 +2823,13 @@ impl Build {
28032823
format!("arm-kmc-eabi-{}", gnu)
28042824
} else if target.arch == "aarch64" && target.vendor == "kmc" {
28052825
format!("aarch64-kmc-elf-{}", gnu)
2826+
} else if target.os == "nto" {
2827+
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
2828+
if self.cpp {
2829+
"q++".to_string()
2830+
} else {
2831+
"qcc".to_string()
2832+
}
28062833
} else if self.get_is_cross_compile()? {
28072834
let prefix = self.prefix_for_target(&raw_target);
28082835
match prefix {

0 commit comments

Comments
 (0)