From 6e1650060d6b400edb4cef3a4c53f5359570c0c4 Mon Sep 17 00:00:00 2001 From: xiss burg Date: Sun, 19 May 2024 14:26:48 -0500 Subject: [PATCH] Use /MTd and /MDd flags on Windows dev builds Select the debug runtime library for dev builds. I had to do this change to build my extension successfully in debug mode because I link with other libraries which are built with this flag which is the default choice for debug builds. Otherwise, I get linker errors of the kind `"error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in .obj"` --- tools/windows.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/windows.py b/tools/windows.py index a263241aa..fb5ed2bff 100644 --- a/tools/windows.py +++ b/tools/windows.py @@ -38,9 +38,15 @@ def generate(env): env["CXX"] = "clang-cl" if env["use_static_cpp"]: - env.Append(CCFLAGS=["/MT"]) + if env["dev_build"]: + env.Append(CCFLAGS=["/MTd"]) + else: + env.Append(CCFLAGS=["/MT"]) else: - env.Append(CCFLAGS=["/MD"]) + if env["dev_build"]: + env.Append(CCFLAGS=["/MDd"]) + else: + env.Append(CCFLAGS=["/MD"]) elif sys.platform == "win32" or sys.platform == "msys": env["use_mingw"] = True