blob: 2f64a388bd249db9fa3bf56ec2aac712e9351dd1 [file] [log] [blame]
# Copyright 2019 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.
# All the $current_cpu values that `current_os == "fuchsia"` supports.
standard_fuchsia_cpus = [
"arm64",
"x64",
]
# All the {cpu, os} combinations supported as build or SDK hosts. The
# build will define toolchains for all of these. Successful
# cross-compilation may require that a sysroot be installed and configured.
standard_build_hosts = [
{
cpu = "arm64"
os = "linux"
},
{
cpu = "x64"
os = "linux"
},
]
# Cross-compiling to Mac isn't possible because of the Mach-O linker.
if (host_os == "mac") {
standard_build_hosts += [
{
cpu = "x64"
os = "mac"
},
]
}
# Universal configs that apply to all code in the build.
standard_configs = [
"$zx/public/gn/config:compiler",
"$zx/public/gn/config:language",
"$zx/public/gn/config:machine",
"$zx/public/gn/config:relative_paths",
"$zx/public/gn/config:assert_level",
"$zx/public/gn/config:opt_level",
"$zx/public/gn/config:symbol_level",
"$zx/public/gn/config:default_warnings",
"$zx/public/gn/config:default_include_dirs",
"$zx/public/gn/config:default_frame_pointers",
"$zx/public/gn/config:default_linker_gc",
"$zx/public/gn/config:no_exceptions",
"$zx/public/gn/config:no_rtti",
"$zx/public/gn/config:no_threadsafe_statics",
"$zx/public/gn/config:thread_safety_annotations",
# TODO(ZX-1895): "$zx/public/gn/config:symbol_visibility_hidden",
{
# Additional configs apply only to code built into shared libraries.
# This means everything in a ${toolchain.shlib} toolchain, not just code
# directly in the `sources` of a shared_library() or library() target.
shlib = true
add = [
"$zx/public/gn/config:shared_library_config",
"$zx/public/gn/config:no_undefined_symbols",
]
},
]
# Additional configs apply to code built for Fuchsia but not to host code.
standard_fuchsia_configs = [
"$zx/public/gn/config:nostdlib",
"$zx/public/gn/config:werror",
]
# Additional configs apply to normal userland Fuchsia code.
standard_fuchsia_user_configs = [
"$zx/public/gn/config:user",
{
shlib = false
add = [ "$zx/public/gn/config:user_executable" ]
},
]
# See environment(). These are the environments that are
# vanilla bases to make derived environments from.
standard_environments = [
{
name = "host"
targets = standard_build_hosts
globals = {
is_host = true
}
strip = true
},
{
name = "user"
targets = []
foreach(cpu, standard_fuchsia_cpus) {
targets += [
{
cpu = cpu
},
]
}
configs = standard_fuchsia_configs + standard_fuchsia_user_configs
implicit_deps = [
"$zx/system/ulib/c",
{
types = [
"executable",
"host_tool",
"test",
]
add = [ "$zx/system/ulib/c:crt1" ]
},
{
types = [ "host_tool" ]
add = [ "$zx/system/ulib/fdio" ]
},
{
# The "driver_deps" target represents the execution environment
# into which driver modules get loaded. This represents the
# vanilla (or configured) environment. Variants can remove this
# and add a different variant driver_deps label that represents the
# execution environment those drivers should get.
types = [ "driver" ]
add = [ "$zx/system/core/devmgr:driver_deps" ]
},
]
shlib = true
strip = "--strip-sections"
},
]
# This list has the same structure as $variants (see
# $zx/public/gn/toolchain/environment.gni) but it just supplies definitions
# of variants with standard names. The $variants list can refer to
# variants defined here by name, but these are not otherwise involved in
# variant selection.
standard_variants = [
{
variant = {
name = "clang"
}
},
{
variant = {
name = "gcc"
tags = [ "gcc" ]
globals = {
is_gcc = true
}
}
},
{
variant = {
name = "lto"
configs = [ "$zx/public/gn/config/lto" ]
}
},
{
variant = {
name = "thinlto"
configs = [ "$zx/public/gn/config/lto:thinlto" ]
}
},
]
# This list is appended to the $variants list for the build. It provides
# default selectors that match if nothing else does. The first catch-all
# selector must be compatible with all environments used in
# environment_redirect(),
default_variants = [
{
# The EFI toolchain is only supported using Clang.
# For host default to Clang.
environment = [
"efi",
"host",
]
variant = "clang"
},
{
# Otherwise default to gcc.
variant = "gcc"
},
]
# Define shorthand selectors that can be used in $variants, which see.
# This is a list of scopes. Each scope defines one shorthand.
#
# name
# Required: The name that matches a string element of $variants (or the
# part of an element before the slash).
# Type: string
#
# selectors
# Required: The expansion, a list of selectors. An element of $variants
# that matches $name is removed and the $selectors list is spliced into the
# list in its place. An element that matches "$name/something" is instead
# replaced by this $selectors list with `output_name = "something"` added
# to each element.
# Type: See $variants.
#
variant_shorthands = [
{
name = "host_gcc"
selectors = [
{
variant = "gcc"
host = true
},
]
},
]