Commit f117291f by Ben Clayton Committed by Ben Clayton

CMake: Add DCHECK_ALWAYS_ON flag

Enables macros like ASSERT, UNIMPLEMENTED even in release builds. Bug: b/126329018 Change-Id: I7d810862b16d85b0a4ffc6b39a655cc73d4c669a Reviewed-on: https://swiftshader-review.googlesource.com/c/25557 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 60a3d6f7
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
"args": [ "args": [
"..", "..",
"-DCMAKE_BUILD_TYPE=${input:buildType}", "-DCMAKE_BUILD_TYPE=${input:buildType}",
"-DWARNINGS_AS_ERRORS=1" "-DWARNINGS_AS_ERRORS=1",
"-DDCHECK_ALWAYS_ON=1"
], ],
"options": { "options": {
"cwd": "${workspaceRoot}/build" "cwd": "${workspaceRoot}/build"
......
...@@ -77,6 +77,7 @@ option (ASAN "Build with address sanitizer" 0) ...@@ -77,6 +77,7 @@ option (ASAN "Build with address sanitizer" 0)
option (TSAN "Build with thread sanitizer" 0) option (TSAN "Build with thread sanitizer" 0)
option (UBSAN "Build with undefined behavior sanitizer" 0) option (UBSAN "Build with undefined behavior sanitizer" 0)
option (WARNINGS_AS_ERRORS "Treat all warnings as errors" 0) option (WARNINGS_AS_ERRORS "Treat all warnings as errors" 0)
option (DCHECK_ALWAYS_ON "Check validation macros even in release builds" 0)
if(ARCH STREQUAL "arm") if(ARCH STREQUAL "arm")
set(DEFAULT_REACTOR_BACKEND "Subzero") set(DEFAULT_REACTOR_BACKEND "Subzero")
...@@ -271,6 +272,10 @@ else() ...@@ -271,6 +272,10 @@ else()
set_cpp_flag("-Werror") # Treat all warnings as errors set_cpp_flag("-Werror") # Treat all warnings as errors
endif() endif()
if(DCHECK_ALWAYS_ON)
set_cpp_flag("-DDCHECK_ALWAYS_ON")
endif()
# Disable pedanitc warnings # Disable pedanitc warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set_cpp_flag("-Wno-ignored-attributes") # ignoring attributes on template argument 'X' set_cpp_flag("-Wno-ignored-attributes") # ignoring attributes on template argument 'X'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment