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/toolchain/goma.gni")
7 # Should only be running on Windows.
10 import("//build/config/win/visual_studio_version.gni")
12 # Setup the Visual Studio state.
14 # Its arguments are the VS path and the compiler wrapper tool. It will write
15 # "environment.x86" and "environment.x64" to the build directory and return a
17 gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py",
19 exec_script("setup_toolchain.py",
20 [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ],
23 stamp_command = "$python_path gyp-win-tool stamp \$out"
24 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out"
27 # Add the Goma compiler prefixes to the GYP file.
28 gyp_header = "'make_global_settings': [ $make_goma_global_settings ],"
31 # 32-bit toolchain -------------------------------------------------------------
34 # Make these apply to all tools below.
36 lib_dir_prefix="/LIBPATH:"
38 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
41 description = "CC \$out"
43 rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
47 command = cc_command # Same as above
48 description = "CXX \$out"
50 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
54 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
55 description = "RC \$in"
58 command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$defines \$includes /c /Fo \$out \$in"
59 description = "ASM \$in"
62 command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
63 description = "LIB \$out"
65 rspfile_content = "\$in_newline \$libflags"
68 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 cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
69 description = "LINK(DLL) \$dll"
72 rspfile_content = "\$libs \$in_newline \$ldflags"
75 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 cmd /c if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
76 description = "LINK \$out"
78 rspfile_content = "\$in_newline \$libs \$ldflags"
81 command = stamp_command
82 description = "STAMP \$out"
85 command = copy_command
86 description = "COPY \$in \$out"
90 # 64-bit toolchain -------------------------------------------------------------
93 # Make these apply to all tools below.
95 lib_dir_prefix="/LIBPATH:"
97 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
100 description = "CC \$out"
101 rspfile = "\$out.rsp"
102 rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
106 command = cc_command # Same as above
107 description = "CXX \$out"
108 rspfile = "\$out.rsp"
109 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
113 command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
114 description = "RC \$in"
117 command = "$python_path gyp-win-tool asm-wrapper environment.x64 ml.exe \$defines \$includes /c /Fo \$out \$in"
118 description = "ASM \$in"
121 command = "$python_path gyp-win-tool link-wrapper environment.x64 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
122 description = "LIB \$out"
123 rspfile = "\$out.rsp"
124 rspfile_content = "\$in_newline \$libflags"
127 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 cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
128 description = "LINK(DLL) \$dll"
130 rspfile = "\$dll.rsp"
131 rspfile_content = "\$libs \$in_newline \$ldflags"
134 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 cmd /c if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
135 description = "LINK \$out"
136 rspfile = "\$out.rsp"
137 rspfile_content = "\$in_newline \$libs \$ldflags"
140 command = stamp_command
141 description = "STAMP \$out"
144 command = copy_command
145 description = "COPY \$in \$out"
148 # When invoking this toolchain not as the default one, these args will be
149 # passed to the build. They are ignored when this is the default toolchain.
152 # Normally the build config resets the CPU architecture to 32-bits. Setting
153 # this flag overrides that behavior.