Skip to content

Commit

Permalink
CMake: add ENABLE_RTTI option (#4382)
Browse files Browse the repository at this point in the history
Fixes

 $ CXX=clang++ cmake -H. -Bout -DSPIRV_USE_SANITIZER=vptr
 $ make -C out
 ...
 clang: error: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti'
  • Loading branch information
olvaffe committed Jul 16, 2021
1 parent 8966cc2 commit 3a68a72
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Expand Up @@ -33,6 +33,7 @@ include(GNUInstallDirs)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 11)

option(ENABLE_RTTI "Enables RTTI" OFF)
option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON)

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
Expand Down Expand Up @@ -178,11 +179,14 @@ function(spvtools_default_compile_options TARGET)
target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS})

if (${COMPILER_IS_LIKE_GNU})
target_compile_options(${TARGET} PRIVATE
-std=c++11 -fno-exceptions -fno-rtti)
target_compile_options(${TARGET} PRIVATE -std=c++11 -fno-exceptions)
target_compile_options(${TARGET} PRIVATE
-Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion
-Wno-sign-conversion)

if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()
# For good call stacks in profiles, keep the frame pointers.
if(NOT "${SPIRV_PERF}" STREQUAL "")
target_compile_options(${TARGET} PRIVATE -fno-omit-frame-pointer)
Expand Down

0 comments on commit 3a68a72

Please sign in to comment.