blob: 6201ccab239e8af7940bc37a4a389b47443db2bc [file] [log] [blame]
# Copyright (c) 2020 Project CHIP 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
#
# 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_overrides/pigweed.gni")
import("$dir_pw_toolchain/generate_toolchain.gni")
template("gcc_toolchain") {
invoker_toolchain_args = invoker.toolchain_args
_toolchain = {
name = target_name
ar = "ar"
if (invoker_toolchain_args.is_clang) {
cc = "clang"
cxx = "clang++"
} else {
cc = "gcc"
cxx = "g++"
}
if (defined(invoker.ar)) {
ar = invoker.ar
}
if (defined(invoker.cc)) {
cc = invoker.cc
}
if (defined(invoker.cxx)) {
cxx = invoker.cxx
}
is_host_toolchain = invoker_toolchain_args.current_os == host_os
link_group = invoker_toolchain_args.current_os != "mac"
defaults = {
forward_variables_from(invoker_toolchain_args, "*")
}
}
generate_toolchains("gcc_toolchains") {
toolchains = [ _toolchain ]
}
}