MSVSSettings.py 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  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 != "true" and value != "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, "MultiProcessorCompilation", _boolean) # /MP
  660. _MSBuildOnly(_compile, "PreprocessOutputPath", _string) # /Fi
  661. _MSBuildOnly(_compile, "ProcessorNumber", _integer) # the number of processors
  662. _MSBuildOnly(_compile, "TrackerLogDirectory", _folder_name)
  663. _MSBuildOnly(_compile, "TreatSpecificWarningsAsErrors", _string_list) # /we
  664. _MSBuildOnly(_compile, "UseUnicodeForAssemblerListing", _boolean) # /FAu
  665. # Defines a setting that needs very customized processing
  666. _CustomGeneratePreprocessedFile(_compile, "GeneratePreprocessedFile")
  667. # Directives for converting MSVS VCLinkerTool to MSBuild Link.
  668. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
  669. # the schema of the MSBuild Link settings.
  670. # Options that have the same name in MSVS and MSBuild
  671. _Same(_link, "AdditionalDependencies", _file_list)
  672. _Same(_link, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
  673. # /MANIFESTDEPENDENCY:
  674. _Same(_link, "AdditionalManifestDependencies", _file_list)
  675. _Same(_link, "AdditionalOptions", _string_list)
  676. _Same(_link, "AddModuleNamesToAssembly", _file_list) # /ASSEMBLYMODULE
  677. _Same(_link, "AllowIsolation", _boolean) # /ALLOWISOLATION
  678. _Same(_link, "AssemblyLinkResource", _file_list) # /ASSEMBLYLINKRESOURCE
  679. _Same(_link, "BaseAddress", _string) # /BASE
  680. _Same(_link, "CLRUnmanagedCodeCheck", _boolean) # /CLRUNMANAGEDCODECHECK
  681. _Same(_link, "DelayLoadDLLs", _file_list) # /DELAYLOAD
  682. _Same(_link, "DelaySign", _boolean) # /DELAYSIGN
  683. _Same(_link, "EmbedManagedResourceFile", _file_list) # /ASSEMBLYRESOURCE
  684. _Same(_link, "EnableUAC", _boolean) # /MANIFESTUAC
  685. _Same(_link, "EntryPointSymbol", _string) # /ENTRY
  686. _Same(_link, "ForceSymbolReferences", _file_list) # /INCLUDE
  687. _Same(_link, "FunctionOrder", _file_name) # /ORDER
  688. _Same(_link, "GenerateDebugInformation", _boolean) # /DEBUG
  689. _Same(_link, "GenerateMapFile", _boolean) # /MAP
  690. _Same(_link, "HeapCommitSize", _string)
  691. _Same(_link, "HeapReserveSize", _string) # /HEAP
  692. _Same(_link, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
  693. _Same(_link, "IgnoreEmbeddedIDL", _boolean) # /IGNOREIDL
  694. _Same(_link, "ImportLibrary", _file_name) # /IMPLIB
  695. _Same(_link, "KeyContainer", _file_name) # /KEYCONTAINER
  696. _Same(_link, "KeyFile", _file_name) # /KEYFILE
  697. _Same(_link, "ManifestFile", _file_name) # /ManifestFile
  698. _Same(_link, "MapExports", _boolean) # /MAPINFO:EXPORTS
  699. _Same(_link, "MapFileName", _file_name)
  700. _Same(_link, "MergedIDLBaseFileName", _file_name) # /IDLOUT
  701. _Same(_link, "MergeSections", _string) # /MERGE
  702. _Same(_link, "MidlCommandFile", _file_name) # /MIDL
  703. _Same(_link, "ModuleDefinitionFile", _file_name) # /DEF
  704. _Same(_link, "OutputFile", _file_name) # /OUT
  705. _Same(_link, "PerUserRedirection", _boolean)
  706. _Same(_link, "Profile", _boolean) # /PROFILE
  707. _Same(_link, "ProfileGuidedDatabase", _file_name) # /PGD
  708. _Same(_link, "ProgramDatabaseFile", _file_name) # /PDB
  709. _Same(_link, "RegisterOutput", _boolean)
  710. _Same(_link, "SetChecksum", _boolean) # /RELEASE
  711. _Same(_link, "StackCommitSize", _string)
  712. _Same(_link, "StackReserveSize", _string) # /STACK
  713. _Same(_link, "StripPrivateSymbols", _file_name) # /PDBSTRIPPED
  714. _Same(_link, "SupportUnloadOfDelayLoadedDLL", _boolean) # /DELAY:UNLOAD
  715. _Same(_link, "SuppressStartupBanner", _boolean) # /NOLOGO
  716. _Same(_link, "SwapRunFromCD", _boolean) # /SWAPRUN:CD
  717. _Same(_link, "TurnOffAssemblyGeneration", _boolean) # /NOASSEMBLY
  718. _Same(_link, "TypeLibraryFile", _file_name) # /TLBOUT
  719. _Same(_link, "TypeLibraryResourceID", _integer) # /TLBID
  720. _Same(_link, "UACUIAccess", _boolean) # /uiAccess='true'
  721. _Same(_link, "Version", _string) # /VERSION
  722. _Same(_link, "EnableCOMDATFolding", _newly_boolean) # /OPT:ICF
  723. _Same(_link, "FixedBaseAddress", _newly_boolean) # /FIXED
  724. _Same(_link, "LargeAddressAware", _newly_boolean) # /LARGEADDRESSAWARE
  725. _Same(_link, "OptimizeReferences", _newly_boolean) # /OPT:REF
  726. _Same(_link, "RandomizedBaseAddress", _newly_boolean) # /DYNAMICBASE
  727. _Same(_link, "TerminalServerAware", _newly_boolean) # /TSAWARE
  728. _subsystem_enumeration = _Enumeration(
  729. [
  730. "NotSet",
  731. "Console", # /SUBSYSTEM:CONSOLE
  732. "Windows", # /SUBSYSTEM:WINDOWS
  733. "Native", # /SUBSYSTEM:NATIVE
  734. "EFI Application", # /SUBSYSTEM:EFI_APPLICATION
  735. "EFI Boot Service Driver", # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
  736. "EFI ROM", # /SUBSYSTEM:EFI_ROM
  737. "EFI Runtime", # /SUBSYSTEM:EFI_RUNTIME_DRIVER
  738. "WindowsCE",
  739. ], # /SUBSYSTEM:WINDOWSCE
  740. new=["POSIX"],
  741. ) # /SUBSYSTEM:POSIX
  742. _target_machine_enumeration = _Enumeration(
  743. [
  744. "NotSet",
  745. "MachineX86", # /MACHINE:X86
  746. None,
  747. "MachineARM", # /MACHINE:ARM
  748. "MachineEBC", # /MACHINE:EBC
  749. "MachineIA64", # /MACHINE:IA64
  750. None,
  751. "MachineMIPS", # /MACHINE:MIPS
  752. "MachineMIPS16", # /MACHINE:MIPS16
  753. "MachineMIPSFPU", # /MACHINE:MIPSFPU
  754. "MachineMIPSFPU16", # /MACHINE:MIPSFPU16
  755. None,
  756. None,
  757. None,
  758. "MachineSH4", # /MACHINE:SH4
  759. None,
  760. "MachineTHUMB", # /MACHINE:THUMB
  761. "MachineX64",
  762. ]
  763. ) # /MACHINE:X64
  764. _Same(
  765. _link, "AssemblyDebug", _Enumeration(["", "true", "false"]) # /ASSEMBLYDEBUG
  766. ) # /ASSEMBLYDEBUG:DISABLE
  767. _Same(
  768. _link,
  769. "CLRImageType",
  770. _Enumeration(
  771. [
  772. "Default",
  773. "ForceIJWImage", # /CLRIMAGETYPE:IJW
  774. "ForcePureILImage", # /Switch="CLRIMAGETYPE:PURE
  775. "ForceSafeILImage",
  776. ]
  777. ),
  778. ) # /Switch="CLRIMAGETYPE:SAFE
  779. _Same(
  780. _link,
  781. "CLRThreadAttribute",
  782. _Enumeration(
  783. [
  784. "DefaultThreadingAttribute", # /CLRTHREADATTRIBUTE:NONE
  785. "MTAThreadingAttribute", # /CLRTHREADATTRIBUTE:MTA
  786. "STAThreadingAttribute",
  787. ]
  788. ),
  789. ) # /CLRTHREADATTRIBUTE:STA
  790. _Same(
  791. _link,
  792. "DataExecutionPrevention",
  793. _Enumeration(["", "false", "true"]), # /NXCOMPAT:NO
  794. ) # /NXCOMPAT
  795. _Same(
  796. _link,
  797. "Driver",
  798. _Enumeration(["NotSet", "Driver", "UpOnly", "WDM"]), # /Driver # /DRIVER:UPONLY
  799. ) # /DRIVER:WDM
  800. _Same(
  801. _link,
  802. "LinkTimeCodeGeneration",
  803. _Enumeration(
  804. [
  805. "Default",
  806. "UseLinkTimeCodeGeneration", # /LTCG
  807. "PGInstrument", # /LTCG:PGInstrument
  808. "PGOptimization", # /LTCG:PGOptimize
  809. "PGUpdate",
  810. ]
  811. ),
  812. ) # /LTCG:PGUpdate
  813. _Same(
  814. _link,
  815. "ShowProgress",
  816. _Enumeration(
  817. ["NotSet", "LinkVerbose", "LinkVerboseLib"], # /VERBOSE # /VERBOSE:Lib
  818. new=[
  819. "LinkVerboseICF", # /VERBOSE:ICF
  820. "LinkVerboseREF", # /VERBOSE:REF
  821. "LinkVerboseSAFESEH", # /VERBOSE:SAFESEH
  822. "LinkVerboseCLR",
  823. ],
  824. ),
  825. ) # /VERBOSE:CLR
  826. _Same(_link, "SubSystem", _subsystem_enumeration)
  827. _Same(_link, "TargetMachine", _target_machine_enumeration)
  828. _Same(
  829. _link,
  830. "UACExecutionLevel",
  831. _Enumeration(
  832. [
  833. "AsInvoker", # /level='asInvoker'
  834. "HighestAvailable", # /level='highestAvailable'
  835. "RequireAdministrator",
  836. ]
  837. ),
  838. ) # /level='requireAdministrator'
  839. _Same(_link, "MinimumRequiredVersion", _string)
  840. _Same(_link, "TreatLinkerWarningAsErrors", _boolean) # /WX
  841. # Options found in MSVS that have been renamed in MSBuild.
  842. _Renamed(
  843. _link,
  844. "ErrorReporting",
  845. "LinkErrorReporting",
  846. _Enumeration(
  847. [
  848. "NoErrorReport", # /ERRORREPORT:NONE
  849. "PromptImmediately", # /ERRORREPORT:PROMPT
  850. "QueueForNextLogin",
  851. ], # /ERRORREPORT:QUEUE
  852. new=["SendErrorReport"],
  853. ),
  854. ) # /ERRORREPORT:SEND
  855. _Renamed(
  856. _link, "IgnoreDefaultLibraryNames", "IgnoreSpecificDefaultLibraries", _file_list
  857. ) # /NODEFAULTLIB
  858. _Renamed(_link, "ResourceOnlyDLL", "NoEntryPoint", _boolean) # /NOENTRY
  859. _Renamed(_link, "SwapRunFromNet", "SwapRunFromNET", _boolean) # /SWAPRUN:NET
  860. _Moved(_link, "GenerateManifest", "", _boolean)
  861. _Moved(_link, "IgnoreImportLibrary", "", _boolean)
  862. _Moved(_link, "LinkIncremental", "", _newly_boolean)
  863. _Moved(_link, "LinkLibraryDependencies", "ProjectReference", _boolean)
  864. _Moved(_link, "UseLibraryDependencyInputs", "ProjectReference", _boolean)
  865. # MSVS options not found in MSBuild.
  866. _MSVSOnly(_link, "OptimizeForWindows98", _newly_boolean)
  867. _MSVSOnly(_link, "UseUnicodeResponseFiles", _boolean)
  868. # MSBuild options not found in MSVS.
  869. _MSBuildOnly(_link, "BuildingInIDE", _boolean)
  870. _MSBuildOnly(_link, "ImageHasSafeExceptionHandlers", _boolean) # /SAFESEH
  871. _MSBuildOnly(_link, "LinkDLL", _boolean) # /DLL Visible='false'
  872. _MSBuildOnly(_link, "LinkStatus", _boolean) # /LTCG:STATUS
  873. _MSBuildOnly(_link, "PreventDllBinding", _boolean) # /ALLOWBIND
  874. _MSBuildOnly(_link, "SupportNobindOfDelayLoadedDLL", _boolean) # /DELAY:NOBIND
  875. _MSBuildOnly(_link, "TrackerLogDirectory", _folder_name)
  876. _MSBuildOnly(_link, "MSDOSStubFileName", _file_name) # /STUB Visible='false'
  877. _MSBuildOnly(_link, "SectionAlignment", _integer) # /ALIGN
  878. _MSBuildOnly(_link, "SpecifySectionAttributes", _string) # /SECTION
  879. _MSBuildOnly(
  880. _link,
  881. "ForceFileOutput",
  882. _Enumeration(
  883. [],
  884. new=[
  885. "Enabled", # /FORCE
  886. # /FORCE:MULTIPLE
  887. "MultiplyDefinedSymbolOnly",
  888. "UndefinedSymbolOnly",
  889. ],
  890. ),
  891. ) # /FORCE:UNRESOLVED
  892. _MSBuildOnly(
  893. _link,
  894. "CreateHotPatchableImage",
  895. _Enumeration(
  896. [],
  897. new=[
  898. "Enabled", # /FUNCTIONPADMIN
  899. "X86Image", # /FUNCTIONPADMIN:5
  900. "X64Image", # /FUNCTIONPADMIN:6
  901. "ItaniumImage",
  902. ],
  903. ),
  904. ) # /FUNCTIONPADMIN:16
  905. _MSBuildOnly(
  906. _link,
  907. "CLRSupportLastError",
  908. _Enumeration(
  909. [],
  910. new=[
  911. "Enabled", # /CLRSupportLastError
  912. "Disabled", # /CLRSupportLastError:NO
  913. # /CLRSupportLastError:SYSTEMDLL
  914. "SystemDlls",
  915. ],
  916. ),
  917. )
  918. # Directives for converting VCResourceCompilerTool to ResourceCompile.
  919. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
  920. # the schema of the MSBuild ResourceCompile settings.
  921. _Same(_rc, "AdditionalOptions", _string_list)
  922. _Same(_rc, "AdditionalIncludeDirectories", _folder_list) # /I
  923. _Same(_rc, "Culture", _Integer(msbuild_base=16))
  924. _Same(_rc, "IgnoreStandardIncludePath", _boolean) # /X
  925. _Same(_rc, "PreprocessorDefinitions", _string_list) # /D
  926. _Same(_rc, "ResourceOutputFileName", _string) # /fo
  927. _Same(_rc, "ShowProgress", _boolean) # /v
  928. # There is no UI in VisualStudio 2008 to set the following properties.
  929. # However they are found in CL and other tools. Include them here for
  930. # completeness, as they are very likely to have the same usage pattern.
  931. _Same(_rc, "SuppressStartupBanner", _boolean) # /nologo
  932. _Same(_rc, "UndefinePreprocessorDefinitions", _string_list) # /u
  933. # MSBuild options not found in MSVS.
  934. _MSBuildOnly(_rc, "NullTerminateStrings", _boolean) # /n
  935. _MSBuildOnly(_rc, "TrackerLogDirectory", _folder_name)
  936. # Directives for converting VCMIDLTool to Midl.
  937. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
  938. # the schema of the MSBuild Midl settings.
  939. _Same(_midl, "AdditionalIncludeDirectories", _folder_list) # /I
  940. _Same(_midl, "AdditionalOptions", _string_list)
  941. _Same(_midl, "CPreprocessOptions", _string) # /cpp_opt
  942. _Same(_midl, "ErrorCheckAllocations", _boolean) # /error allocation
  943. _Same(_midl, "ErrorCheckBounds", _boolean) # /error bounds_check
  944. _Same(_midl, "ErrorCheckEnumRange", _boolean) # /error enum
  945. _Same(_midl, "ErrorCheckRefPointers", _boolean) # /error ref
  946. _Same(_midl, "ErrorCheckStubData", _boolean) # /error stub_data
  947. _Same(_midl, "GenerateStublessProxies", _boolean) # /Oicf
  948. _Same(_midl, "GenerateTypeLibrary", _boolean)
  949. _Same(_midl, "HeaderFileName", _file_name) # /h
  950. _Same(_midl, "IgnoreStandardIncludePath", _boolean) # /no_def_idir
  951. _Same(_midl, "InterfaceIdentifierFileName", _file_name) # /iid
  952. _Same(_midl, "MkTypLibCompatible", _boolean) # /mktyplib203
  953. _Same(_midl, "OutputDirectory", _string) # /out
  954. _Same(_midl, "PreprocessorDefinitions", _string_list) # /D
  955. _Same(_midl, "ProxyFileName", _file_name) # /proxy
  956. _Same(_midl, "RedirectOutputAndErrors", _file_name) # /o
  957. _Same(_midl, "SuppressStartupBanner", _boolean) # /nologo
  958. _Same(_midl, "TypeLibraryName", _file_name) # /tlb
  959. _Same(_midl, "UndefinePreprocessorDefinitions", _string_list) # /U
  960. _Same(_midl, "WarnAsError", _boolean) # /WX
  961. _Same(
  962. _midl,
  963. "DefaultCharType",
  964. _Enumeration(["Unsigned", "Signed", "Ascii"]), # /char unsigned # /char signed
  965. ) # /char ascii7
  966. _Same(
  967. _midl,
  968. "TargetEnvironment",
  969. _Enumeration(
  970. [
  971. "NotSet",
  972. "Win32", # /env win32
  973. "Itanium", # /env ia64
  974. "X64", # /env x64
  975. "ARM64", # /env arm64
  976. ]
  977. ),
  978. )
  979. _Same(
  980. _midl,
  981. "EnableErrorChecks",
  982. _Enumeration(["EnableCustom", "None", "All"]), # /error none
  983. ) # /error all
  984. _Same(
  985. _midl,
  986. "StructMemberAlignment",
  987. _Enumeration(["NotSet", "1", "2", "4", "8"]), # Zp1 # Zp2 # Zp4
  988. ) # Zp8
  989. _Same(
  990. _midl,
  991. "WarningLevel",
  992. _Enumeration(["0", "1", "2", "3", "4"]), # /W0 # /W1 # /W2 # /W3
  993. ) # /W4
  994. _Renamed(_midl, "DLLDataFileName", "DllDataFileName", _file_name) # /dlldata
  995. _Renamed(_midl, "ValidateParameters", "ValidateAllParameters", _boolean) # /robust
  996. # MSBuild options not found in MSVS.
  997. _MSBuildOnly(_midl, "ApplicationConfigurationMode", _boolean) # /app_config
  998. _MSBuildOnly(_midl, "ClientStubFile", _file_name) # /cstub
  999. _MSBuildOnly(
  1000. _midl, "GenerateClientFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
  1001. ) # /client none
  1002. _MSBuildOnly(
  1003. _midl, "GenerateServerFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
  1004. ) # /client none
  1005. _MSBuildOnly(_midl, "LocaleID", _integer) # /lcid DECIMAL
  1006. _MSBuildOnly(_midl, "ServerStubFile", _file_name) # /sstub
  1007. _MSBuildOnly(_midl, "SuppressCompilerWarnings", _boolean) # /no_warn
  1008. _MSBuildOnly(_midl, "TrackerLogDirectory", _folder_name)
  1009. _MSBuildOnly(
  1010. _midl, "TypeLibFormat", _Enumeration([], new=["NewFormat", "OldFormat"]) # /newtlb
  1011. ) # /oldtlb
  1012. # Directives for converting VCLibrarianTool to Lib.
  1013. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
  1014. # the schema of the MSBuild Lib settings.
  1015. _Same(_lib, "AdditionalDependencies", _file_list)
  1016. _Same(_lib, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
  1017. _Same(_lib, "AdditionalOptions", _string_list)
  1018. _Same(_lib, "ExportNamedFunctions", _string_list) # /EXPORT
  1019. _Same(_lib, "ForceSymbolReferences", _string) # /INCLUDE
  1020. _Same(_lib, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
  1021. _Same(_lib, "IgnoreSpecificDefaultLibraries", _file_list) # /NODEFAULTLIB
  1022. _Same(_lib, "ModuleDefinitionFile", _file_name) # /DEF
  1023. _Same(_lib, "OutputFile", _file_name) # /OUT
  1024. _Same(_lib, "SuppressStartupBanner", _boolean) # /NOLOGO
  1025. _Same(_lib, "UseUnicodeResponseFiles", _boolean)
  1026. _Same(_lib, "LinkTimeCodeGeneration", _boolean) # /LTCG
  1027. _Same(_lib, "TargetMachine", _target_machine_enumeration)
  1028. # TODO(jeanluc) _link defines the same value that gets moved to
  1029. # ProjectReference. We may want to validate that they are consistent.
  1030. _Moved(_lib, "LinkLibraryDependencies", "ProjectReference", _boolean)
  1031. _MSBuildOnly(_lib, "DisplayLibrary", _string) # /LIST Visible='false'
  1032. _MSBuildOnly(
  1033. _lib,
  1034. "ErrorReporting",
  1035. _Enumeration(
  1036. [],
  1037. new=[
  1038. "PromptImmediately", # /ERRORREPORT:PROMPT
  1039. "QueueForNextLogin", # /ERRORREPORT:QUEUE
  1040. "SendErrorReport", # /ERRORREPORT:SEND
  1041. "NoErrorReport",
  1042. ],
  1043. ),
  1044. ) # /ERRORREPORT:NONE
  1045. _MSBuildOnly(_lib, "MinimumRequiredVersion", _string)
  1046. _MSBuildOnly(_lib, "Name", _file_name) # /NAME
  1047. _MSBuildOnly(_lib, "RemoveObjects", _file_list) # /REMOVE
  1048. _MSBuildOnly(_lib, "SubSystem", _subsystem_enumeration)
  1049. _MSBuildOnly(_lib, "TrackerLogDirectory", _folder_name)
  1050. _MSBuildOnly(_lib, "TreatLibWarningAsErrors", _boolean) # /WX
  1051. _MSBuildOnly(_lib, "Verbose", _boolean)
  1052. # Directives for converting VCManifestTool to Mt.
  1053. # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
  1054. # the schema of the MSBuild Lib settings.
  1055. # Options that have the same name in MSVS and MSBuild
  1056. _Same(_manifest, "AdditionalManifestFiles", _file_list) # /manifest
  1057. _Same(_manifest, "AdditionalOptions", _string_list)
  1058. _Same(_manifest, "AssemblyIdentity", _string) # /identity:
  1059. _Same(_manifest, "ComponentFileName", _file_name) # /dll
  1060. _Same(_manifest, "GenerateCatalogFiles", _boolean) # /makecdfs
  1061. _Same(_manifest, "InputResourceManifests", _string) # /inputresource
  1062. _Same(_manifest, "OutputManifestFile", _file_name) # /out
  1063. _Same(_manifest, "RegistrarScriptFile", _file_name) # /rgs
  1064. _Same(_manifest, "ReplacementsFile", _file_name) # /replacements
  1065. _Same(_manifest, "SuppressStartupBanner", _boolean) # /nologo
  1066. _Same(_manifest, "TypeLibraryFile", _file_name) # /tlb:
  1067. _Same(_manifest, "UpdateFileHashes", _boolean) # /hashupdate
  1068. _Same(_manifest, "UpdateFileHashesSearchPath", _file_name)
  1069. _Same(_manifest, "VerboseOutput", _boolean) # /verbose
  1070. # Options that have moved location.
  1071. _MovedAndRenamed(
  1072. _manifest,
  1073. "ManifestResourceFile",
  1074. "ManifestResourceCompile",
  1075. "ResourceOutputFileName",
  1076. _file_name,
  1077. )
  1078. _Moved(_manifest, "EmbedManifest", "", _boolean)
  1079. # MSVS options not found in MSBuild.
  1080. _MSVSOnly(_manifest, "DependencyInformationFile", _file_name)
  1081. _MSVSOnly(_manifest, "UseFAT32Workaround", _boolean)
  1082. _MSVSOnly(_manifest, "UseUnicodeResponseFiles", _boolean)
  1083. # MSBuild options not found in MSVS.
  1084. _MSBuildOnly(_manifest, "EnableDPIAwareness", _boolean)
  1085. _MSBuildOnly(_manifest, "GenerateCategoryTags", _boolean) # /category
  1086. _MSBuildOnly(
  1087. _manifest, "ManifestFromManagedAssembly", _file_name
  1088. ) # /managedassemblyname
  1089. _MSBuildOnly(_manifest, "OutputResourceManifests", _string) # /outputresource
  1090. _MSBuildOnly(_manifest, "SuppressDependencyElement", _boolean) # /nodependency
  1091. _MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name)
  1092. # Directives for MASM.
  1093. # See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the
  1094. # MSBuild MASM settings.
  1095. # Options that have the same name in MSVS and MSBuild.
  1096. _Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh