Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: build/toolchain/cros/BUILD.gn

Issue 1491463002: build CrOS chrome with gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/toolchain/gcc_toolchain.gni") 5 import("//build/toolchain/gcc_toolchain.gni")
6 6
7 # CrOS builds must cross-compile on a Linux host for the actual CrOS
8 # device target. There are many different CrOS devices so the build
9 # system provides configuration variables that permit a CrOS build to
10 # control the cross-compilation tool chain. However, requiring such
11 # fine-grain specification is tedious for build-bots and developers.
12 # Consequently, the CrOS build system defaults to a convenience
13 # compilation mode where the compilation host is also the build target.
14 #
15 # Chrome can be compiled in this way with the gn variable:
16 #
17 # target_os = "chromeos"
18 #
19 # To perform a board-specific build, first obtain the correct system
20 # root (http://goo.gl/aFB4XH) for the board. Then configure GN to use it
21 # by setting appropriate cross-compilation variables.
22 #
23 # For example, to compile a Chrome source tree in /g/src for an
24 # auron_paine CrOS device with the system root cached in /g/.cros_cache,
25 # the following GN arguments must be provided to configure
26 # cross-compilation with Goma acceleration. (NB: additional variables
27 # will be necessary to successfully compile a working CrOS Chrome. See
28 # the definition of GYP_DEFINES inside a sysroot shell.)
29 #
30 # goma_dir = "/g/.cros_cache/common/goma+2"
31 # target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroo t_chromeos-base_chromeos-chrome.tar.xz"
32 # cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarbal ls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-lin ux-gnu/binutils-bin/2.25.51-gold"
33 # cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarba lls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-li nux-gnu/binutils-bin/2.25.51-gold"
34 # cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar"
35 # target_cpu = "x64"
36
7 declare_args() { 37 declare_args() {
8 # The CrOS build system supports many different kinds of targets across 38 # These must be specified for a board-specific build.
9 # many different architectures. Bringing your own toolchain is also supported,
10 # so it's actually impossible to enumerate all toolchains for all targets
11 # as GN toolchain specifications.
12 # These arguments provide a mechanism for specifying your CC, CXX and AR at
13 # buildfile-generation time, allowing the CrOS build system to always use
14 # the right tools for the current target.
15 cros_target_cc = "" 39 cros_target_cc = ""
16 cros_target_cxx = "" 40 cros_target_cxx = ""
17 cros_target_ar = "" 41 cros_target_ar = ""
18 } 42 }
19 43
44 clang_toolchain("clang_target") {
45 toolchain_cpu = target_cpu
46 toolchain_os = "linux"
47 }
48
20 gcc_toolchain("target") { 49 gcc_toolchain("target") {
21 assert(cros_target_cc != "", "Must provide target CC.") 50 # These defaults permit building on a Linux host as described above.
22 assert(cros_target_cxx != "", "Must provide target CXX.") 51 cc = "gcc"
23 assert(cros_target_ar != "", "Must provide target AR.") 52 cxx = "g++"
53 ar = "ar"
24 54
25 cc = "${cros_target_cc}" 55 # But to build for a specific board, the cros_* args will need to be defined.
26 cxx = "${cros_target_cxx}" 56 if (cros_target_cc != "") {
27 57 cc = "${cros_target_cc}"
28 ar = "${cros_target_ar}" 58 }
59 if (cros_target_cxx != "") {
60 cxx = "${cros_target_cxx}"
61 }
62 if (cros_target_ar != "") {
63 ar = "${cros_target_ar}"
64 }
29 ld = cxx 65 ld = cxx
30 66
31 toolchain_cpu = "${target_cpu}" 67 toolchain_cpu = target_cpu
32 toolchain_os = "linux" 68 toolchain_os = "linux"
33 is_clang = is_clang 69 is_clang = is_clang
34 use_ccache = false 70 use_ccache = false
35 use_goma = false
36 } 71 }
OLDNEW
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698