| # 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/build.gni") |
| |
| import("${build_root}/config/compiler/compiler.gni") |
| |
| declare_args() { |
| # Build file to import for sysroot defaults. |
| sysroot_platform_config = "" |
| } |
| |
| if (sysroot_platform_config == "") { |
| if (current_os == "webos") { |
| sysroot_platform_config = "${build_root}/config/webos/webos_sysroot.gni" |
| } else if (is_clang && current_cpu == "arm" && current_os == "freertos") { |
| sysroot_platform_config = "${build_root}/toolchain/arm/arm_sysroot.gni" |
| } else if (current_os == "tizen") { |
| sysroot_platform_config = "${build_root}/config/tizen/tizen_sysroot.gni" |
| } |
| } |
| |
| # Allow platforms to override how sysroot flags are chosen by |
| # providing a file to import. |
| if (sysroot_platform_config != "") { |
| _platform_defaults = { |
| import(sysroot_platform_config) |
| } |
| } |
| |
| _defaults = { |
| sysroot = "" |
| runtime_library_cflags = [] |
| runtime_library_ldflags = [] |
| |
| # Update defaults with platform values, if any. |
| if (sysroot_platform_config != "") { |
| forward_variables_from(_platform_defaults, "*") |
| } |
| } |
| |
| declare_args() { |
| # Logical root directory for system headers and libraries. |
| sysroot = _defaults.sysroot |
| |
| # Extra cflags for runtime library. |
| runtime_library_cflags = _defaults.runtime_library_cflags |
| |
| # Extra ldflags for runtime library. |
| runtime_library_ldflags = _defaults.runtime_library_ldflags |
| } |