Skip to content

Commit a7fbcfe

Browse files
authored
[Config] Add TSAN option (sofa-framework#4534)
* add TSAN flag (if enabled) for gcc or clang * rename cmake option
1 parent ebd18c0 commit a7fbcfe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sofa/framework/Config/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ if(MSVC)
6363
endif()
6464
option(SOFA_ENABLE_FAST_MATH "Enable floating-point model to fast (theoretically faster but can bring unexpected results/bugs)." OFF)
6565

66-
6766
### SOFA_DEV_TOOL
6867
option(SOFA_WITH_DEVTOOLS "Compile with development extra features." ON)
6968

@@ -179,6 +178,12 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "C
179178
if(SOFA_ENABLE_FAST_MATH)
180179
list(APPEND SOFACONFIG_COMPILE_OPTIONS "-ffast-math")
181180
endif()
181+
182+
option(SOFA_ENABLE_THREAD_SANITIZER "Enable thread sanitizer (only gcc or clang)" OFF)
183+
if(SOFA_ENABLE_THREAD_SANITIZER)
184+
list(APPEND SOFACONFIG_COMPILE_OPTIONS "-fsanitize=thread")
185+
list(APPEND SOFACONFIG_LINK_OPTIONS "-fsanitize=thread")
186+
endif()
182187
endif()
183188

184189
## Windows-specific

0 commit comments

Comments
 (0)