Skip to content

Commit b4e0e2c

Browse files
committed
NVCC: Handle rewrite with =
1 parent 1453cb8 commit b4e0e2c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

refresh.template.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,13 @@ def _nvcc_patch(compile_args: typing.List[str]) -> typing.List[str]:
808808
if skip:
809809
continue
810810

811-
rewrite_to = _nvcc_rewrite_flags.get(arg)
811+
option, did_partition, remainder = arg.partition('=')
812+
rewrite_to = _nvcc_rewrite_flags.get(option) # Handles =value. Note: Note assumes no rewritten args are one character with a value that might take the -I<value> short form. <TAG_REWRITE>
812813
if rewrite_to:
813-
new_compile_args.append(rewrite_to)
814-
continue
814+
if did_partition:
815+
arg = rewrite_to + '=' + remainder
816+
else:
817+
arg = rewrite_to
815818

816819
if ',' in arg: # Unpack NVCC's (fairly unique) comma-separated list format
817820
if arg.startswith('-'):
@@ -932,6 +935,7 @@ def _nvcc_patch(compile_args: typing.List[str]) -> typing.List[str]:
932935
}
933936
_nvcc_rewrite_flags = {
934937
# NVCC flag: clang flag
938+
# Note: If you rewrite a one-character flag, you'll need to change the code by <TAG_REWRITE>.
935939
'--Werror': '-Werror',
936940
'--Wno-deprecated-declarations': '-Wno-deprecated-declarations',
937941
'--Wreorder': '-Wreorder',

0 commit comments

Comments
 (0)