mirror of
https://github.com/godotengine/godot.git
synced 2025-02-13 06:10:58 +00:00
Merge pull request #46941 from goostengine/asan-msvc
Add `use_asan` option for MSVC to enable AddressSanitizer
This commit is contained in:
commit
0fd723d3ec
@ -72,6 +72,7 @@ def get_opts():
|
||||
BoolVariable("use_llvm", "Use the LLVM compiler", False),
|
||||
BoolVariable("use_thinlto", "Use ThinLTO", False),
|
||||
BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True),
|
||||
BoolVariable("use_asan", "Use address sanitizer (ASAN)", False),
|
||||
]
|
||||
|
||||
|
||||
@ -306,6 +307,12 @@ def configure_msvc(env, manual_msvc_config):
|
||||
env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
|
||||
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
|
||||
|
||||
# Sanitizers
|
||||
if env["use_asan"]:
|
||||
env.extra_suffix += ".s"
|
||||
env.Append(LINKFLAGS=["/INFERASANLIBS"])
|
||||
env.Append(CCFLAGS=["/fsanitize=address"])
|
||||
|
||||
# Incremental linking fix
|
||||
env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
|
||||
env["BUILDERS"]["Program"] = methods.precious_program
|
||||
|
Loading…
Reference in New Issue
Block a user