diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c0bd40e45..e55600715d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,10 +204,13 @@ jobs: - name: Windows (VS 2026, ninja + sccache) os: windows-2025-vs2026 USE_SCCACHE: 1 - - name: Windows ClangCL (2022 + llvm-cov) + - name: Windows ClangCL (VS 2022 + llvm-cov) os: windows-2022 VS_GENERATOR_TOOLSET: ClangCL RUN_ANALYZER: llvm-cov + - name: Windows ClangCL (VS 2026) + os: windows-2025-vs2026 + VS_GENERATOR_TOOLSET: ClangCL - name: LLVM-Mingw os: windows-latest TEST_MINGW: 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 85392691a8..e0162b27e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,7 @@ option(SENTRY_TRANSPORT_COMPRESSION "Enable transport gzip compression" OFF) option(SENTRY_BUILD_TESTS "Build sentry-native tests" "${SENTRY_MAIN_PROJECT}") option(SENTRY_BUILD_EXAMPLES "Build sentry-native example(s)" "${SENTRY_MAIN_PROJECT}") option(SENTRY_BUILD_BENCHMARKS "Build sentry-native benchmarks" OFF) -option(SENTRY_ERROR_ON_WARNINGS "Treat warnings in sentry and sentry-crash as errors on GCC and Clang" OFF) +option(SENTRY_ERROR_ON_WARNINGS "Treat warnings in sentry-native as errors" OFF) option(SENTRY_INTEGRATION_PLATFORM "Enable the downstream-provided platform integration" OFF) @@ -597,6 +597,9 @@ if(MSVC) else() target_compile_options(sentry PRIVATE $) endif() + if(SENTRY_ERROR_ON_WARNINGS) + target_compile_options(sentry PRIVATE $) + endif() # ignore all warnings for mpack set_source_files_properties( "${PROJECT_SOURCE_DIR}/src/sentry_mpack.c" @@ -612,7 +615,7 @@ if(MSVC) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang-cl target_compile_options(sentry PRIVATE - $ + $ $ $ $ @@ -629,7 +632,13 @@ if(MSVC) $ $ $ + $ + $ ) + # older versions reject the unknown option under -Werror + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21) + target_compile_options(sentry PRIVATE $) + endif() endif() else() target_compile_options(sentry PRIVATE $) @@ -796,6 +805,18 @@ if(SENTRY_BACKEND_CRASHPAD) endif() add_subdirectory(external/crashpad crashpad_build) + if(SENTRY_ERROR_ON_WARNINGS) + if(MSVC) + target_compile_options(crashpad_interface INTERFACE + $<$:/WX> + ) + else() + target_compile_options(crashpad_interface INTERFACE + $<$:-Werror> + ) + endif() + endif() + if(WIN32) add_dependencies(sentry crashpad::wer) endif() @@ -991,10 +1012,8 @@ elseif(SENTRY_BACKEND_NATIVE) endif() # Copy warning options from sentry target - if(NOT MSVC) - get_target_property(SENTRY_COMPILE_OPTIONS sentry COMPILE_OPTIONS) - target_compile_options(sentry-crash PRIVATE ${SENTRY_COMPILE_OPTIONS}) - endif() + get_target_property(SENTRY_COMPILE_OPTIONS sentry COMPILE_OPTIONS) + target_compile_options(sentry-crash PRIVATE ${SENTRY_COMPILE_OPTIONS}) # Copy include directories from sentry target target_include_directories(sentry-crash PRIVATE diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 74e7c83c5b..2f26ff5476 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -188,6 +188,18 @@ if(WIN32) endif() endif() +if(MSVC) + target_compile_options(breakpad_client PRIVATE /W3) + if(SENTRY_ERROR_ON_WARNINGS) + target_compile_options(breakpad_client PRIVATE /WX) + endif() +else() + target_compile_options(breakpad_client PRIVATE -Wall) + if(SENTRY_ERROR_ON_WARNINGS) + target_compile_options(breakpad_client PRIVATE -Werror) + endif() +endif() + # breakpad has includes directly to `third_party/lss/...`, # which are being resolved correctly when we add the current directory to # the include directories. A giant hack, yes, but it works diff --git a/external/breakpad b/external/breakpad index 25b6b727af..881d74bcc6 160000 --- a/external/breakpad +++ b/external/breakpad @@ -1 +1 @@ -Subproject commit 25b6b727af49fa383161e7dba4a82ab0661b69b8 +Subproject commit 881d74bcc64ef36dc879245609139fc0e3cbd97b diff --git a/external/crashpad b/external/crashpad index 702c3d5a0d..bc334efe17 160000 --- a/external/crashpad +++ b/external/crashpad @@ -1 +1 @@ -Subproject commit 702c3d5a0d02c9b72a8b029d33bdfcd81dc75f65 +Subproject commit bc334efe17f07a56e3219a0261d2862d280d4d34 diff --git a/tests/cmake.py b/tests/cmake.py index bb45b4779a..aa0a0b1d2a 100644 --- a/tests/cmake.py +++ b/tests/cmake.py @@ -362,7 +362,6 @@ def cmake_build(cwd, targets, options): def configure_clang_cl(config_cmd: list[str]): - config_cmd.append("-G Visual Studio 17 2022") config_cmd.append("-A x64") config_cmd.append("-T ClangCL")