From 66f7d4ccb71a20e62a4877e1fc34d8a8436f63d7 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Tue, 25 Mar 2025 14:57:38 +0100 Subject: [PATCH 1/2] Add CMake option to generate PDB debug infos --- CMakeLists.txt | 6 ++++++ CMakeScripts/DefineDependsandFlags.cmake | 5 +++++ CMakeScripts/Dist.cmake | 9 +++++++-- src/CMakeLists.txt | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c64887a8c3..ece7130fba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,9 @@ option(WITH_LPETOOL "Compile with LPE Tool" OFF) option(LPE_ENABLE_TEST_EFFECTS "Compile with test experimental LPEs enabled" OFF) option(WITH_PROFILING "Turn on profiling" OFF) # Set to true if compiler/linker should enable profiling option(BUILD_SHARED_LIBS "Compile libraries as shared and not static" ON) +if (WIN32) + option(ENABLE_PDB "Generate debug symbols in PDB format (Windows only)" OFF) +endif() option(WITH_POPPLER "Compile with support of libpoppler" ON) option(ENABLE_POPPLER_CAIRO "Compile with support of libpoppler-cairo for rendering PDF preview (depends on WITH_POPPLER)" ON) @@ -286,6 +289,9 @@ message("WITH_X11: ${WITH_X11}") message("WITH_PROFILING: ${WITH_PROFILING}") message("BUILD_TESTING: ${BUILD_TESTING}") +if(WIN32) +message("ENABLE_PDB: ${ENABLE_PDB}") +endif() if(WIN32) message("") diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 81cc8514aa..b18d59bf96 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -56,6 +56,11 @@ if (CMAKE_COMPILER_IS_GNUCC) list(APPEND INKSCAPE_CXX_FLAGS_DEBUG "-fstack-clash-protection -fcf-protection") endif() endif() +if (WIN32 AND ENABLE_PDB) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gcodeview") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gcodeview") + add_link_options(-Wl,--pdb=) +endif() # Define the flags for profiling if desired: if(WITH_PROFILING) diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index e7e68327b2..064dd8e0db 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -60,8 +60,13 @@ if(WIN32) "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" "${CMAKE_INSTALL_PREFIX}") - add_dependencies(dist-win-7z install/strip) - add_dependencies(dist-win-7z-fast install/strip) + if(CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") + add_dependencies(dist-win-7z install) + add_dependencies(dist-win-7z-fast install) + else() + add_dependencies(dist-win-7z install/strip) + add_dependencies(dist-win-7z-fast install/strip) + endif() # ----------------------------------------------------------------------------- # 'dist-win-exe' - generate .exe installer (NSIS) for Windows diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e620d538e..258a29c347 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -442,6 +442,11 @@ install(TARGETS inkscape inkview RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(WIN32) install(TARGETS inkscape_com) install(TARGETS inkview_com) + if (ENABLE_PDB) + file(GLOB PDBS + ${CMAKE_BINARY_DIR}/bin/*.pdb) + install(FILES ${PDBS} DESTINATION bin) + endif() endif() if(BUILD_SHARED_LIBS) install(TARGETS inkscape_base LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/inkscape") -- GitLab From 9f861f50e03edf31977c336bcd88224938bf75a7 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Tue, 25 Mar 2025 14:58:26 +0100 Subject: [PATCH 2/2] CI: Add windows-pdb job Manual CI job that builds Inkscape with PDB debug infos --- .gitlab-ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1cd54d54d..2a787188cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -209,6 +209,34 @@ inkscape:windows: paths: - build/inkscape*.${DIST} +inkscape:windows-pdb: + extends: .windows + timeout: 3h + retry: 2 + when: manual + script: + # configure with CMake + - . "C:/$Env:IDW_NAME/msys2_shell.cmd" -defterm -no-start -ucrt64 -here -c ` + "cmake -B build -G Ninja ` + -DCMAKE_C_COMPILER_LAUNCHER=ccache ` + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DENABLE_PDB=ON" + # Kill the job before hitting runner's timeout. This way we can preserve the cache so the next retry + # will be able to advance the build further and eventually finish (after up to two retries, 3 jobs in total). + # Calculation is: 20 minutes for download and extraction of msys2 + # 80 minutes build (4800 seconds, see 'sleep' below) + # 20 minutes as buffer and save cache + # --- -------------------------------- + # 120 minutes runner timeout + - Start-Job -ScriptBlock{sleep 4800; taskkill /t /F /IM "ninja.exe"} + # build with Ninja + - . "C:/$Env:IDW_NAME/msys2_shell.cmd" -defterm -no-start -ucrt64 -here -c ` + "ninja -C build dist-win-7z" + artifacts: + paths: + - build/inkscape*.7z + #tests, always run after building test:linux: stage: test -- GitLab