-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# BEMAN_BUILDSYS_SANITIZER is not a general use option | ||
# It is used by preset and CI system. | ||
# There's three possible values: | ||
# TSan: Thread sanitizer | ||
# ASan: All sanitizer (majorly Address sanitizer) that doesn't conflict with TSan | ||
# OFF: No sanitizer | ||
|
||
message("Applying sanitizers for ${CMAKE_CXX_COMPILER_ID}") | ||
|
||
if(BEMAN_BUILDSYS_SANITIZER STREQUAL "ASan") | ||
# Basic ASan flags | ||
set(SANITIZER_FLAGS | ||
"-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" | ||
) | ||
|
||
# Exclude -fsanitize=leak on Apple Clang (gcc on macos) as it is not supported. | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||
message(STATUS "Using GCC on macOS; excluding -fsanitize=leak") | ||
else() | ||
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=leak") | ||
endif() | ||
elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "TSan") | ||
# Basic ASan flags | ||
set(SANITIZER_FLAGS "-fsanitize=thread") | ||
elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "OFF") | ||
set(SANITIZER_FLAGS "") | ||
else() | ||
message( | ||
FATAL_ERROR | ||
"Invalid BEMAN_BUILDSYS_SANITIZER option: ${BEMAN_BUILDSYS_SANITIZER}" | ||
) | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") |
This file was deleted.
Oops, something went wrong.