diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1cd54d54db39245dcdcadb4916229bc74123b28..2a787188cd26d9712a7f137c1a8f24357d8978b6 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index c64887a8c340073b7fdeba068e170e878a8f90bf..ece7130fba11e7d6ccf33275cade528c9e396137 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 81cc8514aa70e23605867c8369646e4d16d647cf..b18d59bf96a80c7f31019f5292752af713de0e8a 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 e7e68327b28a2347685a3a242fdc58db3fc27abd..064dd8e0dbb228cf661c37ca21c70ca1c418b756 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 6e620d538e88be76fb5aa0c52863e0a624ffa230..258a29c347c65d657cb115a663fc30410aab6e09 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")