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 # Should only be running on Windows. | 5 # Should only be running on Windows. |
6 assert(is_win) | 6 assert(is_win) |
7 | 7 |
8 # Setup the Visual Studio state. | 8 # Setup the Visual Studio state. |
9 # | 9 # |
10 # Its argument is the location to write the environment files. | 10 # Its argument is the location to write the environment files. |
11 # It will write "environment.x86" and "environment.x64" to this directory, | 11 # It will write "environment.x86" and "environment.x64" to this directory, |
12 # and return a list to us. | 12 # and return a list to us. |
13 # | 13 # |
14 # The list contains the include path as its only element. (I'm expecting to | 14 # The list contains the include path as its only element. (I'm expecting to |
15 # add more so it's currently a list inside a list.) | 15 # add more so it's currently a list inside a list.) |
16 #exec_script("get_msvc_config.py", | 16 #exec_script("get_msvc_config.py", |
17 # [relative_root_output_dir], | 17 # [relative_root_output_dir], |
18 # "value") | 18 # "value") |
19 | 19 |
20 # This will save the environment block and and copy the gyp-win-tool to the | 20 # This will save the environment block and and copy the gyp-win-tool to the |
21 # build directory. We pass in the source file of the win tool. | 21 # build directory. We pass in the source file of the win tool. |
22 gyp_win_tool_source = | 22 gyp_win_tool_source = |
23 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) |
24 exec_script("setup_toolchain.py", [ gyp_win_tool_source ], "value") | 24 exec_script("setup_toolchain.py", [ gyp_win_tool_source ], "value") |
25 | 25 |
| 26 stamp_command = "$python_path gyp-win-tool stamp \$out" |
| 27 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out" |
| 28 |
26 # 32-bit toolchain ------------------------------------------------------------- | 29 # 32-bit toolchain ------------------------------------------------------------- |
27 | 30 |
28 toolchain("32") { | 31 toolchain("32") { |
29 # Make these apply to all tools below. | 32 # Make these apply to all tools below. |
30 lib_prefix = "" | 33 lib_prefix = "" |
31 lib_dir_prefix="/LIBPATH:" | 34 lib_dir_prefix="/LIBPATH:" |
32 | 35 |
| 36 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" |
33 tool("cc") { | 37 tool("cc") { |
34 command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" | 38 command = cc_command |
35 description = "CC \$out" | 39 description = "CC \$out" |
36 rspfile = "\$out.rsp" | 40 rspfile = "\$out.rsp" |
37 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" | 41 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" |
38 deps = "msvc" | 42 deps = "msvc" |
39 } | 43 } |
40 tool("cxx") { | 44 tool("cxx") { |
41 command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" | 45 command = cc_command # Same as above |
42 description = "CXX \$out" | 46 description = "CXX \$out" |
43 rspfile = "\$out.rsp" | 47 rspfile = "\$out.rsp" |
44 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" | 48 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" |
45 deps = "msvc" | 49 deps = "msvc" |
46 } | 50 } |
47 #tool("idl") { | |
48 # command = $python_path gyp-win-tool midl-wrapper environment.x86 \$outdir \
$tlb \$h \$dlldata \$iid \$ | |
49 # \$proxy \$in \$idlflags | |
50 # description = IDL \$in | |
51 #} | |
52 tool("rc") { | 51 tool("rc") { |
53 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" | 52 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" |
54 description = "RC \$in" | 53 description = "RC \$in" |
55 } | 54 } |
56 #tool("asm") { | 55 tool("asm") { |
57 # command = $python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$de
fines \$includes /c /Fo \$ | 56 command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$de
fines \$includes /c /Fo \$out \$in" |
58 # \$out \$in | 57 description = "ASM \$in" |
59 # description = ASM \$in | 58 } |
60 #} | |
61 tool("alink") { | 59 tool("alink") { |
62 command = "$python_path gyp-win-tool link-wrapper environment.x86 lib.exe /n
ologo /ignore:4221 /OUT:\$out @\$out.rsp" | 60 command = "$python_path gyp-win-tool link-wrapper environment.x86 lib.exe /n
ologo /ignore:4221 /OUT:\$out @\$out.rsp" |
63 description = "LIB \$out" | 61 description = "LIB \$out" |
64 rspfile = "\$out.rsp" | 62 rspfile = "\$out.rsp" |
65 rspfile_content = "\$in_newline \$libflags" | 63 rspfile_content = "\$in_newline \$libflags" |
66 } | 64 } |
67 #tool("solink_embed_inc") { | |
68 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo \$implibflag \$ | |
69 # /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool
\$ | |
70 # manifest-wrapper environment.x86 cmd /c if exist \$dll.manifest del \$d
ll.manifest && \$ | |
71 # $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nolo
go -manifest \$manifests \$ | |
72 # -out:\$dll.manifest && $python_path gyp-win-tool manifest-to-rc environ
ment.x86 \$dll.manifest \$ | |
73 # \$dll.manifest.rc 2 && $python_path gyp-win-tool rc-wrapper environment
.x86 rc.exe \$ | |
74 # \$dll.manifest.rc && $python_path gyp-win-tool link-wrapper environment
.x86 link.exe /nologo \$ | |
75 # \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp \$dll.manifest.r
es | |
76 # description = LINK_EMBED_INC(DLL) \$dll | |
77 # restat = 1 | |
78 # rspfile = \$dll.rsp | |
79 # rspfile_content = \$libs \$in_newline \$ldflags | |
80 #} | |
81 #tool("solink_module_embed_inc") { | |
82 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo \$implibflag \$ | |
83 # /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool
\$ | |
84 # manifest-wrapper environment.x86 cmd /c if exist \$dll.manifest del \$d
ll.manifest && \$ | |
85 # $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nolo
go -manifest \$manifests \$ | |
86 # -out:\$dll.manifest && $python_path gyp-win-tool manifest-to-rc environ
ment.x86 \$dll.manifest \$ | |
87 # \$dll.manifest.rc 2 && $python_path gyp-win-tool rc-wrapper environment
.x86 rc.exe \$ | |
88 # \$dll.manifest.rc && $python_path gyp-win-tool link-wrapper environment
.x86 link.exe /nologo \$ | |
89 # \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp \$dll.manifest.r
es | |
90 # description = LINK_EMBED_INC(DLL) \$dll | |
91 # restat = 1 | |
92 # rspfile = \$dll.rsp | |
93 # rspfile_content = \$libs \$in_newline \$ldflags | |
94 #} | |
95 #rule link_embed_inc | |
96 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo /OUT:\$out \$ | |
97 # /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper
environment.x86 cmd /c \$ | |
98 # if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool
\$ | |
99 # manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -
out:\$out.manifest && \$ | |
100 # $python_path gyp-win-tool manifest-to-rc environment.x86 \$out.manifest
\$out.manifest.rc 1 && \$ | |
101 # $python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$out.manif
est.rc && \$ | |
102 # $python_path gyp-win-tool link-wrapper environment.x86 link.exe /nologo
/OUT:\$out /PDB:\$out.pdb \$ | |
103 # @\$out.rsp \$out.manifest.res | |
104 # description = LINK_EMBED_INC \$out | |
105 # rspfile = \$out.rsp | |
106 # rspfile_content = \$in_newline \$libs \$ldflags | |
107 #rule solink_embed | |
108 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo \$implibflag \$ | |
109 # /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool
\$ | |
110 # manifest-wrapper environment.x86 cmd /c if exist \$dll.manifest del \$d
ll.manifest && \$ | |
111 # $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nolo
go -manifest \$manifests \$ | |
112 # -outputresource:\$dll;2 | |
113 # description = LINK_EMBED(DLL) \$dll | |
114 # restat = 1 | |
115 # rspfile = \$dll.rsp | |
116 # rspfile_content = \$libs \$in_newline \$ldflags | |
117 #rule solink_module_embed | |
118 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo \$implibflag \$ | |
119 # /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool
\$ | |
120 # manifest-wrapper environment.x86 cmd /c if exist \$dll.manifest del \$d
ll.manifest && \$ | |
121 # $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nolo
go -manifest \$manifests \$ | |
122 # -outputresource:\$dll;2 | |
123 # description = LINK_EMBED(DLL) \$dll | |
124 # restat = 1 | |
125 # rspfile = \$dll.rsp | |
126 # rspfile_content = \$libs \$in_newline \$ldflags | |
127 #rule link_embed | |
128 # command = cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.exe /nologo /OUT:\$out \$ | |
129 # /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper
environment.x86 cmd /c \$ | |
130 # if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool
\$ | |
131 # manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -
outputresource:\$out;1 | |
132 # description = LINK_EMBED \$out | |
133 # rspfile = \$out.rsp | |
134 # rspfile_content = \$in_newline \$libs \$ldflags | |
135 tool("solink") { | 65 tool("solink") { |
136 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.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.manifes
t del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x
86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest" | 66 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.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.manifes
t del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x
86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest" |
137 description = "LINK(DLL) \$dll" | 67 description = "LINK(DLL) \$dll" |
138 restat = "1" | 68 restat = "1" |
139 rspfile = "\$dll.rsp" | 69 rspfile = "\$dll.rsp" |
140 rspfile_content = "\$libs \$in_newline \$ldflags" | 70 rspfile_content = "\$libs \$in_newline \$ldflags" |
141 } | 71 } |
142 tool("link") { | 72 tool("link") { |
143 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.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.manife
st && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo
-manifest \$manifests -out:\$out.manifest" | 73 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 lin
k.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.manife
st && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo
-manifest \$manifests -out:\$out.manifest" |
144 description = "LINK \$out" | 74 description = "LINK \$out" |
145 rspfile = "\$out.rsp" | 75 rspfile = "\$out.rsp" |
146 rspfile_content = "\$in_newline \$libs \$ldflags" | 76 rspfile_content = "\$in_newline \$libs \$ldflags" |
147 } | 77 } |
148 tool("stamp") { | 78 tool("stamp") { |
149 command = "$python_path gyp-win-tool stamp \$out" | 79 command = stamp_command |
150 description = "STAMP \$out" | 80 description = "STAMP \$out" |
151 } | 81 } |
152 tool("copy") { | 82 tool("copy") { |
153 command = "$python_path gyp-win-tool recursive-mirror \$in \$out" | 83 command = copy_command |
154 description = "COPY \$in \$out" | 84 description = "COPY \$in \$out" |
155 } | 85 } |
156 } | 86 } |
157 | 87 |
158 # 64-bit toolchain ------------------------------------------------------------- | 88 # 64-bit toolchain ------------------------------------------------------------- |
159 | 89 |
160 toolchain("64") { | 90 toolchain("64") { |
| 91 # Make these apply to all tools below. |
| 92 lib_prefix = "" |
| 93 lib_dir_prefix="/LIBPATH:" |
| 94 |
| 95 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes
/FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname" |
| 96 tool("cc") { |
| 97 command = cc_command |
| 98 description = "CC \$out" |
| 99 rspfile = "\$out.rsp" |
| 100 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" |
| 101 deps = "msvc" |
| 102 } |
| 103 tool("cxx") { |
| 104 command = cc_command # Same as above |
| 105 description = "CXX \$out" |
| 106 rspfile = "\$out.rsp" |
| 107 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" |
| 108 deps = "msvc" |
| 109 } |
| 110 tool("rc") { |
| 111 command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$def
ines \$includes \$rcflags /fo\$out \$in" |
| 112 description = "RC \$in" |
| 113 } |
| 114 tool("asm") { |
| 115 command = "$python_path gyp-win-tool asm-wrapper environment.x64 ml.exe \$de
fines \$includes /c /Fo \$out \$in" |
| 116 description = "ASM \$in" |
| 117 } |
| 118 tool("alink") { |
| 119 command = "$python_path gyp-win-tool link-wrapper environment.x64 lib.exe /n
ologo /ignore:4221 /OUT:\$out @\$out.rsp" |
| 120 description = "LIB \$out" |
| 121 rspfile = "\$out.rsp" |
| 122 rspfile_content = "\$in_newline \$libflags" |
| 123 } |
| 124 tool("solink") { |
| 125 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 lin
k.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.manifes
t del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x
64 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest" |
| 126 description = "LINK(DLL) \$dll" |
| 127 restat = "1" |
| 128 rspfile = "\$dll.rsp" |
| 129 rspfile_content = "\$libs \$in_newline \$ldflags" |
| 130 } |
| 131 tool("link") { |
| 132 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 lin
k.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.manife
st && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo
-manifest \$manifests -out:\$out.manifest" |
| 133 description = "LINK \$out" |
| 134 rspfile = "\$out.rsp" |
| 135 rspfile_content = "\$in_newline \$libs \$ldflags" |
| 136 } |
| 137 tool("stamp") { |
| 138 command = stamp_command |
| 139 description = "STAMP \$out" |
| 140 } |
| 141 tool("copy") { |
| 142 command = copy_command |
| 143 description = "COPY \$in \$out" |
| 144 } |
| 145 |
| 146 # When invoking this toolchain not as the default one, these args will be |
| 147 # passed to the build. They are ignored when this is the default toolchain. |
| 148 toolchain_args() { |
| 149 cpu_arch = "x64" |
| 150 # Normally the build config resets the CPU architecture to 32-bits. Setting |
| 151 # this flag overrides that behavior. |
| 152 force_win64 = true |
| 153 } |
161 } | 154 } |
OLD | NEW |