Skip to content

Commit 2a3bb18

Browse files
committed
update readme
1 parent d1f735d commit 2a3bb18

File tree

1 file changed

+56
-12
lines changed

1 file changed

+56
-12
lines changed

README.md

+56-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,58 @@
11
# Apple Support for [Bazel](https://bazel.build)
22

3-
This repository contains helper methods that support building rules that
4-
target Apple platforms. See [the
5-
docs](https://github.com/bazelbuild/apple_support/tree/master/doc) for
6-
how you can use these helpers. Also see
7-
[rules_apple](https://github.com/bazelbuild/rules_apple) and
8-
[rules_swift](https://github.com/bazelbuild/rules_swift) for more Apple
9-
platform rules.
10-
11-
## Quick setup
12-
13-
Copy the `WORKSPACE` snippet from [the releases
14-
page](https://github.com/bazelbuild/apple_support/releases).
3+
This repository contains the [Apple CC toolchain](#toolchain-setup),
4+
Apple related [platforms](platforms/BUILD) and
5+
[constraints](constraints/BUILD) definitions, and small helper functions
6+
for rules authors targeting Apple platforms.
7+
8+
If you want to build iOS, tvOS, watchOS, or macOS apps, use
9+
[`rules_apple`][rules_apple].
10+
11+
If you want to build Swift use
12+
[`rules_swift`](https://github.com/bazelbuild/rules_swift).
13+
14+
See [the documentation](doc) for the helper rules provided by this
15+
repository.
16+
17+
## Installation
18+
19+
Copy the `MODULE.bazel` or `WORKSPACE` snippets from [the releases
20+
page](https://github.com/bazelbuild/apple_support/releases) into your
21+
project.
22+
23+
## Toolchain setup
24+
25+
The Apple CC toolchain in by this repository provides toolchains for
26+
building for Apple platforms besides macOS. Since Bazel 7 this toolchain
27+
is required when targeting those platforms.
28+
29+
To use the Apple CC toolchain, pull this repository into your build and
30+
add this to your `.bazelrc`:
31+
32+
```bzl
33+
build --enable_platform_specific_config
34+
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
35+
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
36+
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
37+
```
38+
39+
This ensures that all rules provided by [`rules_apple`][rules_apple], as
40+
well as other rules like `cc_binary`, all use the toolchain provided by
41+
this repository when building on macOS.
42+
43+
NOTE: This toolchain requires a full Xcode installation, not just the
44+
Xcode Command Line Tools. If you only need to build for macOS and don't
45+
want to require a full Xcode installation in your build, use the builtin
46+
Unix toolchain provided by Bazel.
47+
48+
### Incompatible toolchain resolution
49+
50+
Bazel is currently working on migrating C++ toolchain configuration to a
51+
new discovery method that no longer uses the `--*crosstool_top` flags.
52+
If you would like to test this upcoming feature, or need to use this in
53+
your build for other reasons, you can use this toolchain with
54+
`--incompatible_enable_cc_toolchain_resolution` as long as you provide a
55+
`platform_mappings` file. Please file any issues you find as you test
56+
this work in progress configuration.
57+
58+
[rules_apple]: https://github.com/bazelbuild/rules_apple

0 commit comments

Comments
 (0)