Skip to content

Commit

Permalink
BUILD_WERROR OFF by default
Browse files Browse the repository at this point in the history
Consistent naming with other repos we maintain.

OFF by default to avoid issues with newer compilers, specific
generators (Xcode), etc.
  • Loading branch information
juan-lunarg committed Dec 28, 2023
1 parent a3b11f1 commit 30826d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
-D CMAKE_C_COMPILER=${{ matrix.compiler.cc }}
- run: cmake --build build
Expand All @@ -89,7 +89,7 @@ jobs:
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D USE_GAS=OFF \
-D CMAKE_C_COMPILER=clang \
-D CMAKE_CXX_COMPILER=clang++
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
-D CMAKE_BUILD_TYPE=${{matrix.config}} \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D SYSCONFDIR=/etc/not_vulkan \
-G Ninja
env:
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D USE_GAS=OFF \
-G Ninja
env:
Expand All @@ -183,7 +183,7 @@ jobs:
-D UPDATE_DEPS=ON `
-D CMAKE_BUILD_TYPE=${{matrix.config}} `
-A ${{ matrix.arch }} `
-D ENABLE_WERROR=ON
-D BUILD_WERROR=ON
- run: cmake --build build/ --config ${{matrix.config}}
- run: cmake --install build --prefix build/install --config ${{matrix.config}}
- run: ctest --output-on-failure -C ${{matrix.config}} --test-dir build/
Expand All @@ -202,7 +202,7 @@ jobs:
-D USE_MASM=OFF `
-D CMAKE_BUILD_TYPE=Release `
-A ${{ matrix.arch }} `
-D ENABLE_WERROR=ON
-D BUILD_WERROR=ON
- run: cmake --build build/ --config Release
- run: ctest --output-on-failure -C Release -E UnknownFunction --test-dir build/

Expand All @@ -222,7 +222,7 @@ jobs:
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} `
-D UPDATE_DEPS=ON `
-D CMAKE_BUILD_TYPE=${{matrix.config}} `
-D ENABLE_WERROR=ON `
-D BUILD_WERROR=ON `
-D BUILD_TESTS=ON `
-G Ninja
- run: cmake --build build/
Expand All @@ -247,7 +247,7 @@ jobs:
-D ${{matrix.static_build}} \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
-G Ninja
env:
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
"-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-D CMAKE_BUILD_TYPE=Debug \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-G Ninja
env:
LDFLAGS: -Wl,-fatal_warnings
Expand Down Expand Up @@ -308,7 +308,7 @@ jobs:
"-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-G ${{ matrix.generator }}
env:
LDFLAGS: -Wl,-fatal_warnings
Expand Down Expand Up @@ -348,6 +348,7 @@ jobs:
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp
Expand All @@ -368,6 +369,7 @@ jobs:
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp
Expand All @@ -384,7 +386,7 @@ jobs:
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_WERROR=ON \
-D BUILD_WERROR=ON \
-D USE_MASM=OFF \
-G Ninja
- run: cmake --build build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Generate build files
if: matrix.language == 'cpp'
run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON -D LOADER_ENABLE_ADDRESS_SANITIZER=ON -D ENABLE_WERROR=ON
run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON
env:
CC: gcc
CXX: g++
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ set(LOADER_STANDARD_C_PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSI
# Force the use of the multithreaded, static version of the C runtime.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

option(ENABLE_WERROR "Enable warnings as errors" ON)
option(BUILD_WERROR "Enable warnings as errors")

# Set warnings as errors and the main diagnostic flags
# Must be set first so the warning silencing later on works properly
# Note that clang-cl.exe should use MSVC flavor flags, not GNU
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC"))
if (ENABLE_WERROR)
if (BUILD_WERROR)
target_compile_options(loader_common_options INTERFACE /WX)
endif()
target_compile_options(loader_common_options INTERFACE /W4)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
# using GCC or Clang with the regular front end
if (ENABLE_WERROR)
if (BUILD_WERROR)
target_compile_options(loader_common_options INTERFACE -Werror)
endif()
target_compile_options(loader_common_options INTERFACE -Wall -Wextra)
Expand Down

0 comments on commit 30826d2

Please sign in to comment.