ndk_library
ndk_library
def ndk_library(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str] = [],
within_view: list[str] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_apple_platforms: dict[str, str] = {},
contacts: list[str] = [],
default_host_platform: None | str = None,
deps: list[str] = [],
flags: list[str] = [],
is_asset: bool = False,
labels: list[str] = [],
licenses: list[str] = [],
srcs: list[str] = [],
) -> None
An ndk_library() is used to define a set of C/C++ files, an Android.mk and an Application.mk file that are used by the NDK's ndk-build tool to generate one or more shared objects.
Parameters
name: name of the targetdefault_target_platform: specifies the default target platform, used when no platforms are specified on the command linetarget_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configurationcompatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configurationexec_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with an execution platformvisibility: a list of visibility patterns restricting what targets can depend on this onewithin_view: a list of visibility patterns restricting what this target can depend onmetadata: a key-value map of metadata associated with this targettests: a list of targets that provide tests for this onemodifiers: an array of modifiers associated with this targetdeps: List of build targets to build before this rule.flags: Array of strings passed verbatim tondk-build. Normally this is not needed, but in some cases you may want to put something here. For example, this can be used to build the libraries in debug mode (NDK_DEBUG=1) or set the number of jobs spawned byndk-build(by default, the same as the number of cores).is_asset: Normally native shared objects end up in a directory in the root of the APK namedlib/. If this parameter is set toTrue, then these objects are placed inassets/lib/. Placing shared objects in a non-standard location prevents Android from extracting them to the device's internal storage.srcs: The set of files to compile for this rule. If not provided,buckassumes that all files with the following extensions are part of the build:c, cpp, cc, cxx, h, hpp, mk.
Details
Additional notes:
An android_binary() that includes this library will
aggregate all of the native shared objects into a directory in the
root of the APK named lib/ or assets/lib/.
Unlike the default invocation of ndk-build,
buck will put all intermediate files and build output
into a subdirectory under buck-out/gen.