blob: b4b39daf711fb0ea694b98047ed088193b49950d [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")
declare_args() {
# Generate Linker map files. Can skip since they can
# be quite large.
#
# Note that toolchains can individually override this
chip_generate_link_map_file = true
}
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
} else {
link_generate_map_file = chip_generate_link_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 ]
}
}