Skip to content

Commit

Permalink
Add AMBER_DISABLE_WEVERYTHING and AMBER_DISABLE_WERROR options (#1013)
Browse files Browse the repository at this point in the history
New compiler versions may add additional warnings; in particular,
-Weverything includes warnings that are unstable and may not be
generally-applicable.

To assist projects like VK-GL-CTS that may depend on old versions of
amber for a long period of time, add AMBER_DISABLE_WERROR and
AMBER_DISABLE_WEVERYTHING flags to allow disabling those warnings
downstream. That allows those projects to be built with newer versions
of clang without needing to fork amber and disable unwanted warnings.
  • Loading branch information
John Bauman authored Feb 2, 2023
1 parent e024ef6 commit 49043d8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ option(AMBER_ENABLE_SWIFTSHADER
"Build using SwiftShader" ${AMBER_ENABLE_SWIFTSHADER})
option(AMBER_ENABLE_RTTI
"Build with runtime type information" OFF)
option(AMBER_DISABLE_WERROR "Build without the -Werror flag" ${AMBER_DISABLE_WERROR})
option(AMBER_DISABLE_WEVERYTHING "Build without the -Weverything flag" ${AMBER_DISABLE_WEVERYTHING})

if (${AMBER_ENABLE_VK_DEBUGGING})
message(FATAL_ERROR "Amber no longer supports Vulkan debugging")
Expand Down Expand Up @@ -206,14 +208,16 @@ function(amber_default_compile_options TARGET)
-fno-exceptions
-fvisibility=hidden
-Wall
-Werror
-Wextra
-Wno-cast-function-type-strict
-Wno-padded
-Wno-switch-enum
-Wno-unknown-pragmas
-pedantic-errors
)
if (NOT ${AMBER_DISABLE_WERROR})
target_compile_options(${TARGET} PRIVATE -Werror)
endif()

if(NOT ${AMBER_ENABLE_RTTI})
target_compile_options(${TARGET} PRIVATE -fno-rtti)
Expand All @@ -225,8 +229,10 @@ function(amber_default_compile_options TARGET)
-Wno-c++98-compat-pedantic
-Wno-format-pedantic
-Wno-unknown-warning-option
-Weverything
)
if (NOT ${AMBER_DISABLE_WEVERYTHING})
target_compile_options(${TARGET} PRIVATE -Weverything)
endif()
endif()
endif()

Expand Down

0 comments on commit 49043d8

Please sign in to comment.