aboutsummaryrefslogtreecommitdiff
path: root/ndk/checkbuild.py
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-10-14 11:06:48 -0700
committerElliott Hughes <enh@google.com>2019-10-15 13:38:07 -0700
commit7d0db89a9ef8844f928bf7c95b0e828f175e029e (patch)
treeac58e139bcec4fdd79e73d8f914752803e719f0a /ndk/checkbuild.py
parentb1f3ce3fd9c4b389e197c89181b91765c48fc05d (diff)
downloadndk-7d0db89a9ef8844f928bf7c95b0e828f175e029e.tar.gz
Move __ANDROID_NDK__ to <android/ndk-version.h>.
We did try to move this to bionic's <android/api-level.h>, but that doesn't work well because close to a release the platform build's API level goes from 10000 to 29 or 30 or whatever, at which point you can't distinguish "NDK" from "platform build but with `sdk_version` set". The only way to truly know if you're building with the NDK is if the NDK declares the fact. (Also switch to `#pragma once`.) Test: treehugger Change-Id: I5d835f1f73de6080deab691d2a0d6a91b1b03291
Diffstat (limited to 'ndk/checkbuild.py')
-rwxr-xr-xndk/checkbuild.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py
index 2aa91b4d4..5e6cf7a76 100755
--- a/ndk/checkbuild.py
+++ b/ndk/checkbuild.py
@@ -1673,8 +1673,13 @@ class Sysroot(ndk.builds.Module):
build = '0'
ndk_version_h.write(textwrap.dedent("""\
- #ifndef ANDROID_NDK_VERSION_H
- #define ANDROID_NDK_VERSION_H
+ #pragma once
+
+ /**
+ * Set to 1 if this is an NDK, unset otherwise. See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ */
+ #define __ANDROID_NDK__ 1
/**
* Major version of this NDK.
@@ -1707,8 +1712,6 @@ class Sysroot(ndk.builds.Module):
* Set to 1 if this is a canary build, 0 if not.
*/
#define __NDK_CANARY__ {canary}
-
- #endif /* ANDROID_NDK_VERSION_H */
""".format(
major=major,
minor=minor,