Skip to content

Commit 466be21

Browse files
authored
[mypyc] Use more accurate flags with msvc (#12468)
Co-authored-by: KotlinIsland <[email protected]>
1 parent ecef427 commit 466be21

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mypyc/build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,20 @@ def mypycify(
523523
# This flag is needed for gcc but does not exist on clang.
524524
cflags += ['-Wno-unused-but-set-variable']
525525
elif compiler.compiler_type == 'msvc':
526-
if opt_level == '3':
526+
# msvc doesn't have levels, '/O2' is full and '/Od' is disable
527+
if opt_level == '0':
528+
opt_level = 'd'
529+
elif opt_level in ('1', '2', '3'):
527530
opt_level = '2'
531+
if debug_level == '0':
532+
debug_level = "NONE"
533+
elif debug_level == '1':
534+
debug_level = "FASTLINK"
535+
elif debug_level in ('2', '3'):
536+
debug_level = "FULL"
528537
cflags += [
529538
'/O{}'.format(opt_level),
539+
f'/DEBUG:{debug_level}',
530540
'/wd4102', # unreferenced label
531541
'/wd4101', # unreferenced local variable
532542
'/wd4146', # negating unsigned int

0 commit comments

Comments
 (0)