blob: f1a07a822832379f6b9880763226ad3ef698948f [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
declare_args() {
# The absolute path of the sysroot that is used with the target toolchain.
target_sysroot = ""
}
if (current_os == target_os && target_sysroot != "") {
sysroot = target_sysroot
} else if (is_fuchsia) {
import("//zircon/public/sysroot/cpp.gni")
sysroot = cpp_sysroot_dir
} else if (is_linux) {
if (is_host) {
# Use an older Linux sysroot to compile host tools.
sysroot = "//prebuilt/third_party/sysroot/linux"
} else {
sysroot = "//prebuilt/third_party/sysroot/ubuntu20.04"
}
} else if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
sysroot = mac_sdk_path
} else if (is_win) {
# Building C/C++ on Windows requires a complicated SDK setup
# and cannot be simplified as a single sysroot directory. Leave
# it empty.
sysroot = ""
} else if (current_cpu == "wasm32") {
sysroot = ""
} else {
# For other platforms that are not currently supported, do not define `sysroot`.
# Fail the GN and notify user.
assert(
false,
"$current_os is unsupported, no sysroot is defined for toolchain $current_toolchain")
}