Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using conditionally available NDK APIs #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ndk_cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ def ndk_cc_toolchain_config(
enabled = True,
),

# Optionally, allow use of APIs above the api_level, so long as the use is
# protected with a call to __builtin_available(android <version>, *).
# For more, see https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#weak-symbols-for-api-definitions
# This takes effect with NDK r26 and greater.
feature(name = "android_ndk_conditional_api_availability"),

# User-settable feature controls warning aggressiveness for compilation.
feature(name = "warnings_as_errors"),

Expand Down Expand Up @@ -682,6 +688,14 @@ def ndk_cc_toolchain_config(
],
features = ["android_unwind_tables"],
),
flag_set(
actions = actions.all_compile,
flags = [
"-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
"-Werror=unguarded-availability",
],
features = ["android_ndk_conditional_api_availability"],
),

## Options for particular compile modes:

Expand Down