apple_universal_executable
name
def name(
*,
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
_apple_platforms: dict[str, str] = ...,
_apple_toolchain: str = ...,
_apple_tools: str = ...,
_dsymutil_extra_flags: list[str],
_dsymutil_verify_dwarf: str,
dsym_uses_parallel_linker: bool = ...,
executable: str,
executable_name: None | str = ...,
labels: list[str] = ...,
split_arch_dsym: bool = ...,
universal: None | bool = ...,
) -> None
An apple_universal_executable()
rule takes a target via its binary
attribute, builds it for multiple architectures and combines the result into a single binary using lipo
.
Parameters
-
name
: name of the target -
default_target_platform
: specifies the default target platform, used when no platforms are specified on the command line -
target_compatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with a configuration -
compatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with a configuration -
exec_compatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with an execution platform -
visibility
: a list of visibility patterns restricting what targets can depend on this one -
within_view
: a list of visibility patterns restricting what this target can depend on -
metadata
: a key-value map of metadata associated with this target -
tests
: a list of targets that provide tests for this one -
modifiers
: an array of modifiers associated with this target -
executable
: A build target identifying the binary which will be built for multiple architectures. The target will be transitioned into different configurations, with distinct architectures.The target can be one of:
apple_binary()
andcxx_binary()
[shared]
subtarget ofapple_library()
andcxx_library()
apple_library()
andcxx_library()
which havepreferred_linkage = shared
attribute
-
executable_name
: By default, the name of the universal executable is same as the name of the binary from thebinary
target attribute. Setexecutable_name
to override the default. -
split_arch_dsym
: If enabled, each architecture gets its own dSYM binary. Use this if the combined universal dSYM binary exceeds 4GiB. -
universal
: Controls whether the output is universal binary. Any value overrides the presence of theconfig//cpu/constraints:universal-enabled
constraint. Read the rule docs for more information on resolution.
Details
The output of the rule is a universal binary:
- If
config//cpu/constraints:universal-enabled
is present in the target platform. - If the
universal
attribute is set toTrue
.
If none of the conditions are met, then the rule acts as a nop alias()
.
The universal
attribute, if present, takes precedence over constraint.
For example, if universal = False
, then the presence of the constraint
would not affect the output.
apple_bundle()
supports building of universal binaries,
apple_universal_executable()
is only needed if you have a standalone
binary target which is not embedded in an apple_bundle()
(usually a
CLI tool).