Merge pull request #4 from RandomShaper/asan

Add `use_asan` build option
This commit is contained in:
Rémi Verschelde
2024-07-02 14:30:26 +02:00
committed by GitHub

View File

@@ -78,6 +78,8 @@ opts.Add(
)
)
opts.Add(BoolVariable("use_asan", "Use address sanitizer (ASAN) in MSVC", False))
# Add platform options
tools = {}
for pl in platforms:
@@ -177,6 +179,12 @@ if env["platform"] == "macos":
elif env["platform"] == "windows":
env.AppendUnique(CPPDEFINES=["WINVER=0x0603", "_WIN32_WINNT=0x0603"])
# Sanitizers.
if env.get("use_asan", False) and and env.get("is_msvc", False):
env["extra_suffix"] = "san"
env.Append(LINKFLAGS=["/INFERASANLIBS"])
env.Append(CCFLAGS=["/fsanitize=address"])
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None: