fix win pack lost dlls bug (#53)

* 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

* feature merge mac sentry to win platform.

* fix mac build error bug

* feature add sentry config for mac cmake

* fix packed the soft and not copy dlls question

* fix windows not copy library bug

* feature remove test code
This commit is contained in:
Alves
2025-12-09 10:24:15 +08:00
committed by GitHub
parent ccae13b98b
commit f32aa81f6a
7 changed files with 192 additions and 52 deletions

View File

@@ -2,7 +2,7 @@ set(_sentry_platform_flags
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DSENTRY_BUILD_TESTS=OFF
-DSENTRY_EXAMPLES=OFF
-DSENTRY_CRASHPAD_BACKEND=ON
-DSENTRY_BACKEND=crashpad
-DSENTRY_ENABLE_INSTALL=ON
)
@@ -25,16 +25,35 @@ if (WIN32)
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)
# macOS: build shared libs so we get libsentry.dylib
# Note: CURL transport requires OpenSSL, need to link it explicitly
# DESTDIR already contains /usr/local/ suffix, so use it directly
set(_sentry_platform_flags
${_sentry_platform_flags}
-DSENTRY_TRANSPORT_CURL=ON
-DSENTRY_BUILD_SHARED_LIBS=OFF
-DSENTRY_BUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_C_FLAGS:STRING=-g -O2
-DCMAKE_CXX_FLAGS:STRING=-g -O2
-DOPENSSL_ROOT_DIR:PATH=${DESTDIR}
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DCMAKE_SHARED_LINKER_FLAGS:STRING=-L${DESTDIR}/lib\ -lssl\ -lcrypto
)
set(_sentry_cmake_generator -G "Unix Makefiles")
# Sentry/crashpad requires macOS 12.0+ due to kIOMainPortDefault API usage
# Force minimum deployment target to 12.0 for Sentry build
set(_sentry_osx_deployment_target "12.0")
if (CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "12.0")
set(_sentry_osx_deployment_target ${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()
# Add macOS architecture and deployment target for sentry build
if (CMAKE_OSX_ARCHITECTURES)
set(_sentry_platform_flags ${_sentry_platform_flags} -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
endif()
set(_sentry_platform_flags ${_sentry_platform_flags} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${_sentry_osx_deployment_target})
if (CMAKE_OSX_SYSROOT)
set(_sentry_platform_flags ${_sentry_platform_flags} -DCMAKE_OSX_SYSROOT:STRING=${CMAKE_OSX_SYSROOT})
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Linux: Use Unix Makefiles
set(_sentry_platform_flags
@@ -42,22 +61,45 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-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 ()
if(WIN32)
set(SENTRY_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
)
elseif(APPLE)
set(SENTRY_PATCH_COMMAND
${GIT_EXECUTABLE} submodule update --init --recursive
)
else()
set(SENTRY_PATCH_COMMAND
${GIT_EXECUTABLE} submodule update --init --recursive
)
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
PATCH_COMMAND ${SENTRY_PATCH_COMMAND}
CMAKE_ARGS
${_sentry_cmake_generator}
-DCMAKE_INSTALL_DATADIR:STRING=share
${_sentry_platform_flags}
)
# Sentry depends on CURL which depends on OpenSSL
# Ensure they are built before Sentry
if(APPLE)
if (TARGET dep_CURL)
add_dependencies(dep_Sentry dep_CURL)
endif()
if (TARGET dep_OpenSSL)
add_dependencies(dep_Sentry dep_OpenSSL)
endif()
endif()
if (MSVC)
add_debug_dep(dep_Sentry)
endif ()