diff --git a/.github/workflows/sentry_cli.yml b/.github/workflows/sentry_cli.yml index 976ca96f78..0693fab2a0 100644 --- a/.github/workflows/sentry_cli.yml +++ b/.github/workflows/sentry_cli.yml @@ -35,18 +35,53 @@ jobs: name: ${{ inputs.pdb-artifact-name }} path: ./symbols + - name: "[Windows] Extract PDB archive" + if: inputs.os == 'windows-latest' + shell: pwsh + run: | + $archive = Get-ChildItem -Path ./symbols -Filter "*.7z" -File | Select-Object -First 1 + if ($archive) { + Write-Host "Found archive: $($archive.FullName)" + Write-Host "Extracting to ./symbols/extracted ..." + 7z x "$($archive.FullName)" -o"./symbols/extracted" -y + if ($LASTEXITCODE -ne 0) { + Write-Host "::error::Failed to extract archive with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } + Write-Host "Extraction complete. Contents:" + Get-ChildItem -Path ./symbols/extracted -Recurse | ForEach-Object { Write-Host " $($_.FullName)" } + } else { + Write-Host "No .7z archive found, assuming PDB files are already extracted" + Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" } + } + - name: "[Windows] Upload PDB to Sentry (sentry-cli)" if: inputs.os == 'windows-latest' shell: pwsh env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_LOG_LEVEL: debug run: | - $pdbArchive = Get-ChildItem -Path ./symbols -Filter "*.7z" -File | Select-Object -First 1 - if ($pdbArchive) { - Write-Host "Uploading PDB archive: $($pdbArchive.FullName)" - sentry-cli.exe --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" "$($pdbArchive.FullName)" 2>&1 | Out-Host + # Determine upload path - prefer extracted folder if it exists + $uploadPath = "./symbols" + if (Test-Path "./symbols/extracted") { + $uploadPath = "./symbols/extracted" + } + + $pdbFiles = Get-ChildItem -Path $uploadPath -Filter "*.pdb" -File -Recurse + if ($pdbFiles.Count -gt 0) { + Write-Host "Found $($pdbFiles.Count) PDB file(s) to upload from $uploadPath :" + $pdbFiles | ForEach-Object { Write-Host " - $($_.FullName)" } + Write-Host "" + Write-Host "Starting Sentry upload with debug logging..." + sentry-cli.exe --log-level=debug --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" $uploadPath 2>&1 | Out-Host + if ($LASTEXITCODE -ne 0) { + Write-Host "::error::Sentry upload failed with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } } else { - Write-Host "No PDB archive found in symbols folder" + Write-Host "::error::No PDB files found in $uploadPath" + Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" } exit 1 } diff --git a/CMakeLists.txt b/CMakeLists.txt index ceb5ba3ab6..13642a8cb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,14 @@ option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0) option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0) -option(SLIC3R_SENTRY "Enable Sentry crash reporting" 1) + +# 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}) # If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable. CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0) @@ -535,7 +542,9 @@ find_package(TBB REQUIRED) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) -find_package(Sentry REQUIRED) +if (SLIC3R_SENTRY) + find_package(Sentry REQUIRED) +endif() find_package(Freetype REQUIRED) @@ -545,19 +554,21 @@ target_link_libraries(libcurl INTERFACE CURL::libcurl) find_package(ZLIB REQUIRED) target_link_libraries(libcurl INTERFACE ZLIB::ZLIB) -add_library(sentry INTERFACE) -target_link_libraries(sentry INTERFACE sentry::sentry) +if (SLIC3R_SENTRY) + add_library(sentry INTERFACE) + target_link_libraries(sentry INTERFACE sentry::sentry) -# Add sentry library directory and link sentry.lib explicitly for Windows -if (WIN32 AND CMAKE_PREFIX_PATH) - # Try to find sentry.lib in the install prefix - file(GLOB _sentry_lib "${CMAKE_PREFIX_PATH}/lib/sentry.lib") - if (_sentry_lib) - target_link_directories(sentry INTERFACE "${CMAKE_PREFIX_PATH}/lib") - target_link_libraries(sentry INTERFACE "sentry.lib") - message(STATUS "Found sentry.lib at: ${CMAKE_PREFIX_PATH}/lib") - else() - message(WARNING "sentry.lib not found in ${CMAKE_PREFIX_PATH}/lib. Sentry SDK may not have been built yet.") + # Add sentry library directory and link sentry.lib explicitly for Windows + if (WIN32 AND CMAKE_PREFIX_PATH) + # Try to find sentry.lib in the install prefix + file(GLOB _sentry_lib "${CMAKE_PREFIX_PATH}/lib/sentry.lib") + if (_sentry_lib) + target_link_directories(sentry INTERFACE "${CMAKE_PREFIX_PATH}/lib") + target_link_libraries(sentry INTERFACE "sentry.lib") + message(STATUS "Found sentry.lib at: ${CMAKE_PREFIX_PATH}/lib") + else() + message(WARNING "sentry.lib not found in ${CMAKE_PREFIX_PATH}/lib. Sentry SDK may not have been built yet.") + endif() endif() endif() @@ -746,7 +757,7 @@ function(Snapmaker_Orca_copy_dlls target config postfix output_dlls) DESTINATION ${_out_dir}) # Copy Sentry and Crashpad artifacts if they were built by deps - if (EXISTS "${CMAKE_PREFIX_PATH}/bin/sentry.dll") + if (SLIC3R_SENTRY AND EXISTS "${CMAKE_PREFIX_PATH}/bin/sentry.dll") file(COPY "${CMAKE_PREFIX_PATH}/bin/sentry.dll" "${CMAKE_PREFIX_PATH}/bin/crashpad_handler.exe" DESTINATION ${_out_dir} @@ -815,12 +826,20 @@ function(Snapmaker_Orca_copy_dlls target config postfix output_dlls) ${_out_dir}/TKXSBase.dll ${_out_dir}/freetype.dll - ${_out_dir}/sentry.dll - ${_out_dir}/crashpad_handler.exe PARENT_SCOPE ) + # Add Sentry DLLs to the output list if Sentry is enabled + if (SLIC3R_SENTRY) + set(${output_dlls} + ${${output_dlls}} + ${_out_dir}/sentry.dll + ${_out_dir}/crashpad_handler.exe + PARENT_SCOPE + ) + endif() + endfunction() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 89e22ee5e4..de9fae0bc5 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -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) @@ -315,7 +323,7 @@ if (NOT OPENSSL_FOUND OR NOT CURL_FOUND) endif () set(SENTRY_PKG "") -if (NOT SENTRY_FOUND) +if (SLIC3R_SENTRY AND NOT SENTRY_FOUND) include(Sentry/Sentry.cmake) set(SENTRY_PKG dep_Sentry) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1e137b4e5..ca9e209e0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -189,8 +189,11 @@ if (WIN32) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE) add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca) set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca") - target_include_directories(Snapmaker_Orca_app_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry) + if (SLIC3R_SENTRY) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry) + else() + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly) + endif() if (SLIC3R_SENTRY) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE SLIC3R_SENTRY) endif() diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index e6accab238..9f6da051dd 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1021,11 +1021,6 @@ PreferencesDialog::PreferencesDialog(wxWindow *parent, wxWindowID id, const wxSt : DPIDialog(parent, id, _L("Preferences"), pos, size, style) { SetBackgroundColour(*wxWHITE); - - wxPanel* pPanel = new wxPanel(nullptr); - delete pPanel; - delete pPanel; - create(); wxGetApp().UpdateDlgDarkUI(this); Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) {