Skip to content

Commit 82c8c7b

Browse files
authored
Add support for C/C++ compiler for Neutrino QNX: qcc (#1319)
1 parent 9185b6a commit 82c8c7b

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

@@ -2811,6 +2831,13 @@ impl Build {
28112831
format!("arm-kmc-eabi-{}", gnu)
28122832
} else if target.arch == "aarch64" && target.vendor == "kmc" {
28132833
format!("aarch64-kmc-elf-{}", gnu)
2834+
} else if target.os == "nto" {
2835+
// See for details: https://github.com/rust-lang/cc-rs/pull/1319
2836+
if self.cpp {
2837+
"q++".to_string()
2838+
} else {
2839+
"qcc".to_string()
2840+
}
28142841
} else if self.get_is_cross_compile()? {
28152842
let prefix = self.prefix_for_target(&raw_target);
28162843
match prefix {

0 commit comments

Comments
 (0)