blob: fba42eb8349f1fe03c8f7a18f5bc547c5f6416e6 [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
}
if (defined(invoker.link_generate_map_file)) {
link_generate_map_file = invoker.link_generate_map_file
}
is_host_toolchain = invoker_toolchain_args.current_os == host_os
link_group = invoker_toolchain_args.current_os != "mac" &&
invoker_toolchain_args.current_os != "ios"
defaults = {
forward_variables_from(invoker_toolchain_args, "*")
}
}
generate_toolchains("gcc_toolchains") {
toolchains = [ _toolchain ]
}
}