Skip to content

Commit

Permalink
Add use_asan build option
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Jun 14, 2024
1 parent 0af9607 commit d61034b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ opts.Add("cxxflags", "Custom flags for the C++ compiler")
opts.Add("cflags", "Custom flags for the C compiler")
opts.Add("linkflags", "Custom flags for the linker")
opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files.", "")
opts.Add(BoolVariable("use_asan", "Use address sanitizer (ASAN) in MSVC", False))

# Targets flags tool (optimizations, debug symbols)
target_tool = Tool("targets", toolpath=["godot-tools"])
Expand Down Expand Up @@ -191,6 +192,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 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:
Expand Down

0 comments on commit d61034b

Please sign in to comment.