| 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 14 matching lines...) Expand all Loading... |
| 25 # -1 means auto-set (off in release, regular in debug). | 25 # -1 means auto-set (off in release, regular in debug). |
| 26 symbol_level = -1 | 26 symbol_level = -1 |
| 27 | 27 |
| 28 # Component build. | 28 # Component build. |
| 29 is_component_build = false | 29 is_component_build = false |
| 30 | 30 |
| 31 # Debug build. | 31 # Debug build. |
| 32 is_debug = true | 32 is_debug = true |
| 33 | 33 |
| 34 # Whether we're a traditional desktop unix. | 34 # Whether we're a traditional desktop unix. |
| 35 is_desktop_linux = os == "linux" && os != "chromeos" | 35 is_desktop_linux = current_os == "linux" && current_os != "chromeos" |
| 36 | 36 |
| 37 # Set to true when compiling with the Clang compiler. Typically this is used | 37 # Set to true when compiling with the Clang compiler. Typically this is used |
| 38 # to configure warnings. | 38 # to configure warnings. |
| 39 is_clang = os == "mac" || os == "ios" || os == "linux" || os == "chromeos" | 39 is_clang = current_os == "mac" || current_os == "ios" || |
| 40 current_os == "linux" || current_os == "chromeos" |
| 40 | 41 |
| 41 # Selects the desired build flavor. Official builds get additional | 42 # Selects the desired build flavor. Official builds get additional |
| 42 # processing to prepare for release. Normally you will want to develop and | 43 # processing to prepare for release. Normally you will want to develop and |
| 43 # test with this flag off. | 44 # test with this flag off. |
| 44 is_official_build = false | 45 is_official_build = false |
| 45 | 46 |
| 46 # Select the desired branding flavor. False means normal Chromium branding, | 47 # Select the desired branding flavor. False means normal Chromium branding, |
| 47 # true means official Google Chrome branding (requires extra Google-internal | 48 # true means official Google Chrome branding (requires extra Google-internal |
| 48 # resources). | 49 # resources). |
| 49 is_chrome_branded = false | 50 is_chrome_branded = false |
| 50 | 51 |
| 51 # Compile for Address Sanitizer to find memory bugs. | 52 # Compile for Address Sanitizer to find memory bugs. |
| 52 is_asan = false | 53 is_asan = false |
| 53 | 54 |
| 54 # Compile for Leak Sanitizer to find leaks. | 55 # Compile for Leak Sanitizer to find leaks. |
| 55 is_lsan = false | 56 is_lsan = false |
| 56 | 57 |
| 57 # Compile for Memory Sanitizer to find uninitialized reads. | 58 # Compile for Memory Sanitizer to find uninitialized reads. |
| 58 is_msan = false | 59 is_msan = false |
| 59 | 60 |
| 60 # Compile for Thread Sanitizer to find threading bugs. | 61 # Compile for Thread Sanitizer to find threading bugs. |
| 61 is_tsan = false | 62 is_tsan = false |
| 62 | 63 |
| 63 if (os == "chromeos") { | 64 if (current_os == "chromeos") { |
| 64 # Allows the target toolchain to be injected as arguments. This is needed | 65 # Allows the target toolchain to be injected as arguments. This is needed |
| 65 # to support the CrOS build system which supports per-build-configuration | 66 # to support the CrOS build system which supports per-build-configuration |
| 66 # toolchains. | 67 # toolchains. |
| 67 cros_use_custom_toolchain = false | 68 cros_use_custom_toolchain = false |
| 68 } | 69 } |
| 69 | 70 |
| 70 # TODO(cjhopman): Make target_arch work for all platforms. | 71 # TODO(cjhopman): Make target_arch work for all platforms. |
| 71 | 72 |
| 72 # Architecture of the target device. For Android builds, this will be equal to | 73 # Architecture of the target device. For Android builds, this will be |
| 73 # the cpu_arch of the default toolchain. When checking the CPU architecture | 74 # equal to the current_cpu of the default toolchain. When checking |
| 74 # for source files and build dependencies you should almost alway use cpu_arch | 75 # the CPU architecture for source files and build dependencies you |
| 75 # instead. cpu_arch is the architecture of the current toolchain and allows | 76 # should almost alway use current_cpu instead. current_cpu is the |
| 76 # cross-compiles (compiling the same target for multiple toolchains in the | 77 # architecture of the current toolchain and allows cross-compiles |
| 77 # same build) to work. | 78 # (compiling the same target for multiple toolchains in the same build) |
| 79 # to work. |
| 78 target_arch = "arm" | 80 target_arch = "arm" |
| 79 | 81 |
| 80 # TODO(brettw) remove this flag (and therefore enable linking all targets) on | 82 # TODO(brettw) remove this flag (and therefore enable linking all targets) on |
| 81 # Windows when we have sufficient bot capacity. In the meantime, you can | 83 # Windows when we have sufficient bot capacity. In the meantime, you can |
| 82 # enable linking for local compiles. | 84 # enable linking for local compiles. |
| 83 link_chrome_on_windows = true | 85 link_chrome_on_windows = true |
| 84 } | 86 } |
| 85 | 87 |
| 86 # ============================================================================= | 88 # ============================================================================= |
| 87 # OS DEFINITIONS | 89 # OS DEFINITIONS |
| 88 # ============================================================================= | 90 # ============================================================================= |
| 89 # | 91 # |
| 90 # We set these various is_FOO booleans for convenience in writing OS-based | 92 # We set these various is_FOO booleans for convenience in writing OS-based |
| 91 # conditions. | 93 # conditions. |
| 92 # | 94 # |
| 93 # - is_android, is_chromeos, is_ios, and is_win should be obvious. | 95 # - is_android, is_chromeos, is_ios, and is_win should be obvious. |
| 94 # - is_mac is set only for desktop Mac. It is not set on iOS. | 96 # - is_mac is set only for desktop Mac. It is not set on iOS. |
| 95 # - is_posix is true for mac and any Unix-like system (basically everything | 97 # - is_posix is true for mac and any Unix-like system (basically everything |
| 96 # except Windows). | 98 # except Windows). |
| 97 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is | 99 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is |
| 98 # generally too different despite being based on the Linux kernel). | 100 # generally too different despite being based on the Linux kernel). |
| 99 # | 101 # |
| 100 # Do not add more is_* variants here for random lesser-used Unix systems like | 102 # Do not add more is_* variants here for random lesser-used Unix systems like |
| 101 # aix or one of the BSDs. If you need to check these, just check the os value | 103 # aix or one of the BSDs. If you need to check these, just check the |
| 102 # directly. | 104 # current_os value directly. |
| 103 | 105 |
| 104 if (os == "win") { | 106 if (current_os == "win") { |
| 105 is_android = false | 107 is_android = false |
| 106 is_chromeos = false | 108 is_chromeos = false |
| 107 is_ios = false | 109 is_ios = false |
| 108 is_linux = false | 110 is_linux = false |
| 109 is_mac = false | 111 is_mac = false |
| 110 is_nacl = false | 112 is_nacl = false |
| 111 is_posix = false | 113 is_posix = false |
| 112 is_win = true | 114 is_win = true |
| 113 } else if (os == "mac") { | 115 } else if (current_os == "mac") { |
| 114 is_android = false | 116 is_android = false |
| 115 is_chromeos = false | 117 is_chromeos = false |
| 116 is_ios = false | 118 is_ios = false |
| 117 is_linux = false | 119 is_linux = false |
| 118 is_mac = true | 120 is_mac = true |
| 119 is_nacl = false | 121 is_nacl = false |
| 120 is_posix = true | 122 is_posix = true |
| 121 is_win = false | 123 is_win = false |
| 122 } else if (os == "android") { | 124 } else if (current_os == "android") { |
| 123 is_android = true | 125 is_android = true |
| 124 is_chromeos = false | 126 is_chromeos = false |
| 125 is_ios = false | 127 is_ios = false |
| 126 is_linux = false | 128 is_linux = false |
| 127 is_mac = false | 129 is_mac = false |
| 128 is_nacl = false | 130 is_nacl = false |
| 129 is_posix = true | 131 is_posix = true |
| 130 is_win = false | 132 is_win = false |
| 131 } else if (os == "chromeos") { | 133 } else if (current_os == "chromeos") { |
| 132 is_android = false | 134 is_android = false |
| 133 is_chromeos = true | 135 is_chromeos = true |
| 134 is_ios = false | 136 is_ios = false |
| 135 is_linux = true | 137 is_linux = true |
| 136 is_mac = false | 138 is_mac = false |
| 137 is_nacl = false | 139 is_nacl = false |
| 138 is_posix = true | 140 is_posix = true |
| 139 is_win = false | 141 is_win = false |
| 140 } else if (os == "nacl") { | 142 } else if (current_os == "nacl") { |
| 141 # os == "nacl" will be passed by the nacl toolchain definition. It is not | 143 # os == "nacl" will be passed by the nacl toolchain definition. It is not |
| 142 # set by default or on the command line. We treat is as a Posix variant. | 144 # set by default or on the command line. We treat is as a Posix variant. |
| 143 is_android = false | 145 is_android = false |
| 144 is_chromeos = false | 146 is_chromeos = false |
| 145 is_ios = false | 147 is_ios = false |
| 146 is_linux = false | 148 is_linux = false |
| 147 is_mac = false | 149 is_mac = false |
| 148 is_nacl = true | 150 is_nacl = true |
| 149 is_posix = true | 151 is_posix = true |
| 150 is_win = false | 152 is_win = false |
| 151 } else if (os == "ios") { | 153 } else if (current_os == "ios") { |
| 152 is_android = false | 154 is_android = false |
| 153 is_chromeos = false | 155 is_chromeos = false |
| 154 is_ios = true | 156 is_ios = true |
| 155 is_linux = false | 157 is_linux = false |
| 156 is_mac = false | 158 is_mac = false |
| 157 is_nacl = false | 159 is_nacl = false |
| 158 is_posix = true | 160 is_posix = true |
| 159 is_win = false | 161 is_win = false |
| 160 } else if (os == "linux") { | 162 } else if (current_os == "linux") { |
| 161 is_android = false | 163 is_android = false |
| 162 is_chromeos = false | 164 is_chromeos = false |
| 163 is_ios = false | 165 is_ios = false |
| 164 is_linux = true | 166 is_linux = true |
| 165 is_mac = false | 167 is_mac = false |
| 166 is_nacl = false | 168 is_nacl = false |
| 167 is_posix = true | 169 is_posix = true |
| 168 is_win = false | 170 is_win = false |
| 169 } | 171 } |
| 170 | 172 |
| 171 # ============================================================================= | 173 # ============================================================================= |
| 172 # CPU ARCHITECTURE | 174 # CPU ARCHITECTURE |
| 173 # ============================================================================= | 175 # ============================================================================= |
| 174 | 176 |
| 175 if (is_android) { | 177 if (is_android) { |
| 176 # TODO(cjhopman): enable this assert once bots are updated to not set | 178 # TODO(cjhopman): enable this assert once bots are updated to not set |
| 177 # cpu_arch. | 179 # current_cpu. |
| 178 #assert(cpu_arch == build_cpu_arch, "Android device target architecture should | 180 #assert(current_cpu == host_cpu, "Android device target architecture should |
| 179 # be set with 'target_arch', not 'cpu_arch'") | 181 # be set with 'target_arch', not 'current_cpu'") |
| 180 cpu_arch = target_arch | 182 current_cpu = target_arch |
| 181 } | 183 } |
| 182 | 184 |
| 183 # ============================================================================= | 185 # ============================================================================= |
| 184 # SOURCES FILTERS | 186 # SOURCES FILTERS |
| 185 # ============================================================================= | 187 # ============================================================================= |
| 186 # | 188 # |
| 187 # These patterns filter out platform-specific files when assigning to the | 189 # These patterns filter out platform-specific files when assigning to the |
| 188 # sources variable. The magic variable |sources_assignment_filter| is applied | 190 # sources variable. The magic variable |sources_assignment_filter| is applied |
| 189 # to each assignment or appending to the sources variable and matches are | 191 # to each assignment or appending to the sources variable and matches are |
| 190 # automatcally removed. | 192 # automatcally removed. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 # TOOLCHAIN SETUP | 476 # TOOLCHAIN SETUP |
| 475 # ============================================================================== | 477 # ============================================================================== |
| 476 # | 478 # |
| 477 # Here we set the default toolchain, as well as the variable host_toolchain | 479 # Here we set the default toolchain, as well as the variable host_toolchain |
| 478 # which will identify the toolchain corresponding to the local system when | 480 # which will identify the toolchain corresponding to the local system when |
| 479 # doing cross-compiles. When not cross-compiling, this will be the same as the | 481 # doing cross-compiles. When not cross-compiling, this will be the same as the |
| 480 # default toolchain. | 482 # default toolchain. |
| 481 | 483 |
| 482 if (is_win) { | 484 if (is_win) { |
| 483 # On windows we use the same toolchain for host and target by default. | 485 # On windows we use the same toolchain for host and target by default. |
| 484 # TODO(dpranke): rename the toolchains to x64 and x86 to match cpu_arch. | 486 # TODO(dpranke): rename the toolchains to x64 and x86 to match current_cpu. |
| 485 if (cpu_arch == "x64") { | 487 if (current_cpu == "x64") { |
| 486 host_toolchain = "//build/toolchain/win:64" | 488 host_toolchain = "//build/toolchain/win:64" |
| 487 } else if (cpu_arch == "x86") { | 489 } else if (current_cpu == "x86") { |
| 488 host_toolchain = "//build/toolchain/win:32" | 490 host_toolchain = "//build/toolchain/win:32" |
| 489 } | 491 } |
| 490 set_default_toolchain("$host_toolchain") | 492 set_default_toolchain("$host_toolchain") |
| 491 } else if (is_android) { | 493 } else if (is_android) { |
| 492 # Use clang for the x86/64 Linux host builds. | 494 # Use clang for the x86/64 Linux host builds. |
| 493 if (build_cpu_arch == "x86" || build_cpu_arch == "x64") { | 495 if (host_cpu == "x86" || host_cpu == "x64") { |
| 494 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" | 496 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| 495 } else { | 497 } else { |
| 496 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" | 498 host_toolchain = "//build/toolchain/linux:$host_cpu" |
| 497 } | 499 } |
| 498 set_default_toolchain("//build/toolchain/android:$cpu_arch") | 500 set_default_toolchain("//build/toolchain/android:$current_cpu") |
| 499 } else if (is_linux) { | 501 } else if (is_linux) { |
| 500 if (is_clang) { | 502 if (is_clang) { |
| 501 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" | 503 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| 502 set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch") | 504 set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") |
| 503 } else { | 505 } else { |
| 504 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" | 506 host_toolchain = "//build/toolchain/linux:$host_cpu" |
| 505 set_default_toolchain("//build/toolchain/linux:$cpu_arch") | 507 set_default_toolchain("//build/toolchain/linux:$current_cpu") |
| 506 } | 508 } |
| 507 if (is_chromeos && cros_use_custom_toolchain) { | 509 if (is_chromeos && cros_use_custom_toolchain) { |
| 508 set_default_toolchain("//build/toolchain/cros:target") | 510 set_default_toolchain("//build/toolchain/cros:target") |
| 509 } | 511 } |
| 510 } else if (is_mac) { | 512 } else if (is_mac) { |
| 511 host_toolchain = "//build/toolchain/mac:clang" | 513 host_toolchain = "//build/toolchain/mac:clang" |
| 512 set_default_toolchain(host_toolchain) | 514 set_default_toolchain(host_toolchain) |
| 513 } else if (is_ios) { | 515 } else if (is_ios) { |
| 514 host_toolchain = "//build/toolchain/mac:host_clang" | 516 host_toolchain = "//build/toolchain/mac:host_clang" |
| 515 set_default_toolchain("//build/toolchain/mac:clang") | 517 set_default_toolchain("//build/toolchain/mac:clang") |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 } | 717 } |
| 716 if (defined(invoker.testonly)) { | 718 if (defined(invoker.testonly)) { |
| 717 testonly = invoker.testonly | 719 testonly = invoker.testonly |
| 718 } | 720 } |
| 719 if (defined(invoker.visibility)) { | 721 if (defined(invoker.visibility)) { |
| 720 visibility = invoker.visibility | 722 visibility = invoker.visibility |
| 721 } | 723 } |
| 722 } | 724 } |
| 723 } | 725 } |
| 724 } | 726 } |
| OLD | NEW |