Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: build/toolchain/win/BUILD.gn

Issue 485833003: Pull new GN, update toolchain definitions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20
21 stamp_command = "$python_path gyp-win-tool stamp \$out" 21 # Parameters:
22 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out" 22 # cpu_arch: cpu_arch to pass as a build arg
23 # environment: File name of environment file.
24 # force_win64 (optional): value for this build arg.
25 template("msvc_toolchain") {
26 env = invoker.environment
23 27
24 # MSVC can't share PDB files between compilers compiling C and C++ files, so 28 toolchain(target_name) {
25 # we construct different names for each type. 29 # Make these apply to all tools below.
26 c_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_c.pdb" 30 lib_switch = ""
27 cc_pdb_suffix = " /Fd\${target_out_dir}/\${target_name}_cc.pdb" 31 lib_dir_switch="/LIBPATH:"
28 32
29 # 32-bit toolchain ------------------------------------------------------------- 33 tool("cc") {
34 rspfile = "{{output}}.rsp"
35 pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb"
36 command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rsp file /c {{source}} /Fo{{output}} /Fd$pdbname"
37 depsformat = "msvc"
38 description = "CC {{output}}"
39 outputs = [
40 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
41 ]
42 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
43 }
30 44
31 toolchain("32") { 45 tool("cxx") {
32 # Make these apply to all tools below. 46 rspfile = "{{output}}.rsp"
33 lib_prefix = "" 47 # The PDB name needs to be different between C and C++ compiled files.
34 lib_dir_prefix="/LIBPATH:" 48 pdbname = "{{target_out_dir}}/{{target_output_name}}_cc.pdb"
49 command = "ninja -t msvc -e $env -- cl.exe /nologo /showIncludes /FC @$rsp file /c {{source}} /Fo{{output}} /Fd$pdbname"
50 depsformat = "msvc"
51 description = "CXX {{output}}"
52 outputs = [
53 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
54 ]
55 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
56 }
35 57
36 cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out" 58 tool("rc") {
37 tool("cc") { 59 command = "$python_path gyp-win-tool rc-wrapper $env rc.exe {{defines}} {{ include_dirs}} /fo{{output}} {{source}}"
38 command = cc_command + c_pdb_suffix 60 outputs = [
39 description = "CC \$out" 61 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.res",
40 rspfile = "\$out.rsp" 62 ]
41 rspfile_content = "\$defines \$includes \$cflags \$cflags_c" 63 description = "RC {{output}}"
42 depsformat = "msvc" 64 }
43 } 65
44 tool("cxx") { 66 tool("asm") {
45 command = cc_command + cc_pdb_suffix 67 command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} { {include_dirs}} /c /Fo {{output}} {{source}}"
46 description = "CXX \$out" 68 description = "ASM {{output}}"
47 rspfile = "\$out.rsp" 69 outputs = [
48 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc" 70 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
49 depsformat = "msvc" 71 ]
50 } 72 }
51 tool("rc") { 73
52 command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$def ines \$includes \$rcflags /fo\$out \$in" 74 tool("alink") {
53 description = "RC \$in" 75 rspfile = "{{output}}.rsp"
54 } 76 command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nolo go /ignore:4221 /OUT:{{output}} @$rspfile"
55 tool("asm") { 77 description = "LIB {{output}}"
56 command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$de fines \$includes /c /Fo \$out \$in" 78 outputs = [
57 description = "ASM \$in" 79 # Ignore {{output_extension}} and always use .lib, there's no reason to
58 } 80 # allow targets to override this extension on Windows.
59 tool("alink") { 81 "{{target_out_dir}}/{{target_output_name}}.lib",
60 command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib. exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp" 82 ]
61 description = "LIB \$out" 83 default_output_extension = ".lib"
62 rspfile = "\$out.rsp" 84 # The use of inputs_newline is to work around a fixed per-line buffer
63 rspfile_content = "\$in_newline \$libflags" 85 # size in the linker.
64 } 86 rspfile_content = "{{inputs_newline}}"
65 tool("solink") { 87 }
66 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 Fal se link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $p ython_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifes t \$manifests -out:\$dll.manifest" 88
67 description = "LINK(DLL) \$dll" 89 tool("solink") {
68 restat = "1" 90 dllname = "{{target_output_name}}{{output_extension}}" # e.g. foo.dll
69 rspfile = "\$dll.rsp" 91 libname = "{{target_output_name}}{{output_extension}}.lib" # e.g. foo.dll .lib
70 rspfile_content = "\$libs \$in_newline \$ldflags" 92 rspfile = "${dllname}.rsp"
71 } 93
72 tool("link") { 94 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
73 command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 Fal se 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" 95
74 description = "LINK \$out" 96 # TODO(brettw) support manifests
75 rspfile = "\$out.rsp" 97 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:${dllname}.manifest"
76 rspfile_content = "\$in_newline \$libs \$ldflags" 98 #command = "cmd /c $link_command && $manifest_command"
77 } 99 command = link_command
78 tool("stamp") { 100
79 command = stamp_command 101 default_output_extension = ".dll"
80 description = "STAMP \$out" 102 description = "LINK(DLL) {{output}}"
81 } 103 outputs = [
82 tool("copy") { 104 dllname,
83 command = copy_command 105 libname,
84 description = "COPY \$in \$out" 106 ]
107 # The use of inputs_newline is to work around a fixed per-line buffer
108 # size in the linker.
109 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
110 }
111
112 tool("link") {
113 rspfile = "{{output}}.rsp"
114
115 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile"
116
117 # TODO(brettw) support manifests
118 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:{{output}}.manifest"
119 #command = "cmd /c $link_command && $manifest_command"
120 command = link_command
121
122 default_output_extension = ".exe"
123 description = "LINK {{output}}"
124 outputs = [
125 "{{target_output_name}}{{output_extension}}",
126 ]
127 # The use of inputs_newline is to work around a fixed per-line buffer
128 # size in the linker.
129 rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
130 }
131
132 tool("stamp") {
133 command = "$python_path gyp-win-tool stamp {{output}}"
134 description = "STAMP {{output}}"
135 }
136
137 tool("copy") {
138 command = "$python_path gyp-win-tool recursive-mirror {{source}} {{output }}"
139 description = "COPY {{source}} {{output}}"
140 }
141
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.
144 toolchain_args() {
145 cpu_arch = invoker.cpu_arch
146
147 # Normally the build config resets the CPU architecture to 32-bits. Settin g
148 # this flag overrides that behavior.
149 if (defined(invoker.force_win64)) {
150 force_win64 = invoker.force_win64
151 }
152 }
85 } 153 }
86 } 154 }
87 155
88 # 64-bit toolchain ------------------------------------------------------------- 156 msvc_toolchain("32") {
157 environment = "environment.x86"
158 cpu_arch = "x64"
159 }
89 160
90 toolchain("64") { 161 msvc_toolchain("64") {
91 # Make these apply to all tools below. 162 environment = "environment.x64"
92 lib_prefix = "" 163 cpu_arch = "x64"
93 lib_dir_prefix="/LIBPATH:" 164 force_win64 = true
94
95 cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out"
96 tool("cc") {
97 command = cc_command + c_pdb_suffix
98 description = "CC \$out"
99 rspfile = "\$out.rsp"
100 rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
101 depsformat = "msvc"
102 }
103 tool("cxx") {
104 command = cc_command + cc_pdb_suffix
105 description = "CXX \$out"
106 rspfile = "\$out.rsp"
107 rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
108 depsformat = "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 False lib. exe /nologo /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 Fal se link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $p ython_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifes t \$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 Fal se 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"
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 }
154 } 165 }
OLDNEW
« build/toolchain/gcc_toolchain.gni ('K') | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698