| 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 | 
|  | 21 # TODO bug 642014 remove this when all users of the script have been removed. | 
| 20 gyp_win_tool_path = | 22 gyp_win_tool_path = | 
| 21     rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir) | 23     rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir) | 
| 22 | 24 | 
|  | 25 # This tool will is used as a wrapper for various commands below. | 
|  | 26 tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir) | 
|  | 27 | 
| 23 if (use_goma) { | 28 if (use_goma) { | 
| 24   goma_prefix = "$goma_dir/gomacc.exe " | 29   goma_prefix = "$goma_dir/gomacc.exe " | 
| 25 } else { | 30 } else { | 
| 26   goma_prefix = "" | 31   goma_prefix = "" | 
| 27 } | 32 } | 
| 28 | 33 | 
| 29 # Copy the VS runtime DLL for the default toolchain to the root build directory | 34 # Copy the VS runtime DLL for the default toolchain to the root build directory | 
| 30 # so things will run. | 35 # so things will run. | 
| 31 if (current_toolchain == default_toolchain) { | 36 if (current_toolchain == default_toolchain) { | 
| 32   if (is_debug) { | 37   if (is_debug) { | 
| (...skipping 120 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\"" | 158       command = "$env_wrapper$cl /nologo /showIncludes /FC @$rspfile /c {{source
     }} /Fo{{output}} /Fd\"$pdbname\"" | 
| 154       depsformat = "msvc" | 159       depsformat = "msvc" | 
| 155       description = "CXX {{output}}" | 160       description = "CXX {{output}}" | 
| 156       outputs = [ | 161       outputs = [ | 
| 157         "$object_subdir/{{source_name_part}}.obj", | 162         "$object_subdir/{{source_name_part}}.obj", | 
| 158       ] | 163       ] | 
| 159       rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags
     }} {{cflags_cc}}" | 164       rspfile_content = "$sys_include_flags{{defines}} {{include_dirs}} {{cflags
     }} {{cflags_cc}}" | 
| 160     } | 165     } | 
| 161 | 166 | 
| 162     tool("rc") { | 167     tool("rc") { | 
| 163       command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{
     include_dirs}} /fo{{output}} {{source}}" | 168       command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe {{define
     s}} {{include_dirs}} /fo{{output}} {{source}}" | 
