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
3 # found in the LICENSE file.
5 import("//build/config/win/visual_studio_version.gni")
6 import("//build/toolchain/goma.gni")
8 # Should only be running on Windows.
11 # Setup the Visual Studio state.
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
16 gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py",
18 exec_script("setup_toolchain.py",
19 [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ],
22 stamp_command = "$python_path gyp-win-tool stamp \$out"
23 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out"
25 # 32-bit toolchain -------------------------------------------------------------
28 # Make these apply to all tools below.
30 lib_dir_prefix="/LIBPATH:"
32 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
35 description = "CC \$out"
37 rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
41 command = cc_command # Same as above
42 description = "CXX \$out"
44 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
48 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
49 description = "RC \$in"
52 command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$defines \$includes /c /Fo \$out \$in"
53 description = "ASM \$in"
56 command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
57 description = "LIB \$out"
59 rspfile_content = "\$in_newline \$libflags"
62 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
63 description = "LINK(DLL) \$dll"
66 rspfile_content = "\$libs \$in_newline \$ldflags"
69 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
70 description = "LINK \$out"
72 rspfile_content = "\$in_newline \$libs \$ldflags"
75 command = stamp_command
76 description = "STAMP \$out"
79 command = copy_command
80 description = "COPY \$in \$out"
84 # 64-bit toolchain -------------------------------------------------------------
87 # Make these apply to all tools below.
89 lib_dir_prefix="/LIBPATH:"
91 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
94 description = "CC \$out"
96 rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
100 command = cc_command # Same as above
101 description = "CXX \$out"
102 rspfile = "\$out.rsp"
103 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
107 command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
108 description = "RC \$in"
111 command = "$python_path gyp-win-tool asm-wrapper environment.x64 ml.exe \$defines \$includes /c /Fo \$out \$in"
112 description = "ASM \$in"
115 command = "$python_path gyp-win-tool link-wrapper environment.x64 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
116 description = "LIB \$out"
117 rspfile = "\$out.rsp"
118 rspfile_content = "\$in_newline \$libflags"
121 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
122 description = "LINK(DLL) \$dll"
124 rspfile = "\$dll.rsp"
125 rspfile_content = "\$libs \$in_newline \$ldflags"
128 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
129 description = "LINK \$out"
130 rspfile = "\$out.rsp"
131 rspfile_content = "\$in_newline \$libs \$ldflags"
134 command = stamp_command
135 description = "STAMP \$out"
138 command = copy_command
139 description = "COPY \$in \$out"
142 # 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.
146 # Normally the build config resets the CPU architecture to 32-bits. Setting
147 # this flag overrides that behavior.