# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# CrOS builds must cross-compile on a Linux host for the actual CrOS
# device target. There are many different CrOS devices so the build
# system provides configuration variables that permit a CrOS build to
# control the cross-compilation tool chain. However, requiring such
# fine-grain specification is tedious for build-bots and developers.
# Consequently, the CrOS build system defaults to a convenience
# compilation mode where the compilation host is also the build target.
#
# Chrome can be compiled in this way with the gn variable:
#
# target_os = "chromeos"
#
# To perform a board-specific build, first obtain the correct system
# root (http://goo.gl/aFB4XH) for the board. Then configure GN to use it
# by setting appropriate cross-compilation variables.
#
# For example, to compile a Chrome source tree in /g/src for an
# auron_paine CrOS device with the system root cached in /g/.cros_cache,
# the following GN arguments must be provided to configure
# cross-compilation with RBE acceleration. (NB: additional variables
# will be necessary to successfully compile a working CrOS Chrome.)
#
# target_sysroot=
# /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz"
# target_cpu = "x64"

import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")

declare_args() {
  # These can be optionally set. The "_cppflags"  will be applied to *both*
  # C and C++ files; use "_cxxflags" for C++-only flags.
  cros_target_extra_cflags = ""
  cros_target_extra_cppflags = ""
  cros_target_extra_cxxflags = ""
  cros_target_extra_ldflags = ""

  cros_host_extra_cflags = ""
  cros_host_extra_cppflags = ""
  cros_host_extra_cxxflags = ""
  cros_host_extra_ldflags = ""
  cros_host_sysroot = ""

  cros_v8_snapshot_extra_cflags = ""
  cros_v8_snapshot_extra_cppflags = ""
  cros_v8_snapshot_extra_cxxflags = ""
  cros_v8_snapshot_extra_ldflags = ""
  cros_v8_snapshot_sysroot = ""
}
