mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
This updates the Bazel toolchain logic to work on macOS. Much like on Linux, I'm not testing this against a *released* LLVM, but against a from-source build. You can build and install LLVM from top-of-tree locally with CMake, or on macOS maybe use Homebrew like: ``` brew install llvm --HEAD ``` You then need to point Bazel to the installed `clang` executable if it is not placed onto your PATH (Homebrew doesn't): ``` bazel test --repo_env=CC=$HOME/homebrew/opt/llvm/bin/clang //parser:all ``` This builds and passes tests for me at least. The fuzzer feature may not work (yet) with this setup, but that can be improved incrementally as we proceed.
67 lines
1.6 KiB
INI
67 lines
1.6 KiB
INI
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
# This file is symlinked into a configured Clang toolchain repository as the
|
|
# root `BUILD` file for that repository.
|
|
|
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_toolchain", "cc_toolchain_suite")
|
|
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
|
|
|
|
cc_library(
|
|
name = "malloc",
|
|
)
|
|
|
|
filegroup(
|
|
name = "empty",
|
|
srcs = [],
|
|
)
|
|
|
|
cc_toolchain_suite(
|
|
name = "bazel_cc_toolchain",
|
|
toolchains = {
|
|
"darwin": ":cc-compiler-darwin",
|
|
"k8": ":cc-compiler-k8",
|
|
},
|
|
)
|
|
|
|
cc_toolchain(
|
|
name = "cc-compiler-k8",
|
|
all_files = ":empty",
|
|
ar_files = ":empty",
|
|
as_files = ":empty",
|
|
compiler_files = ":empty",
|
|
dwp_files = ":empty",
|
|
linker_files = ":empty",
|
|
objcopy_files = ":empty",
|
|
strip_files = ":empty",
|
|
supports_param_files = 1,
|
|
toolchain_config = ":local-k8",
|
|
toolchain_identifier = "local-k8",
|
|
)
|
|
|
|
cc_toolchain_config(
|
|
name = "local-k8",
|
|
target_cpu = "k8",
|
|
)
|
|
|
|
cc_toolchain(
|
|
name = "cc-compiler-darwin",
|
|
all_files = ":empty",
|
|
ar_files = ":empty",
|
|
as_files = ":empty",
|
|
compiler_files = ":empty",
|
|
dwp_files = ":empty",
|
|
linker_files = ":empty",
|
|
objcopy_files = ":empty",
|
|
strip_files = ":empty",
|
|
supports_param_files = 1,
|
|
toolchain_config = ":local-darwin",
|
|
toolchain_identifier = "local-darwin",
|
|
)
|
|
|
|
cc_toolchain_config(
|
|
name = "local-darwin",
|
|
target_cpu = "darwin",
|
|
)
|