1# Copyright 2023 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15"""Dependency registration helpers for users of Pigweed. 16 17Before loading this bzl file, you must first: 18 19* Declare the Pigweed repository. 20* Declare the pw_toolchain repository. 21* Initialize the CIPD client repository. 22""" 23 24load( 25 "@pw_toolchain//features/macos:generate_xcode_repository.bzl", 26 "pw_xcode_command_line_tools_repository", 27) 28load( 29 "//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl", 30 "cipd_repository", 31) 32 33# buildifier: disable=unnamed-macro 34def register_pigweed_cxx_toolchains(): 35 """This function registers Pigweed's upstream toolchains. 36 37 WARNING: The configurations and permutations of these toolchains are subject 38 to change without notice. These changes may cause your build to break, so if 39 you want to minimize this churn, consider declaring your own toolchains to 40 have more control over the stability. 41 """ 42 43 # Generate xcode repository on macOS. 44 pw_xcode_command_line_tools_repository() 45 46 # Fetch llvm toolchain. 47 cipd_repository( 48 name = "llvm_toolchain", 49 build_file = "@pw_toolchain//build_external:llvm_clang.BUILD", 50 path = "fuchsia/third_party/clang/${os}-${arch}", 51 tag = "git_revision:c58bc24fcf678c55b0bf522be89eff070507a005", 52 ) 53 54 # Fetch linux sysroot for host builds. 55 cipd_repository( 56 name = "linux_sysroot", 57 path = "fuchsia/third_party/sysroot/bionic", 58 tag = "git_revision:702eb9654703a7cec1cadf93a7e3aa269d053943", 59 ) 60 61 # Fetch gcc-arm-none-eabi toolchain. 62 cipd_repository( 63 name = "gcc_arm_none_eabi_toolchain", 64 build_file = "@pw_toolchain//build_external:gcc_arm_none_eabi.BUILD", 65 path = "fuchsia/third_party/armgcc/${os}-${arch}", 66 tag = "version:2@12.2.MPACBTI-Rel1.1", 67 ) 68 69 native.register_toolchains( 70 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m0", 71 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m3", 72 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m4", 73 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m4+nofp", 74 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m33", 75 "//pw_toolchain/arm_gcc:arm_gcc_cc_toolchain_cortex-m33+nofp", 76 "//pw_toolchain/host_clang:host_cc_toolchain_linux", 77 "//pw_toolchain/host_clang:host_cc_toolchain_macos", 78 ) 79