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 import("//build/config/win/visual_studio_version.gni") | 5 import("//build/config/win/visual_studio_version.gni") |
6 import("//build/toolchain/goma.gni") | 6 import("//build/toolchain/goma.gni") |
7 | 7 |
8 # Should only be running on Windows. | 8 # Should only be running on Windows. |
9 assert(is_win) | 9 assert(is_win) |
10 | 10 |
11 # Setup the Visual Studio state. | 11 # Setup the Visual Studio state. |
12 # | 12 # |
13 # Its arguments are the VS path and the compiler wrapper tool. It will write | 13 # Its arguments are the VS path and the compiler wrapper tool. It will write |
14 # "environment.x86" and "environment.x64" to the build directory and return a | 14 # "environment.x86" and "environment.x64" to the build directory and return a |
15 # list to us. | 15 # list to us. |
16 gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py", | 16 gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py", |
17 root_build_dir) | 17 root_build_dir) |
18 exec_script("setup_toolchain.py", | 18 exec_script("setup_toolchain.py", |
19 [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ]) | 19 [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ]) |
20 | 20 |
21 # This value will be inherited in the toolchain below. | 21 # This value will be inherited in the toolchain below. |
22 concurrent_links = exec_script("../get_concurrent_links.py", [], "value") | 22 concurrent_links = exec_script("../get_concurrent_links.py", [], "value") |
23 | 23 |
24 # Parameters: | 24 # Parameters: |
25 # cpu_arch: cpu_arch to pass as a build arg | 25 # cpu_arch: cpu_arch to pass as a build arg |
26 # environment: File name of environment file. | 26 # environment: File name of environment file. |
27 # force_win64 (optional): value for this build arg. | 27 # force_win64 (optional): value for this build arg. |
28 # TODO(dpranke): Get rid of force_win64? | |
brettw
2014/11/14 20:45:45
You can delete this because you should get rid of
Dirk Pranke
2014/11/14 23:03:22
Done.
| |
28 template("msvc_toolchain") { | 29 template("msvc_toolchain") { |
29 if (defined(invoker.concurrent_links)) { | 30 if (defined(invoker.concurrent_links)) { |
30 concurrent_links = invoker.concurrent_links | 31 concurrent_links = invoker.concurrent_links |
31 } | 32 } |
32 | 33 |
33 env = invoker.environment | 34 env = invoker.environment |
34 | 35 |
36 if (is_debug) { | |
37 configuration = "Debug" | |
38 } else { | |
39 configuration = "Release" | |
40 } | |
41 exec_script("../../vs_toolchain.py", ["copy_dlls", | |
42 rebase_path(root_build_dir), | |
43 configuration, | |
44 invoker.cpu_arch]) | |
45 | |
35 toolchain(target_name) { | 46 toolchain(target_name) { |
36 # Make these apply to all tools below. | 47 # Make these apply to all tools below. |
37 lib_switch = "" | 48 lib_switch = "" |
38 lib_dir_switch="/LIBPATH:" | 49 lib_dir_switch="/LIBPATH:" |
39 | 50 |
40 tool("cc") { | 51 tool("cc") { |
41 rspfile = "{{output}}.rsp" | 52 rspfile = "{{output}}.rsp" |
42 pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb" | 53 pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb" |
43 command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rsp file /c {{source}} /Fo{{output}} /Fd$pdbname" | 54 command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rsp file /c {{source}} /Fo{{output}} /Fd$pdbname" |
44 depsformat = "msvc" | 55 depsformat = "msvc" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 | 168 |
158 # Normally the build config resets the CPU architecture to 32-bits. Settin g | 169 # Normally the build config resets the CPU architecture to 32-bits. Settin g |
159 # this flag overrides that behavior. | 170 # this flag overrides that behavior. |
160 if (defined(invoker.force_win64)) { | 171 if (defined(invoker.force_win64)) { |
161 force_win64 = invoker.force_win64 | 172 force_win64 = invoker.force_win64 |
162 } | 173 } |
163 } | 174 } |
164 } | 175 } |
165 } | 176 } |
166 | 177 |
167 msvc_toolchain("32") { | 178 # TODO(dpranke): Declare both toolchains all of the time when we |
168 environment = "environment.x86" | 179 # get it sorted out how we want to support them both in a single build. |
scottmg
2014/11/13 03:49:59
note that only one of these can be enabled at a ti
Dirk Pranke
2014/11/13 05:49:36
Will do.
Dirk Pranke
2014/11/14 23:03:22
Done.
| |
169 cpu_arch = "x64" | 180 if (cpu_arch == "x86") { |
181 msvc_toolchain("32") { | |
182 environment = "environment.x86" | |
183 cpu_arch = "x86" | |
184 } | |
170 } | 185 } |
171 | 186 |
172 msvc_toolchain("64") { | 187 if (cpu_arch == "x64") { |
173 environment = "environment.x64" | 188 msvc_toolchain("64") { |
174 cpu_arch = "x64" | 189 environment = "environment.x64" |
175 force_win64 = true | 190 cpu_arch = "x64" |
191 force_win64 = true | |
192 } | |
176 } | 193 } |
OLD | NEW |