Skip to content

Commit fe3b46e

Browse files
authored
Differentiate clang invocation when targeting x86 vs x64 on Windows. (flutter#388)
* Differentiate clang invocation when targeting x86 vs x64 on Windows. This fixes building of android gen_snapshot with clang. This is along the same lines that were done in dart sdk https://dart-review.googlesource.com/c/sdk/+/142704 * Ensure we only add -m32 when using clang
1 parent 92f0936 commit fe3b46e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

build/toolchain/win/BUILD.gn

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ template("msvc_toolchain") {
7777
# TODO(brettw) enable this when GN support in the binary has been rolled.
7878
#precompiled_header_type = "msvc"
7979
pdbname = "{{target_out_dir}}/{{target_output_name}}_c.pdb"
80-
command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
80+
flags = ""
81+
if (is_clang && invoker.current_cpu == "x86") {
82+
flags = "-m32"
83+
}
84+
command = "ninja -t msvc -e $env -- $cl $flags /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
8185
depsformat = "msvc"
8286
description = "CC {{output}}"
8387
outputs = [
@@ -94,7 +98,11 @@ template("msvc_toolchain") {
9498

9599
# The PDB name needs to be different between C and C++ compiled files.
96100
pdbname = "{{target_out_dir}}/{{target_output_name}}_cc.pdb"
97-
command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
101+
flags = ""
102+
if (is_clang && invoker.current_cpu == "x86") {
103+
flags = "-m32"
104+
}
105+
command = "ninja -t msvc -e $env -- $cl $flags /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
98106
depsformat = "msvc"
99107
description = "CXX {{output}}"
100108
outputs = [

0 commit comments

Comments
 (0)