]> git.proxmox.com Git - rustc.git/blob - vendor/winapi/build.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / vendor / winapi / build.rs
1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use std::cell::Cell;
7 use std::collections::HashMap;
8 use std::env::var;
9 // (header name, &[header dependencies], &[library dependencies])
10 const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static str])] = &[
11 // km
12 ("d3dkmthk", &["basetsd", "d3dukmdt", "minwindef", "ntdef", "windef"], &[]),
13 // mmos
14 // shared
15 ("basetsd", &[], &[]),
16 ("bcrypt", &["minwindef", "winnt"], &["bcrypt"]),
17 ("bthdef", &["bthsdpdef", "guiddef", "minwindef", "ntdef"], &[]),
18 ("bthioctl", &["bthdef", "bthsdpdef", "minwindef", "ntdef", "winioctl"], &[]),
19 ("bthsdpdef", &["guiddef", "minwindef", "ntdef"], &[]),
20 ("bugcodes", &["ntdef"], &[]),
21 ("cderr", &["minwindef"], &[]),
22 ("cfg", &["minwindef"], &[]),
23 ("d3d9", &["basetsd", "d3d9caps", "d3d9types", "guiddef", "minwindef", "unknwnbase", "windef", "wingdi", "winnt"], &["d3d9"]),
24 ("d3d9caps", &["d3d9types", "guiddef", "minwindef", "winnt"], &[]),
25 ("d3d9types", &["basetsd", "guiddef", "minwindef", "windef", "winnt"], &[]),
26 ("d3dkmdt", &["basetsd", "minwindef", "ntdef"], &[]),
27 ("d3dukmdt", &["basetsd", "guiddef", "minwindef", "ntdef"], &[]),
28 ("dcomptypes", &["dxgitype", "minwindef", "winnt"], &[]),
29 ("devguid", &[], &[]),
30 ("devpkey", &["devpropdef"], &[]),
31 ("devpropdef", &["guiddef", "minwindef", "winnt"], &[]),
32 ("dinputd", &[], &[]),
33 ("dxgi", &["basetsd", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxgi"]),
34 ("dxgi1_2", &["basetsd", "dxgi", "dxgiformat", "dxgitype", "guiddef", "minwinbase", "minwindef", "unknwnbase", "windef", "winnt"], &[]),
35 ("dxgi1_3", &["dxgi", "dxgi1_2", "dxgiformat", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxgi"]),
36 ("dxgi1_4", &["basetsd", "dxgi1_2", "dxgi1_3", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
37 ("dxgi1_5", &["basetsd", "dxgi", "dxgi1_2", "dxgi1_3", "dxgi1_4", "dxgiformat", "minwindef", "unknwnbase", "winnt"], &[]),
38 ("dxgi1_6", &["basetsd", "dxgi1_2", "dxgi1_4", "dxgi1_5", "dxgitype", "guiddef", "minwindef", "windef", "winnt"], &[]),
39 ("dxgiformat", &[], &[]),
40 ("dxgitype", &["d3d9types", "dxgiformat", "minwindef"], &[]),
41 ("enclaveapi", &["basetsd", "minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]),
42 ("evntprov", &["basetsd", "guiddef", "minwindef", "winnt"], &["advapi32"]),
43 ("evntrace", &["basetsd", "evntcons", "evntprov", "guiddef", "handleapi", "minwindef", "timezoneapi", "vadefs", "winnt", "wmistr"], &["advapi32"]),
44 ("guiddef", &[], &[]),
45 ("hidclass", &["guiddef", "minwindef", "winioctl", "winnt"], &[]),
46 ("hidpi", &["hidusage", "minwindef", "ntdef", "ntstatus", "winnt"], &["hid"]),
47 ("hidsdi", &["guiddef", "hidpi", "minwindef", "winnt"], &["hid"]),
48 ("hidusage", &["minwindef"], &[]),
49 ("ifdef", &["basetsd", "minwindef"], &[]),
50 ("in6addr", &["minwindef"], &[]),
51 ("inaddr", &["minwindef"], &[]),
52 ("intsafe", &[], &[]),
53 ("ks", &[], &[]),
54 ("ksmedia", &["minwindef"], &[]),
55 ("ktmtypes", &["guiddef", "minwindef", "winnt"], &[]),
56 ("lmcons", &["minwindef", "winnt"], &[]),
57 ("minwindef", &["basetsd", "ntdef"], &[]),
58 ("mmreg", &["guiddef", "minwindef"], &[]),
59 ("mstcpip", &["basetsd", "guiddef", "in6addr", "inaddr", "minwindef", "winnt", "ws2def"], &["ntdll"]),
60 ("mswsockdef", &["minwindef", "winnt", "ws2def"], &[]),
61 ("netioapi", &["basetsd", "guiddef", "ifdef", "minwindef", "ntdef"], &["iphlpapi"]),
62 ("ntddscsi", &["basetsd", "minwindef", "ntdef", "winioctl", "winnt"], &[]),
63 ("ntddser", &["devpropdef"], &[]),
64 ("ntdef", &["basetsd", "guiddef"], &[]),
65 ("ntstatus", &["ntdef"], &[]),
66 ("qos", &["minwindef"], &[]),
67 ("rpc", &[], &[]),
68 ("rpcdce", &["guiddef", "minwindef", "rpc"], &[]),
69 ("rpcndr", &[], &[]),
70 ("sddl", &["basetsd", "minwindef", "winnt"], &["advapi32"]),
71 ("sspi", &["basetsd", "guiddef", "minwindef", "subauth", "wincred", "winnt"], &["credui", "secur32"]),
72 ("stralign", &["vcruntime", "winnt"], &["kernel32"]),
73 ("transportsettingcommon", &["guiddef"], &[]),
74 ("tvout", &["guiddef", "minwindef"], &[]),
75 ("usb", &["minwindef", "usbspec", "winnt"], &[]),
76 ("usbiodef", &["guiddef", "minwindef", "winioctl", "winnt"], &[]),
77 ("usbspec", &["basetsd", "guiddef", "minwindef", "winnt"], &[]),
78 ("windef", &["minwindef", "winnt"], &[]),
79 ("windowsx", &["minwindef"], &[]),
80 ("winerror", &["minwindef", "wtypesbase"], &[]),
81 ("winusbio", &["minwindef", "usb"], &[]),
82 ("wmistr", &["basetsd", "guiddef", "minwindef", "winnt"], &[]),
83 ("wnnc", &["minwindef"], &[]),
84 ("ws2def", &["basetsd", "guiddef", "inaddr", "minwindef", "vcruntime", "winnt"], &[]),
85 ("ws2ipdef", &["in6addr", "inaddr", "minwindef", "ws2def"], &[]),
86 ("wtypes", &["guiddef", "minwindef", "ntdef", "rpcndr", "wingdi", "wtypesbase"], &[]),
87 ("wtypesbase", &["minwindef", "rpcndr", "winnt"], &[]),
88 // ucrt
89 // um
90 ("accctrl", &["guiddef", "minwindef", "winbase", "winnt"], &[]),
91 ("aclapi", &["accctrl", "guiddef", "minwindef", "winnt"], &["advapi32"]),
92 ("appmgmt", &["guiddef", "minwindef", "winnt"], &["advapi32"]),
93 ("audioclient", &["audiosessiontypes", "basetsd", "guiddef", "minwindef", "mmreg", "strmif", "unknwnbase", "winerror", "winnt", "wtypesbase"], &[]),
94 ("audiosessiontypes", &["minwindef"], &[]),
95 ("avrt", &["guiddef", "minwindef", "winnt"], &["avrt"]),
96 ("bits", &["basetsd", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
97 ("bits10_1", &["basetsd", "bits", "bits2_0", "bits3_0", "bits5_0", "minwindef", "winnt"], &[]),
98 ("bits1_5", &["basetsd", "bits", "rpcndr", "winnt"], &[]),
99 ("bits2_0", &["basetsd", "bits", "bits1_5", "minwindef", "winnt"], &[]),
100 ("bits2_5", &["minwindef", "rpcndr", "unknwnbase", "winnt"], &[]),
101 ("bits3_0", &["basetsd", "bits", "bits2_0", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
102 ("bits4_0", &["basetsd", "bits3_0", "minwindef", "unknwnbase", "winnt"], &[]),
103 ("bits5_0", &["basetsd", "bits1_5", "bits3_0", "bits4_0", "guiddef", "minwindef", "winnt"], &[]),
104 ("bitscfg", &["guiddef", "oaidl", "unknwnbase", "winnt", "wtypes"], &["oleaut32"]),
105 ("bitsmsg", &["minwindef"], &[]),
106 ("bluetoothapis", &["bthdef", "bthsdpdef", "guiddef", "minwinbase", "minwindef", "windef", "winnt"], &["bthprops"]),
107 ("bluetoothleapis", &["bthledef", "minwindef", "winerror", "winnt"], &["bluetoothapis"]),
108 ("bthledef", &["basetsd", "guiddef", "minwindef", "winnt"], &[]),
109 ("cfgmgr32", &["basetsd", "cfg", "devpropdef", "guiddef", "minwindef", "winnt", "winreg"], &["cfgmgr32"]),
110 ("cguid", &[], &[]),
111 ("combaseapi", &["basetsd", "guiddef", "minwindef", "objidl", "objidlbase", "propidl", "rpcdce", "unknwnbase", "winnt", "wtypesbase"], &["ole32"]),
112 ("coml2api", &["minwindef"], &[]),
113 ("commapi", &["minwinbase", "minwindef", "winbase", "winnt"], &["kernel32"]),
114 ("commctrl", &["basetsd", "commoncontrols", "guiddef", "minwinbase", "minwindef", "vcruntime", "windef", "winnt", "winuser"], &["comctl32"]),
115 ("commdlg", &["basetsd", "minwindef", "prsht", "unknwnbase", "windef", "wingdi", "winnt", "winuser"], &["comdlg32"]),
116 ("commoncontrols", &["commctrl", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["comctl32"]),
117 ("consoleapi", &["minwindef", "wincon", "wincontypes", "winnt"], &["kernel32"]),
118 ("corsym", &["basetsd", "objidlbase", "unknwnbase", "winnt"], &[]),
119 ("d2d1", &["basetsd", "d2dbasetypes", "d3dcommon", "dcommon", "dwrite", "dxgi", "guiddef", "minwindef", "unknwnbase", "wincodec", "windef", "winnt"], &["d2d1"]),
120 ("d2d1_1", &["basetsd", "d2d1", "d2d1effectauthor", "d2dbasetypes", "dcommon", "documenttarget", "dwrite", "dxgi", "dxgiformat", "guiddef", "minwindef", "objidlbase", "unknwnbase", "wincodec", "winnt"], &["d2d1"]),
121 ("d2d1_2", &["d2d1", "d2d1_1", "dxgi", "minwindef", "winnt"], &["d2d1"]),
122 ("d2d1_3", &["basetsd", "d2d1", "d2d1_1", "d2d1_2", "d2d1effects", "d2d1svg", "dcommon", "dwrite", "dxgi", "dxgitype", "minwindef", "ntdef", "objidlbase", "wincodec", "winerror"], &["d2d1"]),
123 ("d2d1effectauthor", &["basetsd", "d2d1", "d2d1_1", "d2dbasetypes", "d3dcommon", "dxgiformat", "guiddef", "minwindef", "ntdef", "unknwnbase", "wincodec"], &[]),
124 ("d2d1effects", &[], &[]),
125 ("d2d1effects_1", &[], &[]),
126 ("d2d1effects_2", &[], &[]),
127 ("d2d1svg", &["basetsd", "d2d1", "d2d1_1", "guiddef", "minwindef", "ntdef", "objidlbase", "winerror"], &[]),
128 ("d2dbasetypes", &["d3d9types", "dcommon"], &[]),
129 ("d3d", &[], &[]),
130 ("d3d10", &["d3dcommon"], &[]),
131 ("d3d10_1", &[], &[]),
132 ("d3d10_1shader", &[], &[]),
133 ("d3d10effect", &[], &[]),
134 ("d3d10misc", &[], &[]),
135 ("d3d10sdklayers", &[], &[]),
136 ("d3d10shader", &["d3d10", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
137 ("d3d11", &["basetsd", "d3dcommon", "dxgi", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["d3d11"]),
138 ("d3d11_1", &["basetsd", "d3d11", "d3dcommon", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
139 ("d3d11_2", &["basetsd", "d3d11", "d3d11_1", "dxgiformat", "minwindef", "winnt"], &[]),
140 ("d3d11_3", &[], &[]),
141 ("d3d11_4", &[], &[]),
142 ("d3d11on12", &["d3d11", "d3d12", "d3dcommon", "guiddef", "minwindef", "unknwnbase", "winnt"], &["d3d11"]),
143 ("d3d11sdklayers", &["basetsd", "d3d11", "dxgi", "minwindef", "unknwnbase", "winnt"], &[]),
144 ("d3d11shader", &["basetsd", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
145 ("d3d11tokenizedprogramformat", &["minwindef"], &[]),
146 ("d3d12", &["basetsd", "d3dcommon", "dxgiformat", "dxgitype", "guiddef", "minwinbase", "minwindef", "unknwnbase", "windef", "winnt"], &["d3d12"]),
147 ("d3d12sdklayers", &["basetsd", "d3d12", "minwindef", "unknwnbase", "winnt"], &[]),
148 ("d3d12shader", &["basetsd", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
149 ("d3dcommon", &["basetsd", "minwindef", "unknwnbase", "winnt"], &[]),
150 ("d3dcompiler", &["basetsd", "d3d11shader", "d3dcommon", "guiddef", "minwindef", "winnt"], &["d3dcompiler"]),
151 ("d3dcsx", &[], &[]),
152 ("d3dx10core", &[], &[]),
153 ("d3dx10math", &[], &[]),
154 ("d3dx10mesh", &[], &[]),
155 ("datetimeapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]),
156 ("davclnt", &["minwindef", "winnt"], &["netapi32"]),
157 ("dbghelp", &["basetsd", "guiddef", "minwindef", "vcruntime", "winnt"], &["dbghelp"]),
158 ("dbt", &["basetsd", "guiddef", "minwindef", "winnt", "winuser"], &[]),
159 ("dcommon", &["basetsd", "dxgiformat", "minwindef", "windef"], &[]),
160 ("dcomp", &["d2d1", "d2d1_1", "d2d1effects", "d2dbasetypes", "d3d9types", "d3dcommon", "dcompanimation", "dcomptypes", "dxgi", "dxgi1_2", "dxgiformat", "guiddef", "minwinbase", "minwindef", "ntdef", "unknwnbase", "windef"], &["dcomp"]),
161 ("dcompanimation", &["ntdef", "unknwnbase"], &[]),
162 ("dde", &["basetsd", "minwindef"], &["user32"]),
163 ("ddraw", &[], &[]),
164 ("ddrawi", &[], &[]),
165 ("ddrawint", &[], &[]),
166 ("debugapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]),
167 ("devicetopology", &["guiddef", "minwindef", "unknwnbase", "windef", "winnt", "wtypes"], &[]),
168 ("dinput", &[], &[]),
169 ("dispex", &["basetsd", "guiddef", "minwindef", "oaidl", "servprov", "unknwnbase", "winerror", "winnt", "wtypes"], &[]),
170 ("dmksctl", &[], &[]),
171 ("dmusicc", &[], &[]),
172 ("docobj", &["guiddef", "minwindef", "oaidl", "unknwnbase", "winnt"], &[]),
173 ("documenttarget", &["basetsd", "guiddef", "ntdef", "unknwnbase"], &[]),
174 ("dpa_dsa", &["basetsd", "minwindef", "winnt"], &["comctl32"]),
175 ("dpapi", &["minwindef", "wincrypt", "windef", "winnt"], &["crypt32"]),
176 ("dsgetdc", &["guiddef", "minwindef", "ntsecapi", "winnt", "ws2def"], &["netapi32"]),
177 ("dsound", &["guiddef", "minwindef", "mmsystem", "unknwnbase", "windef", "winerror", "winnt"], &["dsound"]),
178 ("dsrole", &["guiddef", "minwindef", "winnt"], &["netapi32"]),
179 ("dvp", &[], &[]),
180 ("dwmapi", &["basetsd", "minwindef", "uxtheme", "windef", "winnt"], &["dwmapi"]),
181 ("dwrite", &["basetsd", "d2d1", "dcommon", "guiddef", "minwindef", "unknwnbase", "windef", "winerror", "wingdi", "winnt"], &["dwrite"]),
182 ("dwrite_1", &["basetsd", "dcommon", "dwrite", "minwindef", "winnt"], &[]),
183 ("dwrite_2", &["basetsd", "d3d9types", "dcommon", "dwrite", "dwrite_1", "minwindef", "unknwnbase", "winnt"], &[]),
184 ("dwrite_3", &["basetsd", "dcommon", "dwrite", "dwrite_1", "dwrite_2", "minwindef", "unknwnbase", "wingdi", "winnt"], &[]),
185 ("dxdiag", &[], &[]),
186 ("dxfile", &[], &[]),
187 ("dxgidebug", &["basetsd", "guiddef", "minwindef", "unknwnbase", "winnt"], &["dxgi"]),
188 ("dxva2api", &["basetsd", "d3d9", "d3d9types", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxva2"]),
189 ("dxvahd", &["d3d9", "d3d9types", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxva2"]),
190 ("endpointvolume", &["basetsd", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
191 ("errhandlingapi", &["basetsd", "minwindef", "winnt"], &["kernel32"]),
192 ("evntcons", &["basetsd", "evntprov", "evntrace", "guiddef", "minwindef", "winnt"], &["advapi32"]),
193 ("exdisp", &["basetsd", "docobj", "oaidl", "ocidl", "winnt", "wtypes"], &[]),
194 ("fibersapi", &["minwindef", "winnt"], &["kernel32"]),
195 ("fileapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]),
196 ("functiondiscoverykeys_devpkey", &["wtypes"], &[]),
197 ("gl-gl", &[], &["opengl32"]),
198 ("handleapi", &["minwindef", "winnt"], &["kernel32"]),
199 ("heapapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
200 ("highlevelmonitorconfigurationapi", &["minwindef", "physicalmonitorenumerationapi", "winnt"], &["dxva2"]),
201 ("http", &["guiddef", "minwinbase", "minwindef", "sspi", "winnt", "ws2def"], &["winhttp"]),
202 ("imm", &["minwindef", "windef"], &["imm32"]),
203 ("interlockedapi", &["minwindef", "winnt"], &["kernel32"]),
204 ("ioapiset", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
205 ("jobapi", &["minwindef", "winnt"], &["kernel32"]),
206 ("jobapi2", &["basetsd", "minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]),
207 ("knownfolders", &[], &[]),
208 ("ktmw32", &["guiddef", "minwinbase", "minwindef", "winnt"], &["ktmw32"]),
209 ("libloaderapi", &["basetsd", "minwindef", "winnt"], &["kernel32", "user32"]),
210 ("lmaccess", &["basetsd", "lmcons", "minwindef", "winnt"], &["netapi32"]),
211 ("lmalert", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
212 ("lmapibuf", &["lmcons", "minwindef"], &["netapi32"]),
213 ("lmat", &["basetsd", "lmcons", "minwindef", "winnt"], &["netapi32"]),
214 ("lmdfs", &["guiddef", "lmcons", "minwindef", "winnt"], &["netapi32"]),
215 ("lmerrlog", &["minwindef", "winnt"], &[]),
216 ("lmjoin", &["lmcons", "minwindef", "wincrypt", "winnt"], &["netapi32"]),
217 ("lmmsg", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
218 ("lmremutl", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
219 ("lmrepl", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
220 ("lmserver", &["guiddef", "lmcons", "minwindef", "winnt", "winsvc"], &["advapi32", "netapi32"]),
221 ("lmshare", &["basetsd", "guiddef", "lmcons", "minwindef", "winnt"], &["netapi32"]),
222 ("lmstats", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
223 ("lmsvc", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
224 ("lmuse", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
225 ("lmwksta", &["lmcons", "minwindef", "winnt"], &["netapi32"]),
226 ("lowlevelmonitorconfigurationapi", &["minwindef", "physicalmonitorenumerationapi", "winnt"], &["dxva2"]),
227 ("lsalookup", &["guiddef", "minwindef", "ntdef", "winnt"], &["advapi32"]),
228 ("memoryapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
229 ("minschannel", &["guiddef", "minwindef", "wincrypt", "winnt"], &[]),
230 ("minwinbase", &["basetsd", "minwindef", "ntstatus", "winnt"], &[]),
231 ("mmdeviceapi", &["guiddef", "minwindef", "propidl", "propsys", "unknwnbase", "winnt", "wtypes"], &["mmdevapi"]),
232 ("mmeapi", &["basetsd", "imm", "minwindef", "mmsystem", "winnt"], &["winmm"]),
233 ("mmsystem", &["basetsd", "minwindef", "mmreg", "winnt"], &[]),
234 ("msaatext", &[], &[]),
235 ("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]),
236 ("mschapp", &["basetsd", "minwindef", "winnt"], &["advapi32"]),
237 ("mssip", &["guiddef", "minwindef", "mscat", "wincrypt", "winnt"], &["crypt32"]),
238 ("mswsock", &["minwinbase", "minwindef", "mswsockdef", "winnt", "winsock2", "ws2def"], &["mswsock"]),
239 ("namedpipeapi", &["minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]),
240 ("namespaceapi", &["minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]),
241 ("nb30", &["minwindef", "winnt"], &["netapi32"]),
242 ("ncrypt", &["basetsd", "bcrypt", "minwindef", "winnt"], &["ncrypt"]),
243 ("ntlsa", &["basetsd", "guiddef", "lsalookup", "minwindef", "ntdef", "ntsecapi", "subauth", "winnt"], &["advapi32"]),
244 ("ntsecapi", &["basetsd", "guiddef", "lsalookup", "minwindef", "ntdef", "sspi", "subauth", "winnt"], &["advapi32"]),
245 ("oaidl", &["basetsd", "guiddef", "minwindef", "rpcndr", "unknwnbase", "winnt", "wtypes", "wtypesbase"], &[]),
246 ("objbase", &["combaseapi", "minwindef", "winnt"], &["ole32"]),
247 ("objidl", &["basetsd", "guiddef", "minwindef", "ntdef", "objidlbase", "unknwnbase", "windef", "winnt", "wtypes", "wtypesbase"], &[]),
248 ("objidlbase", &["basetsd", "guiddef", "minwindef", "unknwnbase", "winnt", "wtypesbase"], &[]),
249 ("ocidl", &["guiddef", "minwindef", "ntdef", "oaidl", "unknwnbase", "wtypes", "wtypesbase"], &[]),
250 ("ole2", &["minwindef", "oleidl", "windef", "winnt"], &["ole32"]),
251 ("oleauto", &["basetsd", "minwinbase", "minwindef", "oaidl", "winnt", "wtypes", "wtypesbase"], &["oleaut32"]),
252 ("olectl", &["winerror", "winnt"], &[]),
253 ("oleidl", &["minwindef", "ntdef", "objidl", "unknwnbase", "windef"], &[]),
254 ("opmapi", &["basetsd", "d3d9", "d3d9types", "dxva2api", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxva2"]),
255 ("pdh", &["basetsd", "guiddef", "minwindef", "windef", "winnt"], &["pdh"]),
256 ("perflib", &["basetsd", "guiddef", "minwinbase", "minwindef", "winnt"], &["advapi32"]),
257 ("physicalmonitorenumerationapi", &["d3d9", "minwindef", "windef", "winnt"], &["dxva2"]),
258 ("playsoundapi", &["minwindef", "winnt"], &["winmm"]),
259 ("portabledevice", &["basetsd", "wtypes"], &[]),
260 ("portabledeviceapi", &["guiddef", "minwindef", "objidlbase", "portabledevicetypes", "propkeydef", "unknwnbase", "winnt"], &[]),
261 ("portabledevicetypes", &["guiddef", "minwindef", "propidl", "propkeydef", "propsys", "unknwnbase", "winnt", "wtypes"], &[]),
262 ("powerbase", &["minwindef", "winnt", "winuser"], &["powrprof"]),
263 ("powersetting", &["guiddef", "minwindef", "winnt", "winuser"], &["powrprof"]),
264 ("powrprof", &["guiddef", "minwindef", "winnt", "winreg"], &["powrprof"]),
265 ("processenv", &["minwindef", "winnt"], &["kernel32"]),
266 ("processsnapshot", &["basetsd", "minwindef", "winnt"], &["kernel32"]),
267 ("processthreadsapi", &["basetsd", "guiddef", "minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]),
268 ("processtopologyapi", &["minwindef", "winnt"], &["kernel32"]),
269 ("profileapi", &["minwindef", "winnt"], &["kernel32"]),
270 ("propidl", &["guiddef", "minwindef", "ntdef", "oaidl", "objidlbase", "unknwnbase", "wtypes", "wtypesbase"], &["ole32"]),
271 ("propkey", &["minwindef", "ntdef", "wtypes"], &[]),
272 ("propkeydef", &["guiddef", "wtypes"], &[]),
273 ("propsys", &["minwindef", "propidl", "propkeydef", "unknwnbase", "winnt", "wtypes"], &[]),
274 ("prsht", &["basetsd", "minwindef", "windef", "winnt", "winuser"], &["comctl32"]),
275 ("psapi", &["basetsd", "minwindef", "winnt"], &["kernel32", "psapi"]),
276 ("realtimeapiset", &["basetsd", "minwindef", "winnt"], &["kernel32"]),
277 ("reason", &["minwindef"], &[]),
278 ("restartmanager", &["minwindef", "winnt"], &["rstrtmgr"]),
279 ("restrictederrorinfo", &["unknwnbase", "winnt", "wtypes"], &[]),
280 ("rmxfguid", &[], &[]),
281 ("sapi", &["guiddef", "minwindef", "sapi53", "unknwnbase", "winnt"], &[]),
282 ("sapi51", &["guiddef", "minwindef", "mmreg", "oaidl", "objidlbase", "rpcndr", "servprov", "unknwnbase", "windef", "winnt", "wtypes", "wtypesbase"], &[]),
283 ("sapi53", &["guiddef", "minwindef", "oaidl", "sapi51", "unknwnbase", "urlmon", "winnt", "wtypes"], &[]),
284 ("sapiddk", &["guiddef", "minwindef", "sapi", "sapiddk51", "unknwnbase", "winnt"], &[]),
285 ("sapiddk51", &["guiddef", "minwindef", "mmreg", "oaidl", "objidlbase", "sapi", "unknwnbase", "windef", "winnt"], &[]),
286 ("schannel", &["guiddef", "minwindef", "wincrypt", "windef", "winnt"], &[]),
287 ("securityappcontainer", &["minwindef", "winnt"], &["kernel32"]),
288 ("securitybaseapi", &["guiddef", "minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]),
289 ("servprov", &["guiddef", "unknwnbase", "winnt"], &[]),
290 ("setupapi", &["basetsd", "commctrl", "devpropdef", "guiddef", "minwindef", "prsht", "spapidef", "windef", "winnt", "winreg"], &["setupapi"]),
291 ("shellapi", &["basetsd", "guiddef", "minwinbase", "minwindef", "processthreadsapi", "windef", "winnt", "winuser"], &["shell32", "shlwapi"]),
292 ("shellscalingapi", &["minwindef", "windef", "winnt"], &["shcore"]),
293 ("shlobj", &["guiddef", "minwinbase", "minwindef", "shtypes", "windef", "winnt"], &["shell32"]),
294 ("shobjidl", &["guiddef", "minwindef", "objidl", "propkeydef", "propsys", "shobjidl_core", "shtypes", "unknwnbase", "windef", "winnt"], &[]),
295 ("shobjidl_core", &["commctrl", "guiddef", "minwindef", "objidl", "unknwnbase", "windef", "winnt"], &[]),
296 ("shtypes", &["guiddef", "minwindef", "winnt"], &[]),
297 ("spapidef", &["minwindef", "winnt"], &[]),
298 ("spellcheck", &["minwindef", "ntdef", "objidlbase", "unknwnbase", "winerror"], &[]),
299 ("sporder", &["guiddef", "minwindef"], &["sporder"]),
300 ("sql", &["sqltypes"], &["odbc32"]),
301 ("sqlext", &["sql", "sqltypes"], &[]),
302 ("sqltypes", &["basetsd", "guiddef", "windef"], &[]),
303 ("sqlucode", &["sqltypes"], &["odbc32"]),
304 ("stringapiset", &["minwindef", "winnls", "winnt"], &["kernel32"]),
305 ("strmif", &["winnt"], &[]),
306 ("subauth", &["minwindef", "winnt"], &[]),
307 ("synchapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32", "synchronization"]),
308 ("sysinfoapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
309 ("systemtopologyapi", &["minwindef", "winnt"], &["kernel32"]),
310 ("taskschd", &["minwinbase", "minwindef", "oaidl", "unknwnbase", "winnt", "wtypes"], &[]),
311 ("textstor", &[], &[]),
312 ("threadpoolapiset", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
313 ("threadpoollegacyapiset", &["minwinbase", "minwindef", "winnt"], &["kernel32"]),
314 ("timeapi", &["minwindef", "mmsystem"], &["winmm"]),
315 ("timezoneapi", &["minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]),
316 ("tlhelp32", &["basetsd", "minwindef", "winnt"], &["kernel32"]),
317 ("unknwnbase", &["guiddef", "minwindef", "winnt"], &[]),
318 ("urlhist", &["docobj", "guiddef", "minwindef", "unknwnbase", "winnt", "wtypesbase"], &[]),
319 ("urlmon", &["minwindef", "unknwnbase", "winnt"], &[]),
320 ("userenv", &["minwindef", "winnt", "winreg"], &["userenv"]),
321 ("usp10", &["minwindef", "ntdef", "windef", "winerror", "wingdi", "winnt"], &["usp10"]),
322 ("utilapiset", &["minwindef", "ntdef"], &["kernel32"]),
323 ("uxtheme", &["commctrl", "minwindef", "windef", "wingdi", "winnt"], &["uxtheme"]),
324 ("vsbackup", &["guiddef", "minwindef", "unknwnbase", "vss", "vswriter", "winnt", "wtypes"], &["vssapi"]),
325 ("vss", &["guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
326 ("vsserror", &["winnt"], &[]),
327 ("vswriter", &["minwindef", "unknwnbase", "vss", "winnt", "wtypes"], &[]),
328 ("wbemads", &["oaidl", "wbemdisp", "winerror", "wtypes"], &[]),
329 ("wbemcli", &["minwindef", "oaidl", "rpcndr", "unknwnbase", "winerror", "winnt", "wtypes"], &[]),
330 ("wbemdisp", &["oaidl", "unknwnbase", "winerror", "wtypes"], &[]),
331 ("wbemprov", &["minwindef", "oaidl", "unknwnbase", "wbemcli", "winerror", "winnt", "wtypes"], &[]),
332 ("wbemtran", &["guiddef", "minwindef", "unknwnbase", "wbemcli", "winerror", "winnt", "wtypes"], &[]),
333 ("wct", &["basetsd", "guiddef", "minwindef", "winnt"], &["advapi32"]),
334 ("werapi", &["minwindef", "winnt"], &["kernel32", "wer"]),
335 ("winbase", &["basetsd", "cfgmgr32", "fileapi", "guiddef", "libloaderapi", "minwinbase", "minwindef", "processthreadsapi", "vadefs", "windef", "winnt"], &["kernel32"]),
336 ("wincodec", &["basetsd", "d2d1", "d2d1_1", "dcommon", "dxgiformat", "dxgitype", "guiddef", "minwindef", "ntdef", "objidlbase", "ocidl", "propidl", "unknwnbase", "windef", "winerror", "winnt"], &["windowscodecs"]),
337 ("wincodecsdk", &["guiddef", "minwindef", "oaidl", "objidl", "objidlbase", "ocidl", "propidl", "unknwnbase", "wincodec", "winnt", "wtypes"], &["ole32", "oleaut32", "windowscodecs"]),
338 ("wincon", &["minwinbase", "minwindef", "wincontypes", "windef", "wingdi", "winnt"], &["kernel32"]),
339 ("wincontypes", &["minwindef", "winnt"], &[]),
340 ("wincred", &["minwindef", "sspi", "windef", "winnt"], &["advapi32", "credui"]),
341 ("wincrypt", &["basetsd", "bcrypt", "guiddef", "minwinbase", "minwindef", "ncrypt", "vcruntime", "winnt"], &["advapi32", "crypt32", "cryptnet"]),
342 ("windowsceip", &["minwindef"], &["kernel32"]),
343 ("winefs", &["basetsd", "minwinbase", "minwindef", "wincrypt", "winnt"], &["advapi32"]),
344 ("winevt", &["basetsd", "guiddef", "minwinbase", "minwindef", "vcruntime", "winnt"], &["wevtapi"]),
345 ("wingdi", &["basetsd", "minwindef", "windef", "winnt"], &["gdi32", "msimg32", "opengl32", "winspool"]),
346 ("winhttp", &["basetsd", "minwinbase", "minwindef", "winnt"], &["winhttp"]),
347 ("wininet", &["basetsd", "minwinbase", "minwindef", "ntdef", "windef", "winineti", "winnt"], &["wininet"]),
348 ("winineti", &["minwindef"], &[]),
349 ("winioctl", &["basetsd", "devpropdef", "guiddef", "minwindef", "winnt"], &[]),
350 ("winnetwk", &["basetsd", "minwindef", "windef", "winerror", "winnt"], &["mpr"]),
351 ("winnls", &["basetsd", "guiddef", "minwinbase", "minwindef", "winnt"], &["kernel32"]),
352 ("winnt", &["basetsd", "excpt", "guiddef", "ktmtypes", "minwindef", "ntdef", "vcruntime"], &["kernel32"]),
353 ("winreg", &["basetsd", "minwinbase", "minwindef", "winnt"], &["advapi32"]),
354 ("winsafer", &["basetsd", "guiddef", "minwindef", "wincrypt", "windef", "winnt"], &["advapi32"]),
355 ("winscard", &["basetsd", "guiddef", "minwindef", "rpcdce", "windef", "winnt", "winsmcrd"], &["winscard"]),
356 ("winsmcrd", &["minwindef", "winioctl"], &[]),
357 ("winsock2", &["basetsd", "guiddef", "inaddr", "minwinbase", "minwindef", "qos", "winbase", "windef", "winerror", "winnt", "ws2def", "wtypesbase"], &["ws2_32"]),
358 ("winspool", &["guiddef", "minwinbase", "minwindef", "vcruntime", "windef", "winerror", "wingdi", "winnt"], &["winspool"]),
359 ("winsvc", &["minwindef", "winnt"], &["advapi32"]),
360 ("winusb", &["minwinbase", "minwindef", "usb", "usbspec", "winnt", "winusbio"], &["winusb"]),
361 ("winuser", &["basetsd", "guiddef", "limits", "minwinbase", "minwindef", "vadefs", "windef", "wingdi", "winnt"], &["user32"]),
362 ("winver", &["minwindef", "winnt"], &["kernel32", "version"]),
363 ("wow64apiset", &["minwindef", "winnt"], &["kernel32"]),
364 ("wpdmtpextensions", &["wtypes"], &[]),
365 ("ws2bth", &["bthdef", "bthsdpdef", "guiddef", "minwindef", "winnt", "ws2def"], &[]),
366 ("ws2spi", &["basetsd", "guiddef", "minwindef", "vcruntime", "windef", "winnt", "winsock2", "ws2def", "wtypesbase"], &["ws2_32"]),
367 ("ws2tcpip", &["guiddef", "minwinbase", "minwindef", "mstcpip", "vcruntime", "winerror", "winnt", "winsock2", "ws2def", "wtypesbase"], &["fwpuclnt", "ws2_32"]),
368 ("xinput", &["guiddef", "minwindef", "winnt"], &["xinput"]),
369 // vc
370 ("excpt", &[], &[]),
371 ("limits", &[], &[]),
372 ("vadefs", &[], &[]),
373 ("vcruntime", &[], &[]),
374 // winrt
375 ("activation", &["inspectable", "winnt"], &[]),
376 ("hstring", &["winnt"], &[]),
377 ("inspectable", &["guiddef", "hstring", "minwindef", "unknwnbase", "winnt"], &[]),
378 ("roapi", &["activation", "basetsd", "guiddef", "hstring", "inspectable", "objidl", "winnt"], &["runtimeobject"]),
379 ("robuffer", &["objidl", "winnt"], &["runtimeobject"]),
380 ("roerrorapi", &["basetsd", "hstring", "minwindef", "restrictederrorinfo", "unknwnbase", "winnt"], &["runtimeobject"]),
381 ("winstring", &["basetsd", "hstring", "minwindef", "winnt"], &["runtimeobject"]),
382 ];
383 struct Header {
384 required: bool,
385 included: Cell<bool>,
386 dependencies: &'static [&'static str],
387 libraries: &'static [&'static str],
388 }
389 struct Graph(HashMap<&'static str, Header>);
390 impl Graph {
391 fn generate() -> Graph {
392 Graph(DATA.iter().map(|&(name, dependencies, libraries)| {
393 let header = Header {
394 required: false,
395 included: Cell::new(false),
396 dependencies: dependencies,
397 libraries: libraries,
398 };
399 (name, header)
400 }).collect())
401 }
402 fn identify_required(&mut self) {
403 for (name, header) in &mut self.0 {
404 if let Ok(_) = var(&format!("CARGO_FEATURE_{}", name.to_uppercase())) {
405 header.required = true;
406 header.included.set(true);
407 }
408 }
409 }
410 fn check_everything(&self) {
411 if let Ok(_) = var("CARGO_FEATURE_EVERYTHING") {
412 for (_, header) in &self.0 {
413 header.included.set(true);
414 }
415 }
416 }
417 fn resolve_dependencies(&self) {
418 let mut done = false;
419 while !done {
420 done = true;
421 for (_, header) in &self.0 {
422 if header.included.get() {
423 for dep in header.dependencies {
424 let dep = &self.0.get(dep).expect(dep);
425 if !dep.included.get() {
426 done = false;
427 dep.included.set(true);
428 }
429 }
430 }
431 }
432 }
433 }
434 fn emit_features(&self) {
435 for (name, header) in &self.0 {
436 if header.included.get() && !header.required {
437 println!("cargo:rustc-cfg=feature=\"{}\"", name);
438 }
439 }
440 }
441 fn emit_libraries(&self) {
442 let mut libs = self.0.iter().filter(|&(_, header)| {
443 header.included.get()
444 }).flat_map(|(_, header)| {
445 header.libraries.iter()
446 }).collect::<Vec<_>>();
447 libs.sort();
448 libs.dedup();
449 // FIXME Temporary hacks until build script is redesigned.
450 libs.retain(|&&lib| match &*var("TARGET").unwrap() {
451 "aarch64-pc-windows-msvc" | "thumbv7a-pc-windows-msvc" => {
452 if lib == "opengl32" { false }
453 else { true }
454 },
455 _ => true,
456 });
457 let prefix = library_prefix();
458 let kind = library_kind();
459 for lib in libs {
460 println!("cargo:rustc-link-lib={}={}{}", kind, prefix, lib);
461 }
462 }
463 }
464 fn library_prefix() -> &'static str {
465 if var("TARGET").map(|target|
466 target == "i686-pc-windows-gnu" || target == "x86_64-pc-windows-gnu"
467 ).unwrap_or(false) && var("WINAPI_NO_BUNDLED_LIBRARIES").is_err() {
468 "winapi_"
469 } else {
470 ""
471 }
472 }
473 fn library_kind() -> &'static str {
474 if var("WINAPI_STATIC_NOBUNDLE").is_ok() {
475 "static-nobundle"
476 } else {
477 "dylib"
478 }
479 }
480 fn try_everything() {
481 let mut graph = Graph::generate();
482 graph.identify_required();
483 graph.check_everything();
484 graph.resolve_dependencies();
485 graph.emit_features();
486 graph.emit_libraries();
487 }
488 fn main() {
489 println!("cargo:rerun-if-changed=build.rs");
490 println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES");
491 println!("cargo:rerun-if-env-changed=WINAPI_STATIC_NOBUNDLE");
492 let target = var("TARGET").unwrap();
493 let target: Vec<_> = target.split('-').collect();
494 if target.get(2) == Some(&"windows") {
495 try_everything();
496 }
497 }