diff options
author | 2016-10-12 22:42:55 -0400 | |
---|---|---|
committer | 2016-10-13 03:14:05 +0000 | |
commit | 0bc5a7695c75e2e9701a154d8688693ed755a7a4 (patch) | |
tree | 47a81d1537c2e486e150d5a9e84ec4a174fd6d4d | |
parent | a213640f18f192031e58cd6935d393fea5423954 (diff) |
GN: naive attempt for 32-bit Windows support
This uses the win_toolchain's SetEnv.cmd script to set up the environment for x86 builds. Some of what it sets is redundant with what we set: include_dirs (INCLUDE), lib_dirs (LIB). I'd sort of like to learn what parts of it actually matter: VSINSTALLDIR? VCINSTALLDIR? likely PATH?
This will not work for local builds not using win_toolchain. I don't mind that too much, at least for now, maybe forever. Most humans should be using 64-bit builds.
CQ_INCLUDE_TRYBOTS=master.client.skia.compile:Build-Win-MSVC-x86-Debug-Exceptions-Trybot,Build-Win-MSVC-x86_64-Debug-GN-Trybot,Build-Win-MSVC-x86_64-Release-GN-Trybot
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3257
Change-Id: Ib880fb738bc4b493e8905903706526110213be47
Reviewed-on: https://skia-review.googlesource.com/3257
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | gn/BUILD.gn | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 98d6b675af..b9664fe78a 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -65,16 +65,19 @@ config("default") { "$windk/win_sdk/Include/10.0.10586.0/um", ] lib_dirs = [ - "$windk/VC/lib/amd64", - # For local builds. - "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/x64", - "$windk/../Windows Kits/8.1/Lib/winv6.3/um/x64", + "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/$target_cpu", + "$windk/../Windows Kits/8.1/Lib/winv6.3/um/$target_cpu", # For builds using win_toolchain asset. - "$windk/win_sdk/Lib/10.0.10586.0/ucrt/x64", - "$windk/win_sdk/Lib/10.0.10586.0/um/x64", + "$windk/win_sdk/Lib/10.0.10586.0/ucrt/$target_cpu", + "$windk/win_sdk/Lib/10.0.10586.0/um/$target_cpu", ] + if (target_cpu == "x86") { + lib_dirs += [ "$windk/VC/lib" ] + } else { + lib_dirs += [ "$windk/VC/lib/amd64" ] + } } else { cflags += [ "-O1", @@ -318,9 +321,12 @@ config("executable") { toolchain("msvc") { lib_dir_switch = "/LIBPATH:" - cl_exe = "$windk/VC/bin/amd64/cl.exe" - link_exe = "$windk/VC/bin/amd64/link.exe" - lib_exe = "$windk/VC/bin/amd64/lib.exe" + bin = "$windk/VC/bin/amd64" + env_setup = "" + if (target_cpu == "x86") { + bin += "_x86" + env_setup = "cmd /c $windk/win_sdk/bin/SetEnv.cmd /x86 && " + } tool("cc") { rspfile = "{{output}}.rsp" @@ -328,7 +334,7 @@ toolchain("msvc") { pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" # Label names may have spaces so pdbname must be quoted. - command = "$cl_exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" + command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" depsformat = "msvc" outputs = [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", @@ -342,7 +348,7 @@ toolchain("msvc") { pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" # Label names may have spaces so pdbname must be quoted. - command = "$cl_exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" + command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" depsformat = "msvc" outputs = [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", @@ -353,7 +359,8 @@ toolchain("msvc") { tool("alink") { rspfile = "{{output}}.rsp" - command = "$lib_exe /nologo {{arflags}} /OUT:{{output}} @$rspfile" + command = + "$env_setup$bin/lib.exe /nologo {{arflags}} /OUT:{{output}} @$rspfile" outputs = [ # Ignore {{output_extension}} and always use .lib, there's no reason to # allow targets to override this extension on Windows. @@ -371,7 +378,8 @@ toolchain("msvc") { pdbname = "$exename.pdb" rspfile = "$exename.rsp" - command = "$link_exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile" + command = + "$env_setup$bin/link.exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile" default_output_extension = ".exe" default_output_dir = "{{root_out_dir}}" |