Skip to content

Commit

Permalink
feat(msvs): add support for CL env var
Browse files Browse the repository at this point in the history
  • Loading branch information
mscdex committed Nov 6, 2021
1 parent 33ff306 commit ee4a6cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3440,6 +3440,25 @@ def _FinalizeMSBuildSettings(spec, configuration):


def _GetValueFormattedForMSBuild(tool_name, name, value):
"""
>>> PRODUCT_DIR_ABS = "PRODUCT_DIR_ABS"
>>> _GetValueFormattedForMSBuild(
... tool_name="tool_name", name="name", value=[]
... )
''
>>> _GetValueFormattedForMSBuild(
... tool_name="tool_name", name="name", value=["DelayLoadDLLs"]
... )
'DelayLoadDLLs'
>>> _GetValueFormattedForMSBuild(
... tool_name="Lib", name="AdditionalOptions", value=["DelayLoadDLLs"]
... )
'DelayLoadDLLs %(AdditionalOptions)'
>>> _GetValueFormattedForMSBuild(
... tool_name="ClCompile", name="AdditionalOptions", value=["DelayLoadDLLs"]
... )
'DelayLoadDLLs %(AdditionalOptions)'
"""
if type(value) == list:
# For some settings, VS2010 does not automatically extends the settings
# TODO(jeanluc) Is this what we want?
Expand All @@ -3466,6 +3485,8 @@ def _GetValueFormattedForMSBuild(tool_name, name, value):
formatted_value = char.join(
[MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value]
)
if tool_name == "ClCompile" and name == "AdditionalOptions":
formatted_value += os.environ.get("CL", "").replace("#", "=")
else:
formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value)
return formatted_value
Expand Down
1 change: 1 addition & 0 deletions pylib/gyp/msvs_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ def _ExtractImportantEnvironment(output_of_set):
"systemroot",
"temp",
"tmp",
"cl",
)
env = {}
# This occasionally happens and leads to misleading SYSTEMROOT error messages
Expand Down

0 comments on commit ee4a6cf

Please sign in to comment.