| 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 "string") | 20 "string") |
| 21 | 21 |
| 22 stamp_command = "$python_path gyp-win-tool stamp \$out" | 22 stamp_command = "$python_path gyp-win-tool stamp \$out" |
| 23 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out" | 23 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out" |
| 24 | 24 |
| 25 # MSVC can't share PDB files between compilers compiling C and C++ files, so |
| 26 # we construct different names for each type. |
| 27 c_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_c.pdb" |
| 28 cc_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_cc.pdb" |
| 29 |
| 25 # 32-bit toolchain ------------------------------------------------------------- | 30 # 32-bit toolchain ------------------------------------------------------------- |
| 26 | 31 |
| 27 toolchain("32") { | 32 toolchain("32") { |
| 28 # Make these apply to all tools below. | 33 # Make these apply to all tools below. |
| 29 lib_prefix = "" | 34 lib_prefix = "" |
| 30 lib_dir_prefix="/LIBPATH:" | 35 lib_dir_prefix="/LIBPATH:" |
| 31 | 36 |
| 32 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" | 37 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out" |
| 33 tool("cc") { | 38 tool("cc") { |
| 34 command = cc_command | 39 command = cc_command + c_pdb_suffix |
| 35 description = "CC \$out" | 40 description = "CC \$out" |
| 36 rspfile = "\$out.rsp" | 41 rspfile = "\$out.rsp" |
| 37 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" | 42 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" |
| 38 depsformat = "msvc" | 43 depsformat = "msvc" |
| 39 } | 44 } |
| 40 tool("cxx") { | 45 tool("cxx") { |
| 41 command = cc_command # Same as above | 46 command = cc_command + cc_pdb_suffix |
| 42 description = "CXX \$out" | 47 description = "CXX \$out" |
| 43 rspfile = "\$out.rsp" | 48 rspfile = "\$out.rsp" |
| 44 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" | 49 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" |
| 45 depsformat = "msvc" | 50 depsformat = "msvc" |
| 46 } | 51 } |
| 47 tool("rc") { | 52 tool("rc") { |
| 48 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" | 53 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" |
| 49 description = "RC \$in" | 54 description = "RC \$in" |
| 50 } | 55 } |
| 51 tool("asm") { | 56 tool("asm") { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 81 } | 86 } |
| 82 } | 87 } |
| 83 | 88 |
| 84 # 64-bit toolchain ------------------------------------------------------------- | 89 # 64-bit toolchain ------------------------------------------------------------- |
| 85 | 90 |
| 86 toolchain("64") { | 91 toolchain("64") { |
| 87 # Make these apply to all tools below. | 92 # Make these apply to all tools below. |
| 88 lib_prefix = "" | 93 lib_prefix = "" |
| 89 lib_dir_prefix="/LIBPATH:" | 94 lib_dir_prefix="/LIBPATH:" |
| 90 | 95 |
| 91 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" | 96 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out" |
| 92 tool("cc") { | 97 tool("cc") { |
| 93 command = cc_command | 98 command = cc_command + c_pdb_suffix |
| 94 description = "CC \$out" | 99 description = "CC \$out" |
| 95 rspfile = "\$out.rsp" | 100 rspfile = "\$out.rsp" |
| 96 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" | 101 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" |
| 97 depsformat = "msvc" | 102 depsformat = "msvc" |
| 98 } | 103 } |
| 99 tool("cxx") { | 104 tool("cxx") { |
| 100 command = cc_command # Same as above | 105 command = cc_command + cc_pdb_suffix |
| 101 description = "CXX \$out" | 106 description = "CXX \$out" |
| 102 rspfile = "\$out.rsp" | 107 rspfile = "\$out.rsp" |
| 103 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" | 108 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" |
| 104 depsformat = "msvc" | 109 depsformat = "msvc" |
| 105 } | 110 } |
| 106 tool("rc") { | 111 tool("rc") { |
| 107 command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" | 112 command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" |
| 108 description = "RC \$in" | 113 description = "RC \$in" |
| 109 } | 114 } |
| 110 tool("asm") { | 115 tool("asm") { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 141 | 146 |
| 142 # When invoking this toolchain not as the default one, these args will be | 147 # When invoking this toolchain not as the default one, these args will be |
| 143 # passed to the build. They are ignored when this is the default toolchain. | 148 # passed to the build. They are ignored when this is the default toolchain. |
| 144 toolchain_args() { | 149 toolchain_args() { |
| 145 cpu_arch = "x64" | 150 cpu_arch = "x64" |
| 146 # Normally the build config resets the CPU architecture to 32-bits. Setting | 151 # Normally the build config resets the CPU architecture to 32-bits. Setting |
| 147 # this flag overrides that behavior. | 152 # this flag overrides that behavior. |
| 148 force_win64 = true | 153 force_win64 = true |
| 149 } | 154 } |
| 150 } | 155 } |
| OLD | NEW |