Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 25 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -597,6 +597,9 @@ if(MSVC)
else()
target_compile_options(sentry PRIVATE $<BUILD_INTERFACE:/W4 /wd5105>)
endif()
if(SENTRY_ERROR_ON_WARNINGS)
target_compile_options(sentry PRIVATE $<BUILD_INTERFACE:/WX>)
endif()
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
# ignore all warnings for mpack
set_source_files_properties(
"${PROJECT_SOURCE_DIR}/src/sentry_mpack.c"
Expand All @@ -612,7 +615,7 @@ if(MSVC)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang-cl
target_compile_options(sentry PRIVATE
$<BUILD_INTERFACE:-Werror -Wall>
$<BUILD_INTERFACE:-Wall>
$<BUILD_INTERFACE:-Wno-unsafe-buffer-usage>
$<BUILD_INTERFACE:-Wno-nonportable-system-include-path>
$<BUILD_INTERFACE:-Wno-declaration-after-statement>
Expand All @@ -629,7 +632,13 @@ if(MSVC)
$<BUILD_INTERFACE:-Wno-reserved-identifier>
$<BUILD_INTERFACE:-Wno-old-style-cast>
$<BUILD_INTERFACE:-Wno-zero-as-null-pointer-constant>
$<BUILD_INTERFACE:-Wno-c++-compat>
$<BUILD_INTERFACE:-Wno-padded>
)
# older versions reject the unknown option under -Werror
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21)
target_compile_options(sentry PRIVATE $<BUILD_INTERFACE:-Wno-nrvo>)
endif()
endif()
else()
target_compile_options(sentry PRIVATE $<BUILD_INTERFACE:-Wall -Wextra -Wpedantic>)
Expand Down Expand Up @@ -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
$<$<COMPILE_LANGUAGE:C,CXX>:/WX>
)
else()
target_compile_options(crashpad_interface INTERFACE
$<$<COMPILE_LANGUAGE:C,CXX>:-Werror>
)
endif()
endif()

if(WIN32)
add_dependencies(sentry crashpad::wer)
endif()
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Loading