 Chromium Code Reviews
 Chromium Code Reviews Issue 946683002:
  Fix GN os, cpu defaults for Android builds.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 946683002:
  Fix GN os, cpu defaults for Android builds.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 # ============================================================================= | 5 # ============================================================================= | 
| 6 # BUILD FLAGS | 6 # BUILD FLAGS | 
| 7 # ============================================================================= | 7 # ============================================================================= | 
| 8 # | 8 # | 
| 9 # This block lists input arguments to the build, along with their default | 9 # This block lists input arguments to the build, along with their default | 
| 10 # values. GN requires listing them explicitly so it can validate input and have | 10 # values. GN requires listing them explicitly so it can validate input and have | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 } else { | 30 } else { | 
| 31 target_os = host_os | 31 target_os = host_os | 
| 32 } | 32 } | 
| 33 } | 33 } | 
| 34 | 34 | 
| 35 if (target_cpu == "") { | 35 if (target_cpu == "") { | 
| 36 if (defined(cpu_arch)) { | 36 if (defined(cpu_arch)) { | 
| 37 # If cpu_arch is defined, it was set in an args file and needs to be | 37 # If cpu_arch is defined, it was set in an args file and needs to be | 
| 38 # used for backwards-compatibility. | 38 # used for backwards-compatibility. | 
| 39 target_cpu = cpu_arch | 39 target_cpu = cpu_arch | 
| 40 } else if (target_os == "android") { | |
| 41 # If we're building for Android, we should assume that we want to | |
| 42 # build for ARM by default, not the host_cpu (which is likely x64). | |
| 43 # This allows us to not have to specify both target_os and target_cpu | |
| 44 # on the command line. | |
| 45 target_cpu = "arm" | |
| 40 } else { | 46 } else { | 
| 41 target_cpu = host_cpu | 47 target_cpu = host_cpu | 
| 42 } | 48 } | 
| 43 } | 49 } | 
| 44 | 50 | 
| 45 if (current_cpu == "") { | 51 if (current_cpu == "") { | 
| 46 current_cpu = target_cpu | 52 current_cpu = target_cpu | 
| 47 } | 53 } | 
| 48 if (current_os == "") { | 54 if (current_os == "") { | 
| 49 current_os = target_os | 55 current_os = target_os | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 # Compile for Thread Sanitizer to find threading bugs. | 107 # Compile for Thread Sanitizer to find threading bugs. | 
| 102 is_tsan = false | 108 is_tsan = false | 
| 103 | 109 | 
| 104 if (current_os == "chromeos") { | 110 if (current_os == "chromeos") { | 
| 105 # Allows the target toolchain to be injected as arguments. This is needed | 111 # Allows the target toolchain to be injected as arguments. This is needed | 
| 106 # to support the CrOS build system which supports per-build-configuration | 112 # to support the CrOS build system which supports per-build-configuration | 
| 107 # toolchains. | 113 # toolchains. | 
| 108 cros_use_custom_toolchain = false | 114 cros_use_custom_toolchain = false | 
| 109 } | 115 } | 
| 110 | 116 | 
| 111 # TODO(dpranke): Replace target_arch with target_cpu. | |
| 112 | |
| 113 # Architecture of the target device. For Android builds, this will be | |
| 114 # equal to the current_cpu of the default toolchain. When checking | |
| 115 # the CPU architecture for source files and build dependencies you | |
| 116 # should almost alway use current_cpu instead. current_cpu is the | |
| 117 # architecture of the current toolchain and allows cross-compiles | |
| 118 # (compiling the same target for multiple toolchains in the same build) | |
| 119 # to work. | |
| 120 target_arch = "arm" | |
| 
Dirk Pranke
2015/02/20 20:06:50
I think it's perhaps best to just cut straight to
 
cjhopman
2015/02/20 20:28:19
Make them use target_cpu sgtm.
 | |
| 121 | |
| 122 # TODO(brettw) remove this flag (and therefore enable linking all targets) on | 117 # TODO(brettw) remove this flag (and therefore enable linking all targets) on | 
| 123 # Windows when we have sufficient bot capacity. In the meantime, you can | 118 # Windows when we have sufficient bot capacity. In the meantime, you can | 
| 124 # enable linking for local compiles. | 119 # enable linking for local compiles. | 
| 125 link_chrome_on_windows = true | 120 link_chrome_on_windows = true | 
| 126 } | 121 } | 
| 127 | 122 | 
| 128 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed. | 123 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed. | 
| 129 assert(current_cpu == cpu_arch) | 124 assert(current_cpu == cpu_arch) | 
| 130 assert(current_os == os) | 125 assert(current_os == os) | 
| 131 | 126 | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 is_chromeos = false | 204 is_chromeos = false | 
| 210 is_ios = false | 205 is_ios = false | 
| 211 is_linux = true | 206 is_linux = true | 
| 212 is_mac = false | 207 is_mac = false | 
| 213 is_nacl = false | 208 is_nacl = false | 
| 214 is_posix = true | 209 is_posix = true | 
| 215 is_win = false | 210 is_win = false | 
| 216 } | 211 } | 
| 217 | 212 | 
| 218 # ============================================================================= | 213 # ============================================================================= | 
| 219 # CPU ARCHITECTURE | |
| 220 # ============================================================================= | |
| 221 | |
| 222 if (is_android) { | |
| 223 # TODO(cjhopman): enable this assert once bots are updated to not set | |
| 224 # current_cpu. | |
| 225 #assert(current_cpu == host_cpu, "Android device target architecture should | |
| 226 # be set with 'target_arch', not 'current_cpu'") | |
| 227 current_cpu = target_arch | |
| 
Dirk Pranke
2015/02/20 20:06:50
This was the thing I broke in https://codereview.c
 | |
| 228 } | |
| 229 | |
| 230 # ============================================================================= | |
| 231 # SOURCES FILTERS | 214 # SOURCES FILTERS | 
| 232 # ============================================================================= | 215 # ============================================================================= | 
| 233 # | 216 # | 
| 234 # These patterns filter out platform-specific files when assigning to the | 217 # These patterns filter out platform-specific files when assigning to the | 
| 235 # sources variable. The magic variable |sources_assignment_filter| is applied | 218 # sources variable. The magic variable |sources_assignment_filter| is applied | 
| 236 # to each assignment or appending to the sources variable and matches are | 219 # to each assignment or appending to the sources variable and matches are | 
| 237 # automatcally removed. | 220 # automatcally removed. | 
| 238 # | 221 # | 
| 239 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path | 222 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path | 
| 240 # boundary = end of string or slash) are supported, and the entire string | 223 # boundary = end of string or slash) are supported, and the entire string | 
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 } | 750 } | 
| 768 if (defined(invoker.testonly)) { | 751 if (defined(invoker.testonly)) { | 
| 769 testonly = invoker.testonly | 752 testonly = invoker.testonly | 
| 770 } | 753 } | 
| 771 if (defined(invoker.visibility)) { | 754 if (defined(invoker.visibility)) { | 
| 772 visibility = invoker.visibility | 755 visibility = invoker.visibility | 
| 773 } | 756 } | 
| 774 } | 757 } | 
| 775 } | 758 } | 
| 776 } | 759 } | 
| OLD | NEW |