We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0533d47 commit 3380f7fCopy full SHA for 3380f7f
build.rs
@@ -1,16 +1,21 @@
1
extern crate cc;
2
3
use std::env;
4
+use std::path::Path;
5
-fn main() {
6
+// Must be public so the build script of `std` can call it.
7
+pub fn main() {
8
match env::var("CARGO_CFG_TARGET_OS").unwrap_or_default().as_str() {
9
"android" => build_android(),
10
_ => {}
11
}
12
13
14
fn build_android() {
- let expansion = match cc::Build::new().file("src/android-api.c").try_expand() {
15
+ // Resolve `src/android-api.c` relative to this file.
16
+ // Required to support calling this from the `std` build script.
17
+ let android_api_c = Path::new(file!()).parent().unwrap().join("src/android-api.c");
18
+ let expansion = match cc::Build::new().file(android_api_c).try_expand() {
19
Ok(result) => result,
20
Err(e) => {
21
println!("failed to run C compiler: {}", e);
0 commit comments