Skip to content

Commit ee4a6cf

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

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

pylib/gyp/generator/msvs.py

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

34413441

34423442
def _GetValueFormattedForMSBuild(tool_name, name, value):
3443+
"""
3444+
>>> PRODUCT_DIR_ABS = "PRODUCT_DIR_ABS"
3445+
>>> _GetValueFormattedForMSBuild(
3446+
... tool_name="tool_name", name="name", value=[]
3447+
... )
3448+
''
3449+
>>> _GetValueFormattedForMSBuild(
3450+
... tool_name="tool_name", name="name", value=["DelayLoadDLLs"]
3451+
... )
3452+
'DelayLoadDLLs'
3453+
>>> _GetValueFormattedForMSBuild(
3454+
... tool_name="Lib", name="AdditionalOptions", value=["DelayLoadDLLs"]
3455+
... )
3456+
'DelayLoadDLLs %(AdditionalOptions)'
3457+
>>> _GetValueFormattedForMSBuild(
3458+
... tool_name="ClCompile", name="AdditionalOptions", value=["DelayLoadDLLs"]
3459+
... )
3460+
'DelayLoadDLLs %(AdditionalOptions)'
3461+
"""
34433462
if type(value) == list:
34443463
# For some settings, VS2010 does not automatically extends the settings
34453464
# TODO(jeanluc) Is this what we want?
@@ -3466,6 +3485,8 @@ def _GetValueFormattedForMSBuild(tool_name, name, value):
34663485
formatted_value = char.join(
34673486
[MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value]
34683487
)
3488+
if tool_name == "ClCompile" and name == "AdditionalOptions":
3489+
formatted_value += os.environ.get("CL", "").replace("#", "=")
34693490
else:
34703491
formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value)
34713492
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)