| # Copyright 2023 The Cobalt Authors. All Rights Reserved. |
| # |
| # 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 |
| # |
| # http://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. |
| |
| import("//build/config/win/visual_studio_version.gni") |
| import("//build/toolchain/gcc_toolchain.gni") |
| |
| template("cobalt_clang_toolchain") { |
| gcc_toolchain(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "native_linker_path", |
| "executable_extension", |
| "tail_lib_dependencies", |
| ]) |
| if (defined(invoker.shlib_extension)) { |
| shlib_extension = invoker.shlib_extension |
| } |
| assert(defined(native_linker_path), |
| "native_linker_path has to be defined by the platform") |
| if (!is_host_win) { |
| prefix = rebase_path("$clang_base_path/bin", root_build_dir) |
| cc = "$prefix/clang" |
| cxx = "$prefix/clang++" |
| ld = native_linker_path |
| readelf = "readelf" |
| ar = "${prefix}/llvm-ar" |
| nm = "nm" |
| } else { |
| prefix = llvm_clang_path |
| cc = "$prefix/clang.exe" |
| cxx = "$prefix/clang++.exe" |
| ld = native_linker_path |
| readelf = "$prefix/llvm-readobj.exe" |
| ar = "${prefix}/llvm-ar.exe" |
| nm = "${prefix}/llvm-nm.exe" |
| } |
| toolchain_args = { |
| if (defined(invoker.toolchain_args)) { |
| forward_variables_from(invoker.toolchain_args, "*") |
| } |
| is_clang = true |
| } |
| } |
| } |