blob: cde90f76a210f212a1b4b19040e8f8c373fc5299 [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.
default_clang_prefix =
rebase_path("//prebuilt/third_party/clang/${host_platform}/bin",
root_build_dir)
declare_args() {
# The default clang toolchain provided by the prebuilt. This variable is
# additionally consumed by the Go toolchain.
clang_prefix = default_clang_prefix
# Embed LLVM bitcode as .llvmbc section in ELF files. This is intended
# primarily for external tools that use bitcode for analysis.
clang_embed_bitcode = false
# Controls if we enable relative-vtables for C++ targets.
# TODO(fxbug.dev/45314): Set this to true in a followup one-line CL.
use_cxx_relative_vtables = true
}
if (current_cpu == "arm64") {
clang_cpu = "aarch64"
} else if (current_cpu == "x64") {
clang_cpu = "x86_64"
} else if (current_cpu == "wasm32") {
clang_cpu = "wasm32"
} else {
assert(false, "CPU not supported")
}
if (is_fuchsia) {
clang_target = "${clang_cpu}-unknown-fuchsia"
} else if (is_linux) {
clang_target = "${clang_cpu}-unknown-linux-gnu"
} else if (is_mac) {
clang_target = "${clang_cpu}-apple-darwin"
} else if (current_cpu == "wasm32" && current_os == "unknown") {
clang_target = "${clang_cpu}-unknown-unknown"
} else if (current_os == "win") {
clang_target = "${clang_cpu}-pc-windows-msvc"
} else {
assert(false, "OS not supported")
}
# TODO(phosek): this is inefficient, rather this should come from a JSON file.
clang_resource_dir =
exec_script(rebase_path("$clang_prefix/clang", "", root_build_dir),
[
"--target=$clang_target",
"-print-resource-dir",
],
"trim string",
[])
# We only provide dynamic runtime libs on Fuchsia.
if (is_fuchsia) {
# TODO(fxbug.dev/57729): Get this information from runtime.json instead.
clang_libunwind =
exec_script(rebase_path("$clang_prefix/clang++", "", root_build_dir),
[
"--target=$clang_target",
"-print-file-name=libunwind.so",
],
"trim string",
[])
}