From 66df936294f54360f7ca2732d676fe93888f2860 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Mon, 30 Sep 2024 23:12:11 +0200 Subject: [PATCH] Add WIVRN_WERROR build option --- CMakeLists.txt | 22 ++++++++++++++++++++++ client/CMakeLists.txt | 6 ------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cfbd84a..5b8d1e8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the V option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF) option(WIVRN_BUILD_SERVER "Build WiVRn server" ON) option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF) +option(WIVRN_WERROR "Treat warnings as errors" OFF) option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON) auto_option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" AUTO) @@ -219,3 +220,24 @@ if (WIVRN_BUILD_SERVER) endif() add_subdirectory(tools) + +foreach(TARGET_NAME wivrn wivrn-server wivrn-common) + if(TARGET ${TARGET_NAME}) + target_compile_options(${TARGET_NAME} PRIVATE + -fdiagnostics-color -Wall -Wextra -pedantic + -Wundef + -Wno-missing-field-initializers + -Wno-unused-parameter + -Wno-comment + -Wno-unused-variable + -Wno-sign-compare + $<$:-Wno-volatile> + $<$:-Wno-deprecated-volatile -Wno-unneeded-internal-declaration -Wno-c99-extensions -Wno-unused-private-field> + ) + + if (WIVRN_WERROR) + target_compile_options(${TARGET_NAME} PRIVATE -Werror) + endif() + + endif() +endforeach() diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 91caedc4..4247e816 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -109,12 +109,6 @@ target_link_libraries(wivrn Vulkan::Vulkan spdlog::spdlog glm::glm fastgltf Free target_compile_definitions(wivrn PRIVATE -DXR_USE_GRAPHICS_API_VULKAN) target_compile_definitions(wivrn PRIVATE -DVMA_STATS_STRING_ENABLED=0) target_compile_definitions(wivrn PRIVATE -DGLM_ENABLE_EXPERIMENTAL) -target_compile_options(wivrn PRIVATE -fdiagnostics-color -Wall -Wextra -pedantic) # -Werror - -target_compile_options(wivrn PRIVATE -Wno-missing-field-initializers -Wno-unused-parameter - $<$:-Wno-volatile> - $<$:-Wno-deprecated-volatile> -) target_include_directories(wivrn PRIVATE .)