| 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/clang/clang.gni") | 5 import("//build/config/clang/clang.gni") |
| 6 import("//build/config/compiler/compiler.gni") | 6 import("//build/config/compiler/compiler.gni") |
| 7 import("//build/config/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
| 8 import("//build/config/win/visual_studio_version.gni") | 8 import("//build/config/win/visual_studio_version.gni") |
| 9 import("//build/toolchain/goma.gni") | 9 import("//build/toolchain/goma.gni") |
| 10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
| 11 | 11 |
| 12 # Should only be running on Windows. | 12 # Should only be running on Windows. |
| 13 assert(is_win) | 13 assert(is_win) |
| 14 | 14 |
| 15 # Setup the Visual Studio state. | 15 # Setup the Visual Studio state. |
| 16 # | 16 # |
| 17 # Its arguments are the VS path and the compiler wrapper tool. It will write | 17 # Its arguments are the VS path and the compiler wrapper tool. It will write |
| 18 # "environment.x86" and "environment.x64" to the build directory and return a | 18 # "environment.x86" and "environment.x64" to the build directory and return a |
| 19 # list to us. | 19 # list to us. |
| 20 gyp_win_tool_path = | 20 |
| 21 rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir) | 21 # This tool will is used as a wrapper for various commands below. |
| 22 tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir) |
| 22 | 23 |
| 23 if (use_goma) { | 24 if (use_goma) { |
| 24 goma_prefix = "$goma_dir/gomacc.exe " | 25 goma_prefix = "$goma_dir/gomacc.exe " |
| 25 } else { | 26 } else { |
| 26 goma_prefix = "" | 27 goma_prefix = "" |
| 27 } | 28 } |
| 28 | 29 |
| 29 # Copy the VS runtime DLL for the default toolchain to the root build directory | 30 # Copy the VS runtime DLL for the default toolchain to the root build directory |
| 30 # so things will run. | 31 # so things will run. |
| 31 if (current_toolchain == default_toolchain) { | 32 if (current_toolchain == default_toolchain) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 command = "$env_wrapper$cl /nologo /showIncludes /FC @$rspfile /c {{source
}} /Fo{{output}} /Fd\"$pdbname\"" | 154 command = "$env_wrapper$cl /nologo /showIncludes /FC @$rspfile /c {{source
}} /Fo{{output}} /Fd\"$pdbname\"" |
| 154 depsformat = "msvc" | 155 depsformat = "msvc" |
| 155 description = "CXX {{output}}" | 156 description = "CXX {{output}}" |
| 156 outputs = [ | 157 outputs = [ |
| 157 "$object_subdir/{{source_name_part}}.obj", | 158 "$object_subdir/{{source_name_part}}.obj", |
| 158 ] | 159 ] |
| 159 rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags
}} {{cflags_cc}}" | 160 rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags
}} {{cflags_cc}}" |
| 160 } | 161 } |
| 161 | 162 |
| 162 tool("rc") { | 163 tool("rc") { |
| 163 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{
include_dirs}} /fo{{output}} {{source}}" | 164 command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe {{define
s}} {{include_dirs}} /fo{{output}} {{source}}" |
| 164 outputs = [ | 165 outputs = [ |
| 165 "$object_subdir/{{source_name_part}}.res", | 166 "$object_subdir/{{source_name_part}}.res", |
| 166 ] | 167 ] |
| 167 description = "RC {{output}}" | 168 description = "RC {{output}}" |
| 168 } | 169 } |
| 169 | 170 |
| 170 tool("asm") { | 171 tool("asm") { |
| 171 if (toolchain_args.current_cpu == "x64") { | 172 if (toolchain_args.current_cpu == "x64") { |
| 172 ml = "ml64.exe" | 173 ml = "ml64.exe" |
| 173 } else { | 174 } else { |
| 174 ml = "ml.exe" | 175 ml = "ml.exe" |
| 175 } | 176 } |
| 176 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in
clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" | 177 command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines}
} {{include_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" |
| 177 description = "ASM {{output}}" | 178 description = "ASM {{output}}" |
| 178 outputs = [ | 179 outputs = [ |
| 179 "$object_subdir/{{source_name_part}}.obj", | 180 "$object_subdir/{{source_name_part}}.obj", |
| 180 ] | 181 ] |
| 181 } | 182 } |
| 182 | 183 |
| 183 tool("alink") { | 184 tool("alink") { |
| 184 rspfile = "{{output}}.rsp" | 185 rspfile = "{{output}}.rsp" |
| 185 command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo
{{arflags}} /OUT:{{output}} @$rspfile" | 186 command = "$python_path $tool_wrapper_path link-wrapper $env False $lib /n
ologo {{arflags}} /OUT:{{output}} @$rspfile" |
| 186 description = "LIB {{output}}" | 187 description = "LIB {{output}}" |
| 187 outputs = [ | 188 outputs = [ |
| 188 # Ignore {{output_extension}} and always use .lib, there's no reason to | 189 # Ignore {{output_extension}} and always use .lib, there's no reason to |
| 189 # allow targets to override this extension on Windows. | 190 # allow targets to override this extension on Windows. |
| 190 "{{output_dir}}/{{target_output_name}}.lib", | 191 "{{output_dir}}/{{target_output_name}}.lib", |
| 191 ] | 192 ] |
| 192 default_output_extension = ".lib" | 193 default_output_extension = ".lib" |
| 193 default_output_dir = "{{target_out_dir}}" | 194 default_output_dir = "{{target_out_dir}}" |
| 194 | 195 |
| 195 # The use of inputs_newline is to work around a fixed per-line buffer | 196 # The use of inputs_newline is to work around a fixed per-line buffer |
| 196 # size in the linker. | 197 # size in the linker. |
| 197 rspfile_content = "{{inputs_newline}}" | 198 rspfile_content = "{{inputs_newline}}" |
| 198 } | 199 } |
| 199 | 200 |
| 200 tool("solink") { | 201 tool("solink") { |
| 201 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll | 202 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll |
| 202 libname = "${dllname}.lib" # e.g. foo.dll.lib | 203 libname = "${dllname}.lib" # e.g. foo.dll.lib |
| 203 pdbname = "${dllname}.pdb" | 204 pdbname = "${dllname}.pdb" |
| 204 rspfile = "${dllname}.rsp" | 205 rspfile = "${dllname}.rsp" |
| 205 pool = "//build/toolchain:link_pool($default_toolchain)" | 206 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 206 | 207 |
| 207 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 208 command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
| 208 | 209 |
| 209 default_output_extension = ".dll" | 210 default_output_extension = ".dll" |
| 210 default_output_dir = "{{root_out_dir}}" | 211 default_output_dir = "{{root_out_dir}}" |
| 211 description = "LINK(DLL) {{output}}" | 212 description = "LINK(DLL) {{output}}" |
| 212 outputs = [ | 213 outputs = [ |
| 213 dllname, | 214 dllname, |
| 214 libname, | 215 libname, |
| 215 ] | 216 ] |
| 216 link_output = libname | 217 link_output = libname |
| 217 depend_output = libname | 218 depend_output = libname |
| (...skipping 12 matching lines...) Expand all Loading... |
| 230 # size in the linker. | 231 # size in the linker. |
| 231 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 232 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
| 232 } | 233 } |
| 233 | 234 |
| 234 tool("solink_module") { | 235 tool("solink_module") { |
| 235 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll | 236 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll |
| 236 pdbname = "${dllname}.pdb" | 237 pdbname = "${dllname}.pdb" |
| 237 rspfile = "${dllname}.rsp" | 238 rspfile = "${dllname}.rsp" |
| 238 pool = "//build/toolchain:link_pool($default_toolchain)" | 239 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 239 | 240 |
| 240 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 241 command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
nologo /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
| 241 | 242 |
| 242 default_output_extension = ".dll" | 243 default_output_extension = ".dll" |
| 243 default_output_dir = "{{root_out_dir}}" | 244 default_output_dir = "{{root_out_dir}}" |
| 244 description = "LINK_MODULE(DLL) {{output}}" | 245 description = "LINK_MODULE(DLL) {{output}}" |
| 245 outputs = [ | 246 outputs = [ |
| 246 dllname, | 247 dllname, |
| 247 ] | 248 ] |
| 248 if (symbol_level != 0) { | 249 if (symbol_level != 0) { |
| 249 outputs += [ pdbname ] | 250 outputs += [ pdbname ] |
| 250 } | 251 } |
| 251 runtime_outputs = outputs | 252 runtime_outputs = outputs |
| 252 | 253 |
| 253 # The use of inputs_newline is to work around a fixed per-line buffer | 254 # The use of inputs_newline is to work around a fixed per-line buffer |
| 254 # size in the linker. | 255 # size in the linker. |
| 255 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 256 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
| 256 } | 257 } |
| 257 | 258 |
| 258 tool("link") { | 259 tool("link") { |
| 259 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 260 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| 260 pdbname = "$exename.pdb" | 261 pdbname = "$exename.pdb" |
| 261 rspfile = "$exename.rsp" | 262 rspfile = "$exename.rsp" |
| 262 pool = "//build/toolchain:link_pool($default_toolchain)" | 263 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 263 | 264 |
| 264 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/OUT:$exename /PDB:$pdbname @$rspfile" | 265 command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
nologo /OUT:$exename /PDB:$pdbname @$rspfile" |
| 265 | 266 |
| 266 default_output_extension = ".exe" | 267 default_output_extension = ".exe" |
| 267 default_output_dir = "{{root_out_dir}}" | 268 default_output_dir = "{{root_out_dir}}" |
| 268 description = "LINK {{output}}" | 269 description = "LINK {{output}}" |
| 269 outputs = [ | 270 outputs = [ |
| 270 exename, | 271 exename, |
| 271 ] | 272 ] |
| 272 if (symbol_level != 0) { | 273 if (symbol_level != 0) { |
| 273 outputs += [ pdbname ] | 274 outputs += [ pdbname ] |
| 274 } | 275 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 clang_cl = "clang-cl" | 307 clang_cl = "clang-cl" |
| 307 } | 308 } |
| 308 | 309 |
| 309 # 32-bit toolchains. Only define these when the target architecture is 32-bit | 310 # 32-bit toolchains. Only define these when the target architecture is 32-bit |
| 310 # since we don't do any 32-bit cross compiles when targeting 64-bit (the | 311 # since we don't do any 32-bit cross compiles when targeting 64-bit (the |
| 311 # build does generate some 64-bit stuff from 32-bit target builds). | 312 # build does generate some 64-bit stuff from 32-bit target builds). |
| 312 if (target_cpu == "x86") { | 313 if (target_cpu == "x86") { |
| 313 x86_toolchain_data = exec_script("setup_toolchain.py", | 314 x86_toolchain_data = exec_script("setup_toolchain.py", |
| 314 [ | 315 [ |
| 315 visual_studio_path, | 316 visual_studio_path, |
| 316 gyp_win_tool_path, | |
| 317 windows_sdk_path, | 317 windows_sdk_path, |
| 318 visual_studio_runtime_dirs, | 318 visual_studio_runtime_dirs, |
| 319 "x86", | 319 "x86", |
| 320 "${sys_include_prefix}", | 320 "${sys_include_prefix}", |
| 321 ], | 321 ], |
| 322 "scope") | 322 "scope") |
| 323 | 323 |
| 324 msvc_toolchain("x86") { | 324 msvc_toolchain("x86") { |
| 325 environment = "environment.x86" | 325 environment = "environment.x86" |
| 326 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" | 326 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 340 current_cpu = "x86" | 340 current_cpu = "x86" |
| 341 is_clang = true | 341 is_clang = true |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 # 64-bit toolchains. | 346 # 64-bit toolchains. |
| 347 x64_toolchain_data = exec_script("setup_toolchain.py", | 347 x64_toolchain_data = exec_script("setup_toolchain.py", |
| 348 [ | 348 [ |
| 349 visual_studio_path, | 349 visual_studio_path, |
| 350 gyp_win_tool_path, | |
| 351 windows_sdk_path, | 350 windows_sdk_path, |
| 352 visual_studio_runtime_dirs, | 351 visual_studio_runtime_dirs, |
| 353 "x64", | 352 "x64", |
| 354 "${sys_include_prefix}", | 353 "${sys_include_prefix}", |
| 355 ], | 354 ], |
| 356 "scope") | 355 "scope") |
| 357 | 356 |
| 358 template("win_x64_toolchains") { | 357 template("win_x64_toolchains") { |
| 359 msvc_toolchain(target_name) { | 358 msvc_toolchain(target_name) { |
| 360 environment = "environment.x64" | 359 environment = "environment.x64" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 msvc_toolchain("winrt_x64") { | 421 msvc_toolchain("winrt_x64") { |
| 423 environment = "environment.winrt_x64" | 422 environment = "environment.winrt_x64" |
| 424 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 423 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
| 425 | 424 |
| 426 toolchain_args = { | 425 toolchain_args = { |
| 427 is_clang = false | 426 is_clang = false |
| 428 current_cpu = "x64" | 427 current_cpu = "x64" |
| 429 } | 428 } |
| 430 } | 429 } |
| 431 } | 430 } |
| OLD | NEW |