feature add sentry for catch crash on win (#50)

* feature add sentry for soft catch dmp

* feature add cli upload pdb to sentry server

* feature add flag for control sentry to use

* fix  flag not effect on src/makefile

* feature unzip for dmp file to upload sentry server

* feature remove test code

* feature add api for function report log to server

* feature update the soft version
This commit is contained in:
Alves
2025-12-05 09:19:32 +08:00
committed by GitHub
parent b28f1f2de4
commit b0b7890c9e
17 changed files with 599 additions and 159 deletions

15
deps/CMakeLists.txt vendored
View File

@@ -62,6 +62,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF)
endif()
# Sentry crash reporting - enabled only on Windows by default
if (WIN32)
set(SLIC3R_SENTRY_DEFAULT ON)
else()
set(SLIC3R_SENTRY_DEFAULT OFF)
endif()
option(SLIC3R_SENTRY "Enable Sentry crash reporting SDK" ${SLIC3R_SENTRY_DEFAULT})
set(IS_CROSS_COMPILE FALSE)
if (APPLE)
@@ -314,6 +322,12 @@ if (NOT OPENSSL_FOUND OR NOT CURL_FOUND)
set(CURL_PKG dep_CURL)
endif ()
set(SENTRY_PKG "")
if (SLIC3R_SENTRY AND NOT SENTRY_FOUND)
include(Sentry/Sentry.cmake)
set(SENTRY_PKG dep_Sentry)
endif()
set(JPEG_PKG "")
if (NOT JPEG_FOUND)
include(JPEG/JPEG.cmake)
@@ -355,6 +369,7 @@ set(_dep_list
dep_TBB
${OPENSSL_PKG}
${CURL_PKG}
${SENTRY_PKG}
${WXWIDGETS_PKG}
dep_Cereal
dep_NLopt

63
deps/Sentry/Sentry.cmake vendored Normal file
View File

@@ -0,0 +1,63 @@
set(_sentry_platform_flags
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DSENTRY_BUILD_TESTS=OFF
-DSENTRY_EXAMPLES=OFF
-DSENTRY_CRASHPAD_BACKEND=ON
-DSENTRY_ENABLE_INSTALL=ON
)
# Platform-specific CMake generator and flags
set(_sentry_cmake_generator "")
set(_sentry_build_config "Release")
if (WIN32)
# Windows: build shared libs so we get sentry.dll
set(_sentry_platform_flags ${_sentry_platform_flags}
-DSENTRY_TRANSPORT_WINHTTP=ON
-DSENTRY_BUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=/Zi /O2
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/Zi /O2
-DCMAKE_EXE_LINKER_FLAGS:STRING=/DEBUG
-DCMAKE_SHARED_LINKER_FLAGS:STRING=/DEBUG
)
if (MSVC)
set(_sentry_cmake_generator -G "Visual Studio 17 2022")
endif()
elseif (APPLE)
# macOS: Use Unix Makefiles (install will put libs in ${DESTDIR}/bin or lib)
set(_sentry_platform_flags
${_sentry_platform_flags}
-DSENTRY_TRANSPORT_CURL=ON
-DSENTRY_BUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_C_FLAGS:STRING=-g -O2
-DCMAKE_CXX_FLAGS:STRING=-g -O2
)
set(_sentry_cmake_generator -G "Unix Makefiles")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Linux: Use Unix Makefiles
set(_sentry_platform_flags
${_sentry_platform_flags}
-DSENTRY_TRANSPORT_CURL=ON
-DSENTRY_BUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_C_FLAGS:STRING=-g -O2
-DCMAKE_CXX_FLAGS:STRING=-g -O2
)
set(_sentry_cmake_generator -G "Unix Makefiles")
endif ()
Snapmaker_Orca_add_cmake_project(Sentry
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
GIT_TAG 0.12.1
PATCH_COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive && ${CMAKE_COMMAND} -S external/crashpad -B external/crashpad/build ${_sentry_cmake_generator} -DCMAKE_BUILD_TYPE=Release && ${CMAKE_COMMAND} --build external/crashpad/build --config Release
CMAKE_ARGS
${_sentry_cmake_generator}
-DCMAKE_INSTALL_DATADIR:STRING=share
${_sentry_platform_flags}
)
if (MSVC)
add_debug_dep(dep_Sentry)
endif ()