Use _DYNAMIC_LINK_ACTIONS in more places (#170)

1 file changed
tree: d7ac31be92a8107b440f0f65cb2e774647a20162
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. constraints/
  5. crosstool/
  6. doc/
  7. lib/
  8. platforms/
  9. rules/
  10. test/
  11. tools/
  12. .gitignore
  13. .pre-commit-config.yaml
  14. AUTHORS
  15. BUILD
  16. CODEOWNERS
  17. CONTRIBUTING.md
  18. LICENSE
  19. MODULE.bazel
  20. README.md
  21. WORKSPACE
README.md

Apple Support for Bazel

This repository contains the Apple CC toolchain, Apple related platforms and constraints definitions, and small helper functions for rules authors targeting Apple platforms.

If you want to build iOS, tvOS, watchOS, or macOS apps, use rules_apple.

If you want to build Swift use rules_swift.

See the documentation for the helper rules provided by this repository.

Installation

Copy the MODULE.bazel or WORKSPACE snippets from the releases page into your project.

Toolchain setup

The Apple CC toolchain in by this repository provides toolchains for building for Apple platforms besides macOS. Since Bazel 7 this toolchain is required when targeting those platforms but the toolchain also supports Bazel 6.

To use the Apple CC toolchain, pull this repository into your build and add this to your .bazelrc:

build --enable_platform_specific_config
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain

This ensures that all rules provided by rules_apple, as well as other rules like cc_binary, all use the toolchain provided by this repository when building on macOS.

NOTE: This toolchain requires a full Xcode installation, not just the Xcode Command Line Tools. If you only need to build for macOS and don't want to require a full Xcode installation in your build, use the builtin Unix toolchain provided by Bazel.

Incompatible toolchain resolution

Bazel is currently working on migrating C++ toolchain configuration to a new discovery method that no longer uses the --*crosstool_top flags. If you would like to test this upcoming feature, or need to use this in your build for other reasons, you can use this toolchain with --incompatible_enable_cc_toolchain_resolution as long as you provide a platform_mappings file. Please file any issues you find as you test this work in progress configuration.