Skip to content

Commit 27338b2

Browse files
committed
feat(msvs): add support for CL env var
1 parent 33ff306 commit 27338b2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

pylib/gyp/generator/msvs.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,6 +3440,24 @@ def _FinalizeMSBuildSettings(spec, configuration):
34403440

34413441

34423442
def _GetValueFormattedForMSBuild(tool_name, name, value):
3443+
"""
3444+
>>> _GetValueFormattedForMSBuild(
3445+
... tool_name="tool_name", name="name", value=[]
3446+
... )
3447+
''
3448+
>>> _GetValueFormattedForMSBuild(
3449+
... tool_name="tool_name", name="name", value=["DelayLoadDLLs"]
3450+
... )
3451+
'DelayLoadDLLs'
3452+
>>> _GetValueFormattedForMSBuild(
3453+
... tool_name="Lib", name="AdditionalOptions", value=["DelayLoadDLLs"]
3454+
... )
3455+
'DelayLoadDLLs %(AdditionalOptions)'
3456+
>>> _GetValueFormattedForMSBuild(
3457+
... tool_name="ClCompile", name="AdditionalOptions", value=["DelayLoadDLLs"]
3458+
... )
3459+
'DelayLoadDLLs %(AdditionalOptions)'
3460+
"""
34433461
if type(value) == list:
34443462
# For some settings, VS2010 does not automatically extends the settings
34453463
# TODO(jeanluc) Is this what we want?
@@ -3466,6 +3484,8 @@ def _GetValueFormattedForMSBuild(tool_name, name, value):
34663484
formatted_value = char.join(
34673485
[MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value]
34683486
)
3487+
if tool_name == "ClCompile" and name == "AdditionalOptions":
3488+
formatted_value += os.environ.get("CL", "").replace("#", "=")
34693489
else:
34703490
formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value)
34713491
return formatted_value

pylib/gyp/msvs_emulation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ def _ExtractImportantEnvironment(output_of_set):
11251125
"systemroot",
11261126
"temp",
11271127
"tmp",
1128+
"cl",
11281129
)
11291130
env = {}
11301131
# This occasionally happens and leads to misleading SYSTEMROOT error messages

0 commit comments

Comments
 (0)