Browse Source

Windows: Link MSVC dynamic debug CRT for debug builds

Fixes #31608.
Rémi Verschelde 2 years ago
parent
commit
cf9bb5c2c3
1 changed files with 7 additions and 3 deletions
  1. 7 3
      platform/windows/detect.py

+ 7 - 3
platform/windows/detect.py

@@ -339,10 +339,14 @@ def configure_msvc(env, vcvars_msvc_config):
 
 
     ## Compile/link flags
     ## Compile/link flags
 
 
-    if env["use_static_cpp"]:
-        env.AppendUnique(CCFLAGS=["/MT"])
+    if env["optimize"] in ["debug", "none"]:
+        # Always use dynamic runtime, static debug CRT breaks thread_local.
+        env.AppendUnique(CCFLAGS=["/MDd"])
     else:
     else:
-        env.AppendUnique(CCFLAGS=["/MD"])
+        if env["use_static_cpp"]:
+            env.AppendUnique(CCFLAGS=["/MT"])
+        else:
+            env.AppendUnique(CCFLAGS=["/MD"])
 
 
     if env["arch"] == "x86_32":
     if env["arch"] == "x86_32":
         env["x86_libtheora_opt_vc"] = True
         env["x86_libtheora_opt_vc"] = True