| 164       outputs = [ | 169       outputs = [ | 
| 165         "$object_subdir/{{source_name_part}}.res", | 170         "$object_subdir/{{source_name_part}}.res", | 
| 166       ] | 171       ] | 
| 167       description = "RC {{output}}" | 172       description = "RC {{output}}" | 
| 168     } | 173     } | 
| 169 | 174 | 
| 170     tool("asm") { | 175     tool("asm") { | 
| 171       if (toolchain_args.current_cpu == "x64") { | 176       if (toolchain_args.current_cpu == "x64") { | 
| 172         ml = "ml64.exe" | 177         ml = "ml64.exe" | 
| 173       } else { | 178       } else { | 
| 174         ml = "ml.exe" | 179         ml = "ml.exe" | 
| 175       } | 180       } | 
| 176       command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in
     clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" | 181       command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines}
     } {{include_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" | 
| 177       description = "ASM {{output}}" | 182       description = "ASM {{output}}" | 
| 178       outputs = [ | 183       outputs = [ | 
| 179         "$object_subdir/{{source_name_part}}.obj", | 184         "$object_subdir/{{source_name_part}}.obj", | 
| 180       ] | 185       ] | 
| 181     } | 186     } | 
| 182 | 187 | 
| 183     tool("alink") { | 188     tool("alink") { | 
| 184       rspfile = "{{output}}.rsp" | 189       rspfile = "{{output}}.rsp" | 
| 185       command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo 
     {{arflags}} /OUT:{{output}} @$rspfile" | 190       command = "$python_path $tool_wrapper_path link-wrapper $env False $lib /n
     ologo {{arflags}} /OUT:{{output}} @$rspfile" | 
| 186       description = "LIB {{output}}" | 191       description = "LIB {{output}}" | 
| 187       outputs = [ | 192       outputs = [ | 
| 188         # Ignore {{output_extension}} and always use .lib, there's no reason to | 193         # Ignore {{output_extension}} and always use .lib, there's no reason to | 
| 189         # allow targets to override this extension on Windows. | 194         # allow targets to override this extension on Windows. | 
| 190         "{{output_dir}}/{{target_output_name}}.lib", | 195         "{{output_dir}}/{{target_output_name}}.lib", | 
| 191       ] | 196       ] | 
| 192       default_output_extension = ".lib" | 197       default_output_extension = ".lib" | 
| 193       default_output_dir = "{{target_out_dir}}" | 198       default_output_dir = "{{target_out_dir}}" | 
| 194 | 199 | 
| 195       # The use of inputs_newline is to work around a fixed per-line buffer | 200       # The use of inputs_newline is to work around a fixed per-line buffer | 
| 196       # size in the linker. | 201       # size in the linker. | 
| 197       rspfile_content = "{{inputs_newline}}" | 202       rspfile_content = "{{inputs_newline}}" | 
| 198     } | 203     } | 
| 199 | 204 | 
| 200     tool("solink") { | 205     tool("solink") { | 
| 201       dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"  # e
     .g. foo.dll | 206       dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"  # e
     .g. foo.dll | 
| 202       libname = "${dllname}.lib"  # e.g. foo.dll.lib | 207       libname = "${dllname}.lib"  # e.g. foo.dll.lib | 
| 203       pdbname = "${dllname}.pdb" | 208       pdbname = "${dllname}.pdb" | 
| 204       rspfile = "${dllname}.rsp" | 209       rspfile = "${dllname}.rsp" | 
| 205       pool = "//build/toolchain:link_pool($default_toolchain)" | 210       pool = "//build/toolchain:link_pool($default_toolchain)" | 
| 206 | 211 | 
| 207       command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
      /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 212       command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
     nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 
| 208 | 213 | 
| 209       default_output_extension = ".dll" | 214       default_output_extension = ".dll" | 
| 210       default_output_dir = "{{root_out_dir}}" | 215       default_output_dir = "{{root_out_dir}}" | 
| 211       description = "LINK(DLL) {{output}}" | 216       description = "LINK(DLL) {{output}}" | 
| 212       outputs = [ | 217       outputs = [ | 
| 213         dllname, | 218         dllname, | 
| 214         libname, | 219         libname, | 
| 215       ] | 220       ] | 
| 216       link_output = libname | 221       link_output = libname | 
| 217       depend_output = libname | 222       depend_output = libname | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 230       # size in the linker. | 235       # size in the linker. | 
| 231       rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 236       rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 
| 232     } | 237     } | 
| 233 | 238 | 
| 234     tool("solink_module") { | 239     tool("solink_module") { | 
| 235       dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"  # e
     .g. foo.dll | 240       dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"  # e
     .g. foo.dll | 
| 236       pdbname = "${dllname}.pdb" | 241       pdbname = "${dllname}.pdb" | 
| 237       rspfile = "${dllname}.rsp" | 242       rspfile = "${dllname}.rsp" | 
| 238       pool = "//build/toolchain:link_pool($default_toolchain)" | 243       pool = "//build/toolchain:link_pool($default_toolchain)" | 
| 239 | 244 | 
| 240       command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
      /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 245       command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
     nologo /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 
| 241 | 246 | 
| 242       default_output_extension = ".dll" | 247       default_output_extension = ".dll" | 
| 243       default_output_dir = "{{root_out_dir}}" | 248       default_output_dir = "{{root_out_dir}}" | 
| 244       description = "LINK_MODULE(DLL) {{output}}" | 249       description = "LINK_MODULE(DLL) {{output}}" | 
| 245       outputs = [ | 250       outputs = [ | 
| 246         dllname, | 251         dllname, | 
| 247       ] | 252       ] | 
| 248       if (symbol_level != 0) { | 253       if (symbol_level != 0) { | 
| 249         outputs += [ pdbname ] | 254         outputs += [ pdbname ] | 
| 250       } | 255       } | 
| 251       runtime_outputs = outputs | 256       runtime_outputs = outputs | 
| 252 | 257 | 
| 253       # The use of inputs_newline is to work around a fixed per-line buffer | 258       # The use of inputs_newline is to work around a fixed per-line buffer | 
| 254       # size in the linker. | 259       # size in the linker. | 
| 255       rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 260       rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 
| 256     } | 261     } | 
| 257 | 262 | 
| 258     tool("link") { | 263     tool("link") { | 
| 259       exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 264       exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 
| 260       pdbname = "$exename.pdb" | 265       pdbname = "$exename.pdb" | 
| 261       rspfile = "$exename.rsp" | 266       rspfile = "$exename.rsp" | 
| 262       pool = "//build/toolchain:link_pool($default_toolchain)" | 267       pool = "//build/toolchain:link_pool($default_toolchain)" | 
| 263 | 268 | 
| 264       command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
      /OUT:$exename /PDB:$pdbname @$rspfile" | 269       command = "$python_path $tool_wrapper_path link-wrapper $env False $link /
     nologo /OUT:$exename /PDB:$pdbname @$rspfile" | 
| 265 | 270 | 
| 266       default_output_extension = ".exe" | 271       default_output_extension = ".exe" | 
| 267       default_output_dir = "{{root_out_dir}}" | 272       default_output_dir = "{{root_out_dir}}" | 
| 268       description = "LINK {{output}}" | 273       description = "LINK {{output}}" | 
| 269       outputs = [ | 274       outputs = [ | 
| 270         exename, | 275         exename, | 
| 271       ] | 276       ] | 
| 272       if (symbol_level != 0) { | 277       if (symbol_level != 0) { | 
| 273         outputs += [ pdbname ] | 278         outputs += [ pdbname ] | 
| 274       } | 279       } | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 422   msvc_toolchain("winrt_x64") { | 427   msvc_toolchain("winrt_x64") { | 
| 423     environment = "environment.winrt_x64" | 428     environment = "environment.winrt_x64" | 
| 424     cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 429     cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 
| 425 | 430 | 
| 426     toolchain_args = { | 431     toolchain_args = { | 
| 427       is_clang = false | 432       is_clang = false | 
| 428       current_cpu = "x64" | 433       current_cpu = "x64" | 
| 429     } | 434     } | 
| 430   } | 435   } | 
| 431 } | 436 } | 
| OLD | NEW | 
|---|