Skip to content

Commit

Permalink
Revert "Check __ANDROID_API__ instead of defining it"
Browse files Browse the repository at this point in the history
This reverts commit f934a0b.
  • Loading branch information
briansmith committed May 15, 2018
1 parent b98f61f commit b2fd4fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ Note in particular that if you are cross-compiling an x86 build on a 64-bit
version of Linux, then you need to have the proper gcc-multilibs and
g++-multilibs packages or equivalent installed.

On Android, you will need to define the `__ANDROID_API__` constant to at least
`21` on 64-bit and `18` on 32-bit.



Additional Features that are Useful for Development
Expand Down
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,17 @@ fn cc(file: &Path, ext: &str, target: &Target, warnings_are_errors: bool,
// http://www.openwall.com/lists/musl/2015/06/17/1
let _ = c.flag("-U_FORTIFY_SOURCE");
}
if target.os() == "android" {
// Define __ANDROID_API__ to the Android API level we want.
// Needed for Android NDK Unified Headers, see:
// https://android.googlesource.com/platform/ndk/+/master/docs/UnifiedHeaders.md#Supporting-Unified-Headers-in-Your-Build-System
if target.arch() == "aarch64" {
// Minimum API level where AArch64 is available is 21.
let _ = c.define("__ANDROID_API__", Some("21"));
} else {
let _ = c.define("__ANDROID_API__", Some("18"));
}
}

let mut c = c.get_compiler().to_command();
let _ = c.arg("-c")
Expand Down

0 comments on commit b2fd4fa

Please sign in to comment.