-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_toolchain: llvm_clang.BUILD -> llvm_clang_legacy.BUILD part 1/2
Copies the toolchain build file to an alternative name as part of a non-breaking transition to move the file. Bug: b/346388161 Change-Id: I088b11a466df859b27e7b75d0e2e90cae43317c7 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/229730 Lint: Lint 🤖 <[email protected]> Docs-Not-Needed: Armando Montanez <[email protected]> Commit-Queue: Auto-Submit <[email protected]> Reviewed-by: Ted Pudlik <[email protected]> Pigweed-Auto-Submit: Armando Montanez <[email protected]> Presubmit-Verified: CQ Bot Account <[email protected]>
- Loading branch information
1 parent
170ea86
commit 461c43a
Showing
4 changed files
with
235 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230 changes: 230 additions & 0 deletions
230
pw_toolchain_bazel/build_external/llvm_clang_legacy.BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
load("@bazel_skylib//rules:native_binary.bzl", "native_binary") | ||
load( | ||
"@pw_toolchain//cc_toolchain:defs.bzl", | ||
"pw_cc_action_config", | ||
"pw_cc_tool", | ||
) | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) | ||
|
||
# This build file defines a complete set of tools for a LLVM-based toolchain. | ||
|
||
exports_files(glob(["**"])) | ||
|
||
filegroup( | ||
name = "all", | ||
srcs = glob(["**"]), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
filegroup( | ||
name = "llvm-libc_arm-none-eabi_compile_files", | ||
srcs = glob([ | ||
"include/armv*-unknown-none-eabi/**", | ||
]), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
filegroup( | ||
name = "llvm-libc_arm-none-eabi_link_files", | ||
srcs = glob([ | ||
"lib/armv*-unknown-none-eabi/**", | ||
"lib/clang/*/lib/armv*-unknown-none-eabi/**", | ||
]), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
# TODO(amontanez): Add sysroot for macos to the `data` field selection once | ||
# Pigweed migrates to use rules_cc toolchains. | ||
native_binary( | ||
name = "clang-tidy", | ||
src = select({ | ||
"@platforms//os:windows": "//:bin/clang-tidy.exe", | ||
"//conditions:default": "//:bin/clang-tidy", | ||
}), | ||
data = glob([ | ||
"include/**", | ||
"lib/clang/**/include/**", | ||
]) + select({ | ||
"@platforms//os:linux": ["@linux_sysroot//:all"], | ||
"//conditions:default": [], | ||
}), | ||
out = select({ | ||
"@platforms//os:windows": "clang-tidy.exe", | ||
"//conditions:default": "clang-tidy", | ||
}), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "ar_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/llvm-ar.exe", | ||
"//conditions:default": "//:bin/llvm-ar", | ||
}), | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_tool( | ||
name = "llvm_libtool_darwin_tool", | ||
tool = "//:bin/llvm-libtool-darwin", | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "ar", | ||
action_names = ["@pw_toolchain//actions:all_ar_actions"], | ||
# Unlike most legacy features required to compile code, these features | ||
# aren't enabled by default, and are instead only implied by the built-in | ||
# action configs. We imply the features here to match the behavior of the | ||
# built-in action configs so flags are actually passed to `ar`. | ||
implies = [ | ||
"@pw_toolchain//features/legacy:archiver_flags", | ||
"@pw_toolchain//features/legacy:linker_param_file", | ||
], | ||
tools = select({ | ||
"@platforms//os:macos": [":llvm_libtool_darwin_tool"], | ||
"//conditions:default": [":ar_tool"], | ||
}), | ||
) | ||
|
||
pw_cc_tool( | ||
name = "clang++_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/clang++.exe", | ||
"//conditions:default": "//:bin/clang++", | ||
}), | ||
additional_files = glob([ | ||
"bin/llvm", | ||
"include/**", | ||
"lib/clang/**/include/**", | ||
]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "clang++", | ||
action_names = ["@pw_toolchain//actions:all_cpp_compiler_actions"], | ||
tools = [":clang++_tool"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "clang_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/clang.exe", | ||
"//conditions:default": "//:bin/clang", | ||
}), | ||
additional_files = glob([ | ||
"bin/llvm", | ||
"include/**", | ||
"lib/clang/**/include/**", | ||
]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "clang", | ||
action_names = [ | ||
"@pw_toolchain//actions:all_asm_actions", | ||
"@pw_toolchain//actions:all_c_compiler_actions", | ||
], | ||
tools = [":clang_tool"], | ||
) | ||
|
||
# This tool is actually just clang++ under the hood, we just enumerate this | ||
# tool differently to specify a different set of additional files. | ||
pw_cc_tool( | ||
name = "lld_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/clang++.exe", | ||
"//conditions:default": "//:bin/clang++", | ||
}), | ||
additional_files = glob([ | ||
"bin/llvm", | ||
"bin/lld*", | ||
"bin/ld*", | ||
"lib/**/*.a", | ||
"lib/**/*.so*", | ||
"lib/**/*.o", | ||
]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "lld", | ||
action_names = ["@pw_toolchain//actions:all_link_actions"], | ||
tools = [":lld_tool"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "llvm_cov_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/llvm-cov.exe", | ||
"//conditions:default": "//:bin/llvm-cov", | ||
}), | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "llvm-cov", | ||
action_names = ["@pw_toolchain//actions:all_coverage_actions"], | ||
tools = [":llvm_cov_tool"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "llvm_objcopy_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/llvm-objcopy.exe", | ||
"//conditions:default": "//:bin/llvm-objcopy", | ||
}), | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "llvm-objcopy", | ||
action_names = ["@pw_toolchain//actions:all_objcopy_actions"], | ||
tools = [":llvm_objcopy_tool"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "llvm_objdump_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/llvm-objdump.exe", | ||
"//conditions:default": "//:bin/llvm-objdump", | ||
}), | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "llvm-objdump", | ||
action_names = ["@pw_toolchain//actions:all_objdump_actions"], | ||
tools = [":llvm_objdump_tool"], | ||
) | ||
|
||
pw_cc_tool( | ||
name = "llvm_strip_tool", | ||
tool = select({ | ||
"@platforms//os:windows": "//:bin/llvm-strip.exe", | ||
"//conditions:default": "//:bin/llvm-strip", | ||
}), | ||
additional_files = glob(["bin/llvm"]), | ||
) | ||
|
||
pw_cc_action_config( | ||
name = "llvm-strip", | ||
action_names = ["@pw_toolchain//actions:all_strip_actions"], | ||
tools = [":llvm_strip_tool"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters