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.
4
5# Should only be running on Windows.
6assert(is_win)
7
8# Setup the Visual Studio state.
9#
10# Its argument is the location to write the environment files.
11# It will write "environment.x86" and "environment.x64" to this directory,
12# and return a list to us.
13#
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.)
16msvc_config = [["foo"]]
17#exec_script("get_msvc_config.py",
18                     #     [relative_root_output_dir],
19                     #     "value")
20
21# 32-bit toolchain -------------------------------------------------------------
22
23toolchain("32") {
24  tool("cc") {
25    command = "ninja -t msvc -e \$arch -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
26    description = "CC \$out"
27    rspfile = "\$out.rsp"
28    rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
29    deps = "msvc"
30  }
31  tool("cxx") {
32    command = "ninja -t msvc -e \$arch -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
33    description = "CXX \$out"
34    rspfile = "\$out.rsp"
35    rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
36    deps = "msvc"
37  }
38  #tool("idl") {
39  #  command = $python_path gyp-win-tool midl-wrapper \$arch \$outdir \$tlb \$h \$dlldata \$iid \$
40  #      \$proxy \$in \$idlflags
41  #  description = IDL \$in
42  #}
43  #tool("rc") {
44  #  command = $python_path gyp-win-tool rc-wrapper \$arch rc.exe \$defines \$includes \$rcflags \$
45  #      /fo\$out \$in
46  #  description = RC \$in
47  #}
48  #tool("asm") {
49  #  command = $python_path gyp-win-tool asm-wrapper \$arch ml.exe \$defines \$includes /c /Fo \$
50  #      \$out \$in
51  #  description = ASM \$in
52  #}
53  tool("alink") {
54    command = "$python_path gyp-win-tool link-wrapper \$arch lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
55    description = "LIB \$out"
56    rspfile = "\$out.rsp"
57    rspfile_content = "\$in_newline \$libflags"
58  }
59  #tool("solink_embed_inc") {
60  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag \$
61  #      /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool \$
62  #      manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && \$
63  #      $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests \$
64  #      -out:\$dll.manifest && $python_path gyp-win-tool manifest-to-rc \$arch \$dll.manifest \$
65  #      \$dll.manifest.rc 2 && $python_path gyp-win-tool rc-wrapper \$arch rc.exe \$
66  #      \$dll.manifest.rc && $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$
67  #      \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp \$dll.manifest.res
68  #  description = LINK_EMBED_INC(DLL) \$dll
69  #  restat = 1
70  #  rspfile = \$dll.rsp
71  #  rspfile_content = \$libs \$in_newline \$ldflags
72  #}
73  #tool("solink_module_embed_inc") {
74  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag \$
75  #      /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool \$
76  #      manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && \$
77  #      $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests \$
78  #      -out:\$dll.manifest && $python_path gyp-win-tool manifest-to-rc \$arch \$dll.manifest \$
79  #      \$dll.manifest.rc 2 && $python_path gyp-win-tool rc-wrapper \$arch rc.exe \$
80  #      \$dll.manifest.rc && $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$
81  #      \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp \$dll.manifest.res
82  #  description = LINK_EMBED_INC(DLL) \$dll
83  #  restat = 1
84  #  rspfile = \$dll.rsp
85  #  rspfile_content = \$libs \$in_newline \$ldflags
86  #}
87  #rule link_embed_inc
88  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo /OUT:\$out \$
89  #      /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper \$arch cmd /c \$
90  #      if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool \$
91  #      manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests -out:\$out.manifest && \$
92  #      $python_path gyp-win-tool manifest-to-rc \$arch \$out.manifest \$out.manifest.rc 1 && \$
93  #      $python_path gyp-win-tool rc-wrapper \$arch rc.exe \$out.manifest.rc && \$
94  #      $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo /OUT:\$out /PDB:\$out.pdb \$
95  #      @\$out.rsp \$out.manifest.res
96  #  description = LINK_EMBED_INC \$out
97  #  rspfile = \$out.rsp
98  #  rspfile_content = \$in_newline \$libs \$ldflags
99  #rule solink_embed
100  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag \$
101  #      /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool \$
102  #      manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && \$
103  #      $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests \$
104  #      -outputresource:\$dll;2
105  #  description = LINK_EMBED(DLL) \$dll
106  #  restat = 1
107  #  rspfile = \$dll.rsp
108  #  rspfile_content = \$libs \$in_newline \$ldflags
109  #rule solink_module_embed
110  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag \$
111  #      /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool \$
112  #      manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && \$
113  #      $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests \$
114  #      -outputresource:\$dll;2
115  #  description = LINK_EMBED(DLL) \$dll
116  #  restat = 1
117  #  rspfile = \$dll.rsp
118  #  rspfile_content = \$libs \$in_newline \$ldflags
119  #rule link_embed
120  #  command = cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo /OUT:\$out \$
121  #      /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper \$arch cmd /c \$
122  #      if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool \$
123  #      manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests -outputresource:\$out;1
124  #  description = LINK_EMBED \$out
125  #  rspfile = \$out.rsp
126  #  rspfile_content = \$in_newline \$libs \$ldflags
127  tool("solink") {
128    command = "cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
129    description = "LINK(DLL) \$dll"
130    restat = "1"
131    rspfile = "\$dll.rsp"
132    rspfile_content = "\$libs \$in_newline \$ldflags"
133  }
134  tool("solink_module") {
135    command = "cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper \$arch cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests -out:\$dll.manifet"
136    description = "LINK(DLL) \$dll"
137    restat = "1"
138    rspfile = "\$dll.rsp"
139    rspfile_content = "\$libs \$in_newline \$ldflags"
140  }
141  tool("link") {
142    command = "cmd /c $python_path gyp-win-tool link-wrapper \$arch link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper \$arch cmd /c if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool manifest-wrapper \$arch mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
143    description = "LINK \$out"
144    rspfile = "\$out.rsp"
145    rspfile_content = "\$in_newline \$libs \$ldflags"
146  }
147  tool("stamp") {
148    command = "$python_path gyp-win-tool stamp \$out"
149    description = "STAMP \$out"
150  }
151  tool("copy") {
152    command = "$python_path gyp-win-tool recursive-mirror \$in \$out"
153    description = "COPY \$in \$out"
154  }
155}
156
157# 64-bit toolchain -------------------------------------------------------------
158
159toolchain("64") {
160}
161
162# SDK setup --------------------------------------------------------------------
163
164config("sdk") {
165  # The include path is the stuff returned by the script plus out own WTL
166  # checkout.
167  # TODO(brettw) should adding WTL be at this level or should it be more on
168  # a per-project basis?
169  includes = msvc_config[0] + "../../third_party/wtl/include"
170
171  defines = [
172    "_ATL_NO_OPENGL",
173    "_SECURE_ATL",
174    "_WIN32_WINNT=0x0602",
175    "_WINDOWS",
176    "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
177    "NOMINMAX",
178    "NTDDI_VERSION=0x06020000",
179    "PSAPI_VERSION=1",
180    "WIN32",
181    "WIN32_LEAN_AND_MEAN",
182    "WINVER=0x0602",
183  ]
184}
185