6177ceee117c7799af8393f02ad92375f266347de1a2320f6626d81344647d1c34d1fa696fbd0b03e98840b01788c591da03e2b77c5ed881ce812b0945a82e 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. # Copyright (c) 2012 Google Inc. 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. r"""Code to validate and convert settings of the Microsoft build tools.
  5. This file contains code to validate and convert settings of the Microsoft
  6. build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
  7. and ValidateMSBuildSettings() are the entry points.
  8. This file was created by comparing the projects created by Visual Studio 2008
  9. and Visual Studio 2010 for all available settings through the user interface.
  10. The MSBuild schemas were also considered. They are typically found in the
  11. MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
  12. """
  13. import re
  14. import sys
  15. # Dictionaries of settings validators. The key is the tool name, the value is
  16. # a dictionary mapping setting names to validation functions.
  17. _msvs_validators = {}
  18. _msbuild_validators = {}
  19. # A dictionary of settings converters. The key is the tool name, the value is
  20. # a dictionary mapping setting names to conversion functions.
  21. _msvs_to_msbuild_converters = {}
  22. # Tool name mapping from MSVS to MSBuild.
  23. _msbuild_name_of_tool = {}
  24. class _Tool:
  25. """Represents a tool used by MSVS or MSBuild.
  26. Attributes:
  27. msvs_name: The name of the tool in MSVS.
  28. msbuild_name: The name of the tool in MSBuild.
  29. """
  30. def __init__(self, msvs_name, msbuild_name):
  31. self.msvs_name = msvs_name
  32. self.msbuild_name = msbuild_name
  33. def _AddTool(tool):
  34. """Adds a tool to the four dictionaries used to process settings.
  35. This only defines the tool. Each setting also needs to be added.
  36. Args:
  37. tool: The _Tool object to be added.
  38. """
  39. _msvs_validators[tool.msvs_name] = {}
  40. _msbuild_validators[tool.msbuild_name] = {}
  41. _msvs_to_msbuild_converters[tool.msvs_name] = {}
  42. _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name
  43. def _GetMSBuildToolSettings(msbuild_settings, tool):
  44. """Returns an MSBuild tool dictionary. Creates it if needed."""
  45. return msbuild_settings.setdefault(tool.msbuild_name, {})
  46. class _Type:
  47. """Type of settings (Base class)."""
  48. def ValidateMSVS(self, value):
  49. """Verifies that the value is legal for MSVS.
  50. Args:
  51. value: the value to check for this type.
  52. Raises:
  53. ValueError if value is not valid for MSVS.
  54. """
  55. def ValidateMSBuild(self, value):
  56. """Verifies that the value is legal for MSBuild.
  57. Args:
  58. value: the value to check for this type.
  59. Raises:
  60. ValueError if value is not valid for MSBuild.
  61. """
  62. def ConvertToMSBuild(self, value):
  63. """Returns the MSBuild equivalent of the MSVS value given.
  64. Args:
  65. value: the MSVS value to convert.
  66. Returns:
  67. the MSBuild equivalent.
  68. Raises:
  69. ValueError if value is not valid.
  70. """
  71. return value
  72. class _String(_Type):
  73. """A setting that's just a string."""
  74. def ValidateMSVS(self, value):
  75. if not isinstance(value, str):
  76. raise ValueError("expected string; got %r" % value)
  77. def ValidateMSBuild(self, value):
  78. if not isinstance(value, str):
  79. raise ValueError("expected string; got %r" % value)
  80. def ConvertToMSBuild(self, value):
  81. # Convert the macros
  82. return ConvertVCMacrosToMSBuild(value)
  83. class _StringList(_Type):
  84. """A settings that's a list of strings."""
  85. def ValidateMSVS(self, value):
  86. if not isinstance(value, (list, str)):
  87. raise ValueError("expected string list; got %r" % value)
  88. def ValidateMSBuild(self, value):
  89. if not isinstance(value, (list, str)):
  90. raise ValueError("expected string list; got %r" % value)
  91. def ConvertToMSBuild(self, value):
  92. # Convert the macros
  93. if isinstance(value, list):
  94. return [ConvertVCMacrosToMSBuild(i) for i in value]
  95. else:
  96. return ConvertVCMacrosToMSBuild(value)
  97. class _Boolean(_Type):
  98. """Boolean settings, can have the values 'false' or 'true'."""
  99. def _Validate(self, value):
  100. if value not in {"true", "false"}:
  101. raise ValueError("expected bool; got %r" % value)
  102. def ValidateMSVS(self, value):
  103. self._Validate(value)
  104. def ValidateMSBuild(self, value):
  105. self._Validate(value)
  106. def ConvertToMSBuild(self, value):
  107. self._Validate(value)
  108. return value
  109. class _Integer(_Type):
  110. """Integer settings."""
  111. def __init__(self, msbuild_base=10):
  112. _Type.__init__(self)
  113. self._msbuild_base = msbuild_base
  114. def ValidateMSVS(self, value):
  115. # Try to convert, this will raise ValueError if invalid.
  116. self.ConvertToMSBuild(value)
  117. def ValidateMSBuild(self, value):
  118. # Try to convert, this will raise ValueError if invalid.
  119. int(value, self._msbuild_base)
  120. def ConvertToMSBuild(self, value):
  121. msbuild_format = ((self._msbuild_base == 10) and "%d") or "0x%04x"
  122. return msbuild_format % int(value)
  123. class _Enumeration(_Type):
  124. """Type of settings that is an enumeration.
  125. In MSVS, the values are indexes like '0', '1', and '2'.
  126. MSBuild uses text labels that are more representative, like 'Win32'.
  127. Constructor args:
  128. label_list: an array of MSBuild labels that correspond to the MSVS index.
  129. In the rare cases where MSVS has skipped an index value, None is
  130. used in the array to indicate the unused spot.
  131. new: an array of labels that are new to MSBuild.
  132. """
  133. def __init__(self, label_list, new=None):
  134. _Type.__init__(self)
  135. self._label_list = label_list
  136. self._msbuild_values = {value for value in label_list if value is not None}
  137. if new is not None:
  138. self._msbuild_values.update(new)
  139. def ValidateMSVS(self, value):
  140. # Try to convert. It will raise an exception if not valid.
  141. self.ConvertToMSBuild(value)
  142. def ValidateMSBuild(self, value):
  143. if value not in self._msbuild_values:
  144. raise ValueError("unrecognized enumerated value %s" % value)
  145. def ConvertToMSBuild(self, value):
  146. index = int(value)
  147. if index < 0 or index >= len(self._label_list):
  148. raise ValueError(
  149. "index value (%d) not in expected range [0, %d)"
  150. % (index, len(self._label_list))
  151. )
  152. label = self._label_list[index]
  153. if label is None:
  154. raise ValueError("converted value for %s not specified." % value)
  155. return label
  156. # Instantiate the various generic types.
  157. _boolean = _Boolean()
  158. _integer = _Integer()
  159. # For now, we don't do any special validation on these types:
  160. _string = _String()
  161. _file_name = _String()
  162. _folder_name = _String()
  163. _file_list = _StringList()
  164. _folder_list = _StringList()
  165. _string_list = _StringList()
  166. # Some boolean settings went from numerical values to boolean. The
  167. # mapping is 0: default, 1: false, 2: true.
  168. _newly_boolean = _Enumeration(["", "false", "true"])
  169. def _Same(tool, name, setting_type):
  170. """Defines a setting that has the same name in MSVS and MSBuild.
  171. Args:
  172. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  173. name: the name of the setting.
  174. setting_type: the type of this setting.
  175. """
  176. _Renamed(tool, name, name, setting_type)
  177. def _Renamed(tool, msvs_name, msbuild_name, setting_type):
  178. """Defines a setting for which the name has changed.
  179. Args:
  180. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  181. msvs_name: the name of the MSVS setting.
  182. msbuild_name: the name of the MSBuild setting.
  183. setting_type: the type of this setting.
  184. """
  185. def _Translate(value, msbuild_settings):
  186. msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
  187. msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)
  188. _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS
  189. _msbuild_validators[tool.msbuild_name][msbuild_name] = setting_type.ValidateMSBuild
  190. _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
  191. def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
  192. _MovedAndRenamed(
  193. tool, settings_name, msbuild_tool_name, settings_name, setting_type
  194. )
  195. def _MovedAndRenamed(
  196. tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type
  197. ):
  198. """Defines a setting that may have moved to a new section.
  199. Args:
  200. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  201. msvs_settings_name: the MSVS name of the setting.
  202. msbuild_tool_name: the name of the MSBuild tool to place the setting under.
  203. msbuild_settings_name: the MSBuild name of the setting.
  204. setting_type: the type of this setting.
  205. """
  206. def _Translate(value, msbuild_settings):
  207. tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})
  208. tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)
  209. _msvs_validators[tool.msvs_name][msvs_settings_name] = setting_type.ValidateMSVS
  210. validator = setting_type.ValidateMSBuild
  211. _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
  212. _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate
  213. def _MSVSOnly(tool, name, setting_type):
  214. """Defines a setting that is only found in MSVS.
  215. Args:
  216. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  217. name: the name of the setting.
  218. setting_type: the type of this setting.
  219. """
  220. def _Translate(unused_value, unused_msbuild_settings):
  221. # Since this is for MSVS only settings, no translation will happen.
  222. pass
  223. _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS
  224. _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
  225. def _MSBuildOnly(tool, name, setting_type):
  226. """Defines a setting that is only found in MSBuild.
  227. Args:
  228. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  229. name: the name of the setting.
  230. setting_type: the type of this setting.
  231. """
  232. def _Translate(value, msbuild_settings):
  233. # Let msbuild-only properties get translated as-is from msvs_settings.
  234. tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {})
  235. tool_settings[name] = value
  236. _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild
  237. _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
  238. def _ConvertedToAdditionalOption(tool, msvs_name, flag):
  239. """Defines a setting that's handled via a command line option in MSBuild.
  240. Args:
  241. tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
  242. msvs_name: the name of the MSVS setting that if 'true' becomes a flag
  243. flag: the flag to insert at the end of the AdditionalOptions
  244. """
  245. def _Translate(value, msbuild_settings):
  246. if value == "true":
  247. tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
  248. if "AdditionalOptions" in tool_settings:
  249. new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag)
  250. else:
  251. new_flags = flag
  252. tool_settings["AdditionalOptions"] = new_flags
  253. _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS
  254. _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
  255. def _CustomGeneratePreprocessedFile(tool, msvs_name):
  256. def _Translate(value, msbuild_settings):
  257. tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
  258. if value == "0":
  259. tool_settings["PreprocessToFile"] = "false"
  260. tool_settings["PreprocessSuppressLineNumbers"] = "false"
  261. elif value == "1": # /P
  262. tool_settings["PreprocessToFile"] = "true"
  263. tool_settings["PreprocessSuppressLineNumbers"] = "false"
  264. elif value == "2": # /EP /P
  265. tool_settings["PreprocessToFile"] = "true"
  266. tool_settings["PreprocessSuppressLineNumbers"] = "true"
  267. else:
  268. raise ValueError("value must be one of [0, 1, 2]; got %s" % value)
  269. # Create a bogus validator that looks for '0', '1', or '2'
  270. msvs_validator = _Enumeration(["a", "b", "c"]).ValidateMSVS
  271. _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
  272. msbuild_validator = _boolean.ValidateMSBuild
  273. msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
  274. msbuild_tool_validators["PreprocessToFile"] = msbuild_validator
  275. msbuild_tool_validators["PreprocessSuppressLineNumbers"] = msbuild_validator
  276. _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
  277. fix_vc_macro_slashes_regex_list = ("IntDir", "OutDir")
  278. fix_vc_macro_slashes_regex = re.compile(
  279. r"(\$\((?:%s)\))(?:[\\/]+)" % "|".join(fix_vc_macro_slashes_regex_list)
  280. )
  281. # Regular expression to detect keys that were generated by exclusion lists
  282. _EXCLUDED_SUFFIX_RE = re.compile("^(.*)_excluded$")
  283. def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):
  284. """Verify that 'setting' is valid if it is generated from an exclusion list.
  285. If the setting appears to be generated from an exclusion list, the root name
  286. is checked.
  287. Args:
  288. setting: A string that is the setting name to validate
  289. settings: A dictionary where the keys are valid settings
  290. error_msg: The message to emit in the event of error
  291. stderr: The stream receiving the error messages.
  292. """
  293. # This may be unrecognized because it's an exclusion list. If the
  294. # setting name has the _excluded suffix, then check the root name.
  295. unrecognized = True
  296. m = re.match(_EXCLUDED_SUFFIX_RE, setting)
  297. if m:
  298. root_setting = m.group(1)
  299. unrecognized = root_setting not in settings
  300. if unrecognized:
  301. # We don't know this setting. Give a warning.
  302. print(error_msg, file=stderr)
  303. def FixVCMacroSlashes(s):
  304. """Replace macros which have excessive following slashes.
  305. These macros are known to have a built-in trailing slash. Furthermore, many
  306. scripts hiccup on processing paths with extra slashes in the middle.
  307. This list is probably not exhaustive. Add as needed.
  308. """
  309. if "$" in s:
  310. s = fix_vc_macro_slashes_regex.sub(r"\1", s)
  311. return s
  312. def ConvertVCMacrosToMSBuild(s):
  313. """Convert the MSVS macros found in the string to the MSBuild equivalent.
  314. This list is probably not exhaustive. Add as needed.
  315. """
  316. if "$" in s:
  317. replace_map = {
  318. "$(ConfigurationName)": "$(Configuration)",
  319. "$(InputDir)": "%(RelativeDir)",
  320. "$(InputExt)": "%(Extension)",
  321. "$(InputFileName)": "%(Filename)%(Extension)",
  322. "$(InputName)": "%(Filename)",
  323. "$(InputPath)": "%(Identity)",
  324. "$(ParentName)": "$(ProjectFileName)",
  325. "$(PlatformName)": "$(Platform)",
  326. "$(SafeInputName)": "%(Filename)",
  327. }
  328. for old, new in replace_map.items():
  329. s = s.replace(old, new)
  330. s = FixVCMacroSlashes(s)
  331. return s
  332. def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
  333. """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
  334. Args:
  335. msvs_settings: A dictionary. The key is the tool name. The values are
  336. themselves dictionaries of settings and their values.
  337. stderr: The stream receiving the error messages.
  338. Returns:
  339. A dictionary of MSBuild settings. The key is either the MSBuild tool name
  340. or the empty string (for the global settings). The values are themselves
  341. dictionaries of settings and their values.
  342. """
  343. msbuild_settings = {}
  344. for msvs_tool_name, msvs_tool_settings in msvs_settings.items():
  345. if msvs_tool_name in _msvs_to_msbuild_converters:
  346. msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
  347. for msvs_setting, msvs_value in msvs_tool_settings.items():
  348. if msvs_setting in msvs_tool:
  349. # Invoke the translation function.
  350. try:
  351. msvs_tool[msvs_setting](msvs_value, msbuild_settings)
  352. except ValueError as e:
  353. print(
  354. "Warning: while converting %s/%s to MSBuild, "
  355. "%s" % (msvs_tool_name, msvs_setting, e),
  356. file=stderr,
  357. )
  358. else:
  359. _ValidateExclusionSetting(
  360. msvs_setting,
  361. msvs_tool,
  362. (
  363. "Warning: unrecognized setting %s/%s "
  364. "while converting to MSBuild."
  365. % (msvs_tool_name, msvs_setting)
  366. ),
  367. stderr,
  368. )
  369. else:
  370. print(
  371. "Warning: unrecognized tool %s while converting to "
  372. "MSBuild." % msvs_tool_name,
  373. file=stderr,
  374. )
  375. return msbuild_settings
  376. def ValidateMSVSSettings(settings, stderr=sys.stderr):
  377. """Validates that the names of the settings are valid for MSVS.
  378. Args:
  379. settings: A dictionary. The key is the tool name. The values are
  380. themselves dictionaries of settings and their values.
  381. stderr: The stream receiving the error messages.
  382. """
  383. _ValidateSettings(_msvs_validators, settings, stderr)
  384. def ValidateMSBuildSettings(settings, stderr=sys.stderr):
  385. """Validates that the names of the settings are valid for MSBuild.
  386. Args:
  387. settings: A dictionary. The key is the tool name. The values are
  388. themselves dictionaries of settings and their values.
  389. stderr: The stream receiving the error messages.
  390. """
  391. _ValidateSettings(_msbuild_validators, settings, stderr)
  392. def _ValidateSettings(validators, settings, stderr):
  393. """Validates that the settings are valid for MSBuild or MSVS.
  394. We currently only validate the names of the settings, not their values.
  395. Args:
  396. validators: A dictionary of tools and their validators.
  397. settings: A dictionary. The key is the tool name. The values are
  398. themselves dictionaries of settings and their values.
  399. stderr: The stream receiving the error messages.
  400. """
  401. for tool_name in settings:
  402. if tool_name in validators:
  403. tool_validators = validators[tool_name]
  404. for setting, value in settings[tool_name].items():
  405. if setting in tool_validators:
  406. try:
  407. tool_validators[setting](value)
  408. except ValueError as e:
  409. print(
  410. f"Warning: for {tool_name}/{setting}, {e}",
  411. file=stderr,
  412. )
  413. else:
  414. _ValidateExclusionSetting(
  415. setting,
  416. tool_validators,
  417. (f"Warning: unrecognized setting {tool_name}/{setting}"),
  418. stderr,
  419. )
  420. else:
  421. print("Warning: unrecognized tool %s" % (tool_name), file=stderr)
  422. # MSVS and MBuild names of the tools.
  423. _compile = _Tool("VCCLCompilerTool", "ClCompile")
  424. _link = _Tool("VCLinkerTool", "Link")
  425. _midl = _Tool("VCMIDLTool", "Midl")
  426. _rc = _Tool("VCResourceCompilerTool", "ResourceCompile")
  427. _lib = _Tool("VCLibrarianTool", "Lib")
  428. _manifest = _Tool("VCManifestTool", "Manifest")
  429. _masm = _Tool("MASM", "MASM")
  430. _armasm = _Tool("ARMASM", "ARMASM")
  431. _AddTool(_compile)
  432. _AddTool(_link)
  433. _AddTool(_midl)
  434. _AddTool(_rc)
  435. _AddTool(_lib)
  436. _AddTool(_manifest)
  437. _AddTool(_masm)
  438. _AddTool(_armasm)
  439. # Add sections only found in the MSBuild settings.
  440. _msbuild_validators[""] = {}
  441. _msbuild_validators["ProjectReference"] = {}
  442. _msbuild_validators["ManifestResourceCompile"] = {}
  443. # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
  444. # ClCompile in MSBuild.
  445. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
  446. # the schema of the MSBuild ClCompile settings.
  447. # Options that have the same name in MSVS and MSBuild
  448. _Same(_compile, "AdditionalIncludeDirectories", _folder_list) # /I
  449. _Same(_compile, "AdditionalOptions", _string_list)
  450. _Same(_compile, "AdditionalUsingDirectories", _folder_list) # /AI
  451. _Same(_compile, "AssemblerListingLocation", _file_name) # /Fa
  452. _Same(_compile, "BrowseInformationFile", _file_name)
  453. _Same(_compile, "BufferSecurityCheck", _boolean) # /GS
  454. _Same(_compile, "DisableLanguageExtensions", _boolean) # /Za
  455. _Same(_compile, "DisableSpecificWarnings", _string_list) # /wd
  456. _Same(_compile, "EnableFiberSafeOptimizations", _boolean) # /GT
  457. _Same(_compile, "EnablePREfast", _boolean) # /analyze Visible='false'
  458. _Same(_compile, "ExpandAttributedSource", _boolean) # /Fx
  459. _Same(_compile, "FloatingPointExceptions", _boolean) # /fp:except
  460. _Same(_compile, "ForceConformanceInForLoopScope", _boolean) # /Zc:forScope
  461. _Same(_compile, "ForcedIncludeFiles", _file_list) # /FI
  462. _Same(_compile, "ForcedUsingFiles", _file_list) # /FU
  463. _Same(_compile, "GenerateXMLDocumentationFiles", _boolean) # /doc
  464. _Same(_compile, "IgnoreStandardIncludePath", _boolean) # /X
  465. _Same(_compile, "MinimalRebuild", _boolean) # /Gm
  466. _Same(_compile, "OmitDefaultLibName", _boolean) # /Zl
  467. _Same(_compile, "OmitFramePointers", _boolean) # /Oy
  468. _Same(_compile, "PreprocessorDefinitions", _string_list) # /D
  469. _Same(_compile, "ProgramDataBaseFileName", _file_name) # /Fd
  470. _Same(_compile, "RuntimeTypeInfo", _boolean) # /GR
  471. _Same(_compile, "ShowIncludes", _boolean) # /showIncludes
  472. _Same(_compile, "SmallerTypeCheck", _boolean) # /RTCc
  473. _Same(_compile, "StringPooling", _boolean) # /GF
  474. _Same(_compile, "SuppressStartupBanner", _boolean) # /nologo
  475. _Same(_compile, "TreatWChar_tAsBuiltInType", _boolean) # /Zc:wchar_t
  476. _Same(_compile, "UndefineAllPreprocessorDefinitions", _boolean) # /u
  477. _Same(_compile, "UndefinePreprocessorDefinitions", _string_list) # /U
  478. _Same(_compile, "UseFullPaths", _boolean) # /FC
  479. _Same(_compile, "WholeProgramOptimization", _boolean) # /GL
  480. _Same(_compile, "XMLDocumentationFileName", _file_name)
  481. _Same(_compile, "CompileAsWinRT", _boolean) # /ZW
  482. _Same(
  483. _compile,
  484. "AssemblerOutput",
  485. _Enumeration(
  486. [
  487. "NoListing",
  488. "AssemblyCode", # /FA
  489. "All", # /FAcs
  490. "AssemblyAndMachineCode", # /FAc
  491. "AssemblyAndSourceCode",
  492. ]
  493. ),
  494. ) # /FAs
  495. _Same(
  496. _compile,
  497. "BasicRuntimeChecks",
  498. _Enumeration(
  499. [
  500. "Default",
  501. "StackFrameRuntimeCheck", # /RTCs
  502. "UninitializedLocalUsageCheck", # /RTCu
  503. "EnableFastChecks",
  504. ]
  505. ),
  506. ) # /RTC1
  507. _Same(
  508. _compile, "BrowseInformation", _Enumeration(["false", "true", "true"]) # /FR
  509. ) # /Fr
  510. _Same(
  511. _compile,
  512. "CallingConvention",
  513. _Enumeration(["Cdecl", "FastCall", "StdCall", "VectorCall"]), # /Gd # /Gr # /Gz
  514. ) # /Gv
  515. _Same(
  516. _compile,
  517. "CompileAs",
  518. _Enumeration(["Default", "CompileAsC", "CompileAsCpp"]), # /TC
  519. ) # /TP
  520. _Same(
  521. _compile,
  522. "DebugInformationFormat",
  523. _Enumeration(
  524. [
  525. "", # Disabled
  526. "OldStyle", # /Z7
  527. None,
  528. "ProgramDatabase", # /Zi
  529. "EditAndContinue",
  530. ]
  531. ),
  532. ) # /ZI
  533. _Same(
  534. _compile,
  535. "EnableEnhancedInstructionSet",
  536. _Enumeration(
  537. [
  538. "NotSet",
  539. "StreamingSIMDExtensions", # /arch:SSE
  540. "StreamingSIMDExtensions2", # /arch:SSE2
  541. "AdvancedVectorExtensions", # /arch:AVX (vs2012+)
  542. "NoExtensions", # /arch:IA32 (vs2012+)
  543. # This one only exists in the new msbuild format.
  544. "AdvancedVectorExtensions2", # /arch:AVX2 (vs2013r2+)
  545. ]
  546. ),
  547. )
  548. _Same(
  549. _compile,
  550. "ErrorReporting",
  551. _Enumeration(
  552. [
  553. "None", # /errorReport:none
  554. "Prompt", # /errorReport:prompt
  555. "Queue",
  556. ], # /errorReport:queue
  557. new=["Send"],
  558. ),
  559. ) # /errorReport:send"
  560. _Same(
  561. _compile,
  562. "ExceptionHandling",
  563. _Enumeration(["false", "Sync", "Async"], new=["SyncCThrow"]), # /EHsc # /EHa
  564. ) # /EHs
  565. _Same(
  566. _compile, "FavorSizeOrSpeed", _Enumeration(["Neither", "Speed", "Size"]) # /Ot
  567. ) # /Os
  568. _Same(
  569. _compile,
  570. "FloatingPointModel",
  571. _Enumeration(["Precise", "Strict", "Fast"]), # /fp:precise # /fp:strict
  572. ) # /fp:fast
  573. _Same(
  574. _compile,
  575. "InlineFunctionExpansion",
  576. _Enumeration(
  577. ["Default", "OnlyExplicitInline", "AnySuitable"], # /Ob1 # /Ob2
  578. new=["Disabled"],
  579. ),
  580. ) # /Ob0
  581. _Same(
  582. _compile,
  583. "Optimization",
  584. _Enumeration(["Disabled", "MinSpace", "MaxSpeed", "Full"]), # /Od # /O1 # /O2
  585. ) # /Ox
  586. _Same(
  587. _compile,
  588. "RuntimeLibrary",
  589. _Enumeration(
  590. [
  591. "MultiThreaded", # /MT
  592. "MultiThreadedDebug", # /MTd
  593. "MultiThreadedDLL", # /MD
  594. "MultiThreadedDebugDLL",
  595. ]
  596. ),
  597. ) # /MDd
  598. _Same(
  599. _compile,
  600. "StructMemberAlignment",
  601. _Enumeration(
  602. [
  603. "Default",
  604. "1Byte", # /Zp1
  605. "2Bytes", # /Zp2
  606. "4Bytes", # /Zp4
  607. "8Bytes", # /Zp8
  608. "16Bytes",
  609. ]
  610. ),
  611. ) # /Zp16
  612. _Same(
  613. _compile,
  614. "WarningLevel",
  615. _Enumeration(
  616. [
  617. "TurnOffAllWarnings", # /W0
  618. "Level1", # /W1
  619. "Level2", # /W2
  620. "Level3", # /W3
  621. "Level4",
  622. ], # /W4
  623. new=["EnableAllWarnings"],
  624. ),
  625. ) # /Wall
  626. # Options found in MSVS that have been renamed in MSBuild.
  627. _Renamed(
  628. _compile, "EnableFunctionLevelLinking", "FunctionLevelLinking", _boolean
  629. ) # /Gy
  630. _Renamed(_compile, "EnableIntrinsicFunctions", "IntrinsicFunctions", _boolean) # /Oi
  631. _Renamed(_compile, "KeepComments", "PreprocessKeepComments", _boolean) # /C
  632. _Renamed(_compile, "ObjectFile", "ObjectFileName", _file_name) # /Fo
  633. _Renamed(_compile, "OpenMP", "OpenMPSupport", _boolean) # /openmp
  634. _Renamed(
  635. _compile, "PrecompiledHeaderThrough", "PrecompiledHeaderFile", _file_name
  636. ) # Used with /Yc and /Yu
  637. _Renamed(
  638. _compile, "PrecompiledHeaderFile", "PrecompiledHeaderOutputFile", _file_name
  639. ) # /Fp
  640. _Renamed(
  641. _compile,
  642. "UsePrecompiledHeader",
  643. "PrecompiledHeader",
  644. _Enumeration(
  645. ["NotUsing", "Create", "Use"] # VS recognized '' for this value too. # /Yc
  646. ),
  647. ) # /Yu
  648. _Renamed(_compile, "WarnAsError", "TreatWarningAsError", _boolean) # /WX
  649. _ConvertedToAdditionalOption(_compile, "DefaultCharIsUnsigned", "/J")
  650. # MSVS options not found in MSBuild.
  651. _MSVSOnly(_compile, "Detect64BitPortabilityProblems", _boolean)
  652. _MSVSOnly(_compile, "UseUnicodeResponseFiles", _boolean)
  653. # MSBuild options not found in MSVS.
  654. _MSBuildOnly(_compile, "BuildingInIDE", _boolean)
  655. _MSBuildOnly(
  656. _compile, "CompileAsManaged", _Enumeration([], new=["false", "true"])
  657. ) # /clr
  658. _MSBuildOnly(_compile, "CreateHotpatchableImage", _boolean) # /hotpatch
  659. _MSBuildOnly(_compile, "LanguageStandard", _string)
  660. _MSBuildOnly(_compile, "LanguageStandard_C", _string)
  661. _MSBuildOnly(_compile, "MultiProcessorCompilation", _boolean) # /MP
  662. _MSBuildOnly(_compile, "PreprocessOutputPath", _string) # /Fi
  663. _MSBuildOnly(_compile, "ProcessorNumber", _integer) # the number of processors
  664. _MSBuildOnly(_compile, "TrackerLogDirectory", _folder_name)
  665. _MSBuildOnly(_compile, "TreatSpecificWarningsAsErrors", _string_list) # /we
  666. _MSBuildOnly(_compile, "UseUnicodeForAssemblerListing", _boolean) # /FAu
  667. # Defines a setting that needs very customized processing
  668. _CustomGeneratePreprocessedFile(_compile, "GeneratePreprocessedFile")
  669. # Directives for converting MSVS VCLinkerTool to MSBuild Link.
  670. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
  671. # the schema of the MSBuild Link settings.
  672. # Options that have the same name in MSVS and MSBuild
  673. _Same(_link, "AdditionalDependencies", _file_list)
  674. _Same(_link, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
  675. # /MANIFESTDEPENDENCY:
  676. _Same(_link, "AdditionalManifestDependencies", _file_list)
  677. _Same(_link, "AdditionalOptions", _string_list)
  678. _Same(_link, "AddModuleNamesToAssembly", _file_list) # /ASSEMBLYMODULE
  679. _Same(_link, "AllowIsolation", _boolean) # /ALLOWISOLATION
  680. _Same(_link, "AssemblyLinkResource", _file_list) # /ASSEMBLYLINKRESOURCE
  681. _Same(_link, "BaseAddress", _string) # /BASE
  682. _Same(_link, "CLRUnmanagedCodeCheck", _boolean) # /CLRUNMANAGEDCODECHECK
  683. _Same(_link, "DelayLoadDLLs", _file_list) # /DELAYLOAD
  684. _Same(_link, "DelaySign", _boolean) # /DELAYSIGN
  685. _Same(_link, "EmbedManagedResourceFile", _file_list) # /ASSEMBLYRESOURCE
  686. _Same(_link, "EnableUAC", _boolean) # /MANIFESTUAC
  687. _Same(_link, "EntryPointSymbol", _string) # /ENTRY
  688. _Same(_link, "ForceSymbolReferences", _file_list) # /INCLUDE
  689. _Same(_link, "FunctionOrder", _file_name) # /ORDER
  690. _Same(_link, "GenerateDebugInformation", _boolean) # /DEBUG
  691. _Same(_link, "GenerateMapFile", _boolean) # /MAP
  692. _Same(_link, "HeapCommitSize", _string)
  693. _Same(_link, "HeapReserveSize", _string) # /HEAP
  694. _Same(_link, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
  695. _Same(_link, "IgnoreEmbeddedIDL", _boolean) # /IGNOREIDL
  696. _Same(_link, "ImportLibrary", _file_name) # /IMPLIB
  697. _Same(_link, "KeyContainer", _file_name) # /KEYCONTAINER
  698. _Same(_link, "KeyFile", _file_name) # /KEYFILE
  699. _Same(_link, "ManifestFile", _file_name) # /ManifestFile
  700. _Same(_link, "MapExports", _boolean) # /MAPINFO:EXPORTS
  701. _Same(_link, "MapFileName", _file_name)
  702. _Same(_link, "MergedIDLBaseFileName", _file_name) # /IDLOUT
  703. _Same(_link, "MergeSections", _string) # /MERGE
  704. _Same(_link, "MidlCommandFile", _file_name) # /MIDL
  705. _Same(_link, "ModuleDefinitionFile", _file_name) # /DEF
  706. _Same(_link, "OutputFile", _file_name) # /OUT
  707. _Same(_link, "PerUserRedirection", _boolean)
  708. _Same(_link, "Profile", _boolean) # /PROFILE
  709. _Same(_link, "ProfileGuidedDatabase", _file_name) # /PGD
  710. _Same(_link, "ProgramDatabaseFile", _file_name) # /PDB
  711. _Same(_link, "RegisterOutput", _boolean)
  712. _Same(_link, "SetChecksum", _boolean) # /RELEASE
  713. _Same(_link, "StackCommitSize", _string)
  714. _Same(_link, "StackReserveSize", _string) # /STACK
  715. _Same(_link, "StripPrivateSymbols", _file_name) # /PDBSTRIPPED
  716. _Same(_link, "SupportUnloadOfDelayLoadedDLL", _boolean) # /DELAY:UNLOAD
  717. _Same(_link, "SuppressStartupBanner", _boolean) # /NOLOGO
  718. _Same(_link, "SwapRunFromCD", _boolean) # /SWAPRUN:CD
  719. _Same(_link, "TurnOffAssemblyGeneration", _boolean) # /NOASSEMBLY
  720. _Same(_link, "TypeLibraryFile", _file_name) # /TLBOUT
  721. _Same(_link, "TypeLibraryResourceID", _integer) # /TLBID
  722. _Same(_link, "UACUIAccess", _boolean) # /uiAccess='true'
  723. _Same(_link, "Version", _string) # /VERSION
  724. _Same(_link, "EnableCOMDATFolding", _newly_boolean) # /OPT:ICF
  725. _Same(_link, "FixedBaseAddress", _newly_boolean) # /FIXED
  726. _Same(_link, "LargeAddressAware", _newly_boolean) # /LARGEADDRESSAWARE
  727. _Same(_link, "OptimizeReferences", _newly_boolean) # /OPT:REF
  728. _Same(_link, "RandomizedBaseAddress", _newly_boolean) # /DYNAMICBASE
  729. _Same(_link, "TerminalServerAware", _newly_boolean) # /TSAWARE
  730. _subsystem_enumeration = _Enumeration(
  731. [
  732. "NotSet",
  733. "Console", # /SUBSYSTEM:CONSOLE
  734. "Windows", # /SUBSYSTEM:WINDOWS
  735. "Native", # /SUBSYSTEM:NATIVE
  736. "EFI Application", # /SUBSYSTEM:EFI_APPLICATION
  737. "EFI Boot Service Driver", # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
  738. "EFI ROM", # /SUBSYSTEM:EFI_ROM
  739. "EFI Runtime", # /SUBSYSTEM:EFI_RUNTIME_DRIVER
  740. "WindowsCE",
  741. ], # /SUBSYSTEM:WINDOWSCE
  742. new=["POSIX"],
  743. ) # /SUBSYSTEM:POSIX
  744. _target_machine_enumeration = _Enumeration(
  745. [
  746. "NotSet",
  747. "MachineX86", # /MACHINE:X86
  748. None,
  749. "MachineARM", # /MACHINE:ARM
  750. "MachineEBC", # /MACHINE:EBC
  751. "MachineIA64", # /MACHINE:IA64
  752. None,
  753. "MachineMIPS", # /MACHINE:MIPS
  754. "MachineMIPS16", # /MACHINE:MIPS16
  755. "MachineMIPSFPU", # /MACHINE:MIPSFPU
  756. "MachineMIPSFPU16", # /MACHINE:MIPSFPU16
  757. None,
  758. None,
  759. None,
  760. "MachineSH4", # /MACHINE:SH4
  761. None,
  762. "MachineTHUMB", # /MACHINE:THUMB
  763. "MachineX64",
  764. ]
  765. ) # /MACHINE:X64
  766. _Same(
  767. _link, "AssemblyDebug", _Enumeration(["", "true", "false"]) # /ASSEMBLYDEBUG
  768. ) # /ASSEMBLYDEBUG:DISABLE
  769. _Same(
  770. _link,
  771. "CLRImageType",
  772. _Enumeration(
  773. [
  774. "Default",
  775. "ForceIJWImage", # /CLRIMAGETYPE:IJW
  776. "ForcePureILImage", # /Switch="CLRIMAGETYPE:PURE
  777. "ForceSafeILImage",
  778. ]
  779. ),
  780. ) # /Switch="CLRIMAGETYPE:SAFE
  781. _Same(
  782. _link,
  783. "CLRThreadAttribute",
  784. _Enumeration(
  785. [
  786. "DefaultThreadingAttribute", # /CLRTHREADATTRIBUTE:NONE
  787. "MTAThreadingAttribute", # /CLRTHREADATTRIBUTE:MTA
  788. "STAThreadingAttribute",
  789. ]
  790. ),
  791. ) # /CLRTHREADATTRIBUTE:STA
  792. _Same(
  793. _link,
  794. "DataExecutionPrevention",
  795. _Enumeration(["", "false", "true"]), # /NXCOMPAT:NO
  796. ) # /NXCOMPAT
  797. _Same(
  798. _link,
  799. "Driver",
  800. _Enumeration(["NotSet", "Driver", "UpOnly", "WDM"]), # /Driver # /DRIVER:UPONLY
  801. ) # /DRIVER:WDM
  802. _Same(
  803. _link,
  804. "LinkTimeCodeGeneration",
  805. _Enumeration(
  806. [
  807. "Default",
  808. "UseLinkTimeCodeGeneration", # /LTCG
  809. "PGInstrument", # /LTCG:PGInstrument
  810. "PGOptimization", # /LTCG:PGOptimize
  811. "PGUpdate",
  812. ]
  813. ),
  814. ) # /LTCG:PGUpdate
  815. _Same(
  816. _link,
  817. "ShowProgress",
  818. _Enumeration(
  819. ["NotSet", "LinkVerbose", "LinkVerboseLib"], # /VERBOSE # /VERBOSE:Lib
  820. new=[
  821. "LinkVerboseICF", # /VERBOSE:ICF
  822. "LinkVerboseREF", # /VERBOSE:REF
  823. "LinkVerboseSAFESEH", # /VERBOSE:SAFESEH
  824. "LinkVerboseCLR",
  825. ],
  826. ),
  827. ) # /VERBOSE:CLR
  828. _Same(_link, "SubSystem", _subsystem_enumeration)
  829. _Same(_link, "TargetMachine", _target_machine_enumeration)
  830. _Same(
  831. _link,
  832. "UACExecutionLevel",
  833. _Enumeration(
  834. [
  835. "AsInvoker", # /level='asInvoker'
  836. "HighestAvailable", # /level='highestAvailable'
  837. "RequireAdministrator",
  838. ]
  839. ),
  840. ) # /level='requireAdministrator'
  841. _Same(_link, "MinimumRequiredVersion", _string)
  842. _Same(_link, "TreatLinkerWarningAsErrors", _boolean) # /WX
  843. # Options found in MSVS that have been renamed in MSBuild.
  844. _Renamed(
  845. _link,
  846. "ErrorReporting",
  847. "LinkErrorReporting",
  848. _Enumeration(
  849. [
  850. "NoErrorReport", # /ERRORREPORT:NONE
  851. "PromptImmediately", # /ERRORREPORT:PROMPT
  852. "QueueForNextLogin",
  853. ], # /ERRORREPORT:QUEUE
  854. new=["SendErrorReport"],
  855. ),
  856. ) # /ERRORREPORT:SEND
  857. _Renamed(
  858. _link, "IgnoreDefaultLibraryNames", "IgnoreSpecificDefaultLibraries", _file_list
  859. ) # /NODEFAULTLIB
  860. _Renamed(_link, "ResourceOnlyDLL", "NoEntryPoint", _boolean) # /NOENTRY
  861. _Renamed(_link, "SwapRunFromNet", "SwapRunFromNET", _boolean) # /SWAPRUN:NET
  862. _Moved(_link, "GenerateManifest", "", _boolean)
  863. _Moved(_link, "IgnoreImportLibrary", "", _boolean)
  864. _Moved(_link, "LinkIncremental", "", _newly_boolean)
  865. _Moved(_link, "LinkLibraryDependencies", "ProjectReference", _boolean)
  866. _Moved(_link, "UseLibraryDependencyInputs", "ProjectReference", _boolean)
  867. # MSVS options not found in MSBuild.
  868. _MSVSOnly(_link, "OptimizeForWindows98", _newly_boolean)
  869. _MSVSOnly(_link, "UseUnicodeResponseFiles", _boolean)
  870. # MSBuild options not found in MSVS.
  871. _MSBuildOnly(_link, "BuildingInIDE", _boolean)
  872. _MSBuildOnly(_link, "ImageHasSafeExceptionHandlers", _boolean) # /SAFESEH
  873. _MSBuildOnly(_link, "LinkDLL", _boolean) # /DLL Visible='false'
  874. _MSBuildOnly(_link, "LinkStatus", _boolean) # /LTCG:STATUS
  875. _MSBuildOnly(_link, "PreventDllBinding", _boolean) # /ALLOWBIND
  876. _MSBuildOnly(_link, "SupportNobindOfDelayLoadedDLL", _boolean) # /DELAY:NOBIND
  877. _MSBuildOnly(_link, "TrackerLogDirectory", _folder_name)
  878. _MSBuildOnly(_link, "MSDOSStubFileName", _file_name) # /STUB Visible='false'
  879. _MSBuildOnly(_link, "SectionAlignment", _integer) # /ALIGN
  880. _MSBuildOnly(_link, "SpecifySectionAttributes", _string) # /SECTION
  881. _MSBuildOnly(
  882. _link,
  883. "ForceFileOutput",
  884. _Enumeration(
  885. [],
  886. new=[
  887. "Enabled", # /FORCE
  888. # /FORCE:MULTIPLE
  889. "MultiplyDefinedSymbolOnly",
  890. "UndefinedSymbolOnly",
  891. ],
  892. ),
  893. ) # /FORCE:UNRESOLVED
  894. _MSBuildOnly(
  895. _link,
  896. "CreateHotPatchableImage",
  897. _Enumeration(
  898. [],
  899. new=[
  900. "Enabled", # /FUNCTIONPADMIN
  901. "X86Image", # /FUNCTIONPADMIN:5
  902. "X64Image", # /FUNCTIONPADMIN:6
  903. "ItaniumImage",
  904. ],
  905. ),
  906. ) # /FUNCTIONPADMIN:16
  907. _MSBuildOnly(
  908. _link,
  909. "CLRSupportLastError",
  910. _Enumeration(
  911. [],
  912. new=[
  913. "Enabled", # /CLRSupportLastError
  914. "Disabled", # /CLRSupportLastError:NO
  915. # /CLRSupportLastError:SYSTEMDLL
  916. "SystemDlls",
  917. ],
  918. ),
  919. )
  920. # Directives for converting VCResourceCompilerTool to ResourceCompile.
  921. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
  922. # the schema of the MSBuild ResourceCompile settings.
  923. _Same(_rc, "AdditionalOptions", _string_list)
  924. _Same(_rc, "AdditionalIncludeDirectories", _folder_list) # /I
  925. _Same(_rc, "Culture", _Integer(msbuild_base=16))
  926. _Same(_rc, "IgnoreStandardIncludePath", _boolean) # /X
  927. _Same(_rc, "PreprocessorDefinitions", _string_list) # /D
  928. _Same(_rc, "ResourceOutputFileName", _string) # /fo
  929. _Same(_rc, "ShowProgress", _boolean) # /v
  930. # There is no UI in VisualStudio 2008 to set the following properties.
  931. # However they are found in CL and other tools. Include them here for
  932. # completeness, as they are very likely to have the same usage pattern.
  933. _Same(_rc, "SuppressStartupBanner", _boolean) # /nologo
  934. _Same(_rc, "UndefinePreprocessorDefinitions", _string_list) # /u
  935. # MSBuild options not found in MSVS.
  936. _MSBuildOnly(_rc, "NullTerminateStrings", _boolean) # /n
  937. _MSBuildOnly(_rc, "TrackerLogDirectory", _folder_name)
  938. # Directives for converting VCMIDLTool to Midl.
  939. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
  940. # the schema of the MSBuild Midl settings.
  941. _Same(_midl, "AdditionalIncludeDirectories", _folder_list) # /I
  942. _Same(_midl, "AdditionalOptions", _string_list)
  943. _Same(_midl, "CPreprocessOptions", _string) # /cpp_opt
  944. _Same(_midl, "ErrorCheckAllocations", _boolean) # /error allocation
  945. _Same(_midl, "ErrorCheckBounds", _boolean) # /error bounds_check
  946. _Same(_midl, "ErrorCheckEnumRange", _boolean) # /error enum
  947. _Same(_midl, "ErrorCheckRefPointers", _boolean) # /error ref
  948. _Same(_midl, "ErrorCheckStubData", _boolean) # /error stub_data
  949. _Same(_midl, "GenerateStublessProxies", _boolean) # /Oicf
  950. _Same(_midl, "GenerateTypeLibrary", _boolean)
  951. _Same(_midl, "HeaderFileName", _file_name) # /h
  952. _Same(_midl, "IgnoreStandardIncludePath", _boolean) # /no_def_idir
  953. _Same(_midl, "InterfaceIdentifierFileName", _file_name) # /iid
  954. _Same(_midl, "MkTypLibCompatible", _boolean) # /mktyplib203
  955. _Same(_midl, "OutputDirectory", _string) # /out
  956. _Same(_midl, "PreprocessorDefinitions", _string_list) # /D
  957. _Same(_midl, "ProxyFileName", _file_name) # /proxy
  958. _Same(_midl, "RedirectOutputAndErrors", _file_name) # /o
  959. _Same(_midl, "SuppressStartupBanner", _boolean) # /nologo
  960. _Same(_midl, "TypeLibraryName", _file_name) # /tlb
  961. _Same(_midl, "UndefinePreprocessorDefinitions", _string_list) # /U
  962. _Same(_midl, "WarnAsError", _boolean) # /WX
  963. _Same(
  964. _midl,
  965. "DefaultCharType",
  966. _Enumeration(["Unsigned", "Signed", "Ascii"]), # /char unsigned # /char signed
  967. ) # /char ascii7
  968. _Same(
  969. _midl,
  970. "TargetEnvironment",
  971. _Enumeration(
  972. [
  973. "NotSet",
  974. "Win32", # /env win32
  975. "Itanium", # /env ia64
  976. "X64", # /env x64
  977. "ARM64", # /env arm64
  978. ]
  979. ),
  980. )
  981. _Same(
  982. _midl,
  983. "EnableErrorChecks",
  984. _Enumeration(["EnableCustom", "None", "All"]), # /error none
  985. ) # /error all
  986. _Same(
  987. _midl,
  988. "StructMemberAlignment",
  989. _Enumeration(["NotSet", "1", "2", "4", "8"]), # Zp1 # Zp2 # Zp4
  990. ) # Zp8
  991. _Same(
  992. _midl,
  993. "WarningLevel",
  994. _Enumeration(["0", "1", "2", "3", "4"]), # /W0 # /W1 # /W2 # /W3
  995. ) # /W4
  996. _Renamed(_midl, "DLLDataFileName", "DllDataFileName", _file_name) # /dlldata
  997. _Renamed(_midl, "ValidateParameters", "ValidateAllParameters", _boolean) # /robust
  998. # MSBuild options not found in MSVS.
  999. _MSBuildOnly(_midl, "ApplicationConfigurationMode", _boolean) # /app_config
  1000. _MSBuildOnly(_midl, "ClientStubFile", _file_name) # /cstub
  1001. _MSBuildOnly(
  1002. _midl, "GenerateClientFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
  1003. ) # /client none
  1004. _MSBuildOnly(
  1005. _midl, "GenerateServerFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
  1006. ) # /client none
  1007. _MSBuildOnly(_midl, "LocaleID", _integer) # /lcid DECIMAL
  1008. _MSBuildOnly(_midl, "ServerStubFile", _file_name) # /sstub
  1009. _MSBuildOnly(_midl, "SuppressCompilerWarnings", _boolean) # /no_warn
  1010. _MSBuildOnly(_midl, "TrackerLogDirectory", _folder_name)
  1011. _MSBuildOnly(
  1012. _midl, "TypeLibFormat", _Enumeration([], new=["NewFormat", "OldFormat"]) # /newtlb
  1013. ) # /oldtlb
  1014. # Directives for converting VCLibrarianTool to Lib.
  1015. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
  1016. # the schema of the MSBuild Lib settings.
  1017. _Same(_lib, "AdditionalDependencies", _file_list)
  1018. _Same(_lib, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
  1019. _Same(_lib, "AdditionalOptions", _string_list)
  1020. _Same(_lib, "ExportNamedFunctions", _string_list) # /EXPORT
  1021. _Same(_lib, "ForceSymbolReferences", _string) # /INCLUDE
  1022. _Same(_lib, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
  1023. _Same(_lib, "IgnoreSpecificDefaultLibraries", _file_list) # /NODEFAULTLIB
  1024. _Same(_lib, "ModuleDefinitionFile", _file_name) # /DEF
  1025. _Same(_lib, "OutputFile", _file_name) # /OUT
  1026. _Same(_lib, "SuppressStartupBanner", _boolean) # /NOLOGO
  1027. _Same(_lib, "UseUnicodeResponseFiles", _boolean)
  1028. _Same(_lib, "LinkTimeCodeGeneration", _boolean) # /LTCG
  1029. _Same(_lib, "TargetMachine", _target_machine_enumeration)
  1030. # TODO(jeanluc) _link defines the same value that gets moved to
  1031. # ProjectReference. We may want to validate that they are consistent.
  1032. _Moved(_lib, "LinkLibraryDependencies", "ProjectReference", _boolean)
  1033. _MSBuildOnly(_lib, "DisplayLibrary", _string) # /LIST Visible='false'
  1034. _MSBuildOnly(
  1035. _lib,
  1036. "ErrorReporting",
  1037. _Enumeration(
  1038. [],
  1039. new=[
  1040. "PromptImmediately", # /ERRORREPORT:PROMPT
  1041. "QueueForNextLogin", # /ERRORREPORT:QUEUE
  1042. "SendErrorReport", # /ERRORREPORT:SEND
  1043. "NoErrorReport",
  1044. ],
  1045. ),
  1046. ) # /ERRORREPORT:NONE
  1047. _MSBuildOnly(_lib, "MinimumRequiredVersion", _string)
  1048. _MSBuildOnly(_lib, "Name", _file_name) # /NAME
  1049. _MSBuildOnly(_lib, "RemoveObjects", _file_list) # /REMOVE
  1050. _MSBuildOnly(_lib, "SubSystem", _subsystem_enumeration)
  1051. _MSBuildOnly(_lib, "TrackerLogDirectory", _folder_name)
  1052. _MSBuildOnly(_lib, "TreatLibWarningAsErrors", _boolean) # /WX
  1053. _MSBuildOnly(_lib, "Verbose", _boolean)
  1054. # Directives for converting VCManifestTool to Mt.
  1055. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
  1056. # the schema of the MSBuild Lib settings.
  1057. # Options that have the same name in MSVS and MSBuild
  1058. _Same(_manifest, "AdditionalManifestFiles", _file_list) # /manifest
  1059. _Same(_manifest, "AdditionalOptions", _string_list)
  1060. _Same(_manifest, "AssemblyIdentity", _string) # /identity:
  1061. _Same(_manifest, "ComponentFileName", _file_name) # /dll
  1062. _Same(_manifest, "GenerateCatalogFiles", _boolean) # /makecdfs
  1063. _Same(_manifest, "InputResourceManifests", _string) # /inputresource
  1064. _Same(_manifest, "OutputManifestFile", _file_name) # /out
  1065. _Same(_manifest, "RegistrarScriptFile", _file_name) # /rgs
  1066. _Same(_manifest, "ReplacementsFile", _file_name) # /replacements
  1067. _Same(_manifest, "SuppressStartupBanner", _boolean) # /nologo
  1068. _Same(_manifest, "TypeLibraryFile", _file_name) # /tlb:
  1069. _Same(_manifest, "UpdateFileHashes", _boolean) # /hashupdate
  1070. _Same(_manifest, "UpdateFileHashesSearchPath", _file_name)
  1071. _Same(_manifest, "VerboseOutput", _boolean) # /verbose
  1072. # Options that have moved location.
  1073. _MovedAndRenamed(
  1074. _manifest,
  1075. "ManifestResourceFile",
  1076. "ManifestResourceCompile",
  1077. "ResourceOutputFileName",
  1078. _file_name,
  1079. )
  1080. _Moved(_manifest, "EmbedManifest", "", _boolean)
  1081. # MSVS options not found in MSBuild.
  1082. _MSVSOnly(_manifest, "DependencyInformationFile", _file_name)
  1083. _MSVSOnly(_manifest, "UseFAT32Workaround", _boolean)
  1084. _MSVSOnly(_manifest, "UseUnicodeResponseFiles", _boolean)
  1085. # MSBuild options not found in MSVS.
  1086. _MSBuildOnly(_manifest, "EnableDPIAwareness", _boolean)
  1087. _MSBuildOnly(_manifest, "GenerateCategoryTags", _boolean) # /category
  1088. _MSBuildOnly(
  1089. _manifest, "ManifestFromManagedAssembly", _file_name
  1090. ) # /managedassemblyname
  1091. _MSBuildOnly(_manifest, "OutputResourceManifests", _string) # /outputresource
  1092. _MSBuildOnly(_manifest, "SuppressDependencyElement", _boolean) # /nodependency
  1093. _MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name)
  1094. # Directives for MASM.
  1095. # See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the
  1096. # MSBuild MASM settings.
  1097. # Options that have the same name in MSVS and MSBuild.
  1098. _Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh