diff --git a/build/windows/gitlab-ci/3_bundle-gimp-uni_base.sh b/build/windows/gitlab-ci/3_bundle-gimp-uni_base.sh index 901190a095..853dffe655 100644 --- a/build/windows/gitlab-ci/3_bundle-gimp-uni_base.sh +++ b/build/windows/gitlab-ci/3_bundle-gimp-uni_base.sh @@ -139,6 +139,13 @@ for exe in "${binArray[@]}"; do cp -fr $exe ${GIMP_DISTRIB}/bin/ done +### .pdb (CodeView) debug symbols +### TODO: REMOVE 'if [[ "$MSYSTEM...' WHEN GCC 14 IS ON MSYS2 +### crossroad don't have LLVM/Clang backend yet +if [[ "$MSYSTEM_CARCH" != "i686" ]] && [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then + cp -fr ${GIMP_PREFIX}/bin/*.pdb ${GIMP_DISTRIB}/bin/ +fi + ## Optional executables, .DLLs and resources for GObject Introspection support if [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then cp -fr ${MSYS_PREFIX}/bin/libgirepository-*.dll ${GIMP_DISTRIB}/bin/ diff --git a/meson.build b/meson.build index a53e57f197..87bdca5550 100644 --- a/meson.build +++ b/meson.build @@ -289,6 +289,13 @@ if platform_windows and cc.get_id() == 'gcc' compiler_args += msvc_compat_args endif +# Generate .pdb (CodeView) debug symbols (makes possible to debug with DIA SDK) +pdb_support = cc.has_argument('-gcodeview') and cc.has_link_argument('-Wl,--pdb=') +if platform_windows and pdb_support + compiler_args += '-gcodeview' + linker_args += '-Wl,--pdb=' +endif + conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT', cc.compiles(''' @@ -2017,7 +2024,14 @@ pkgconfig.generate(libgimpui, ], ) - +################################################################################ +# Install native debug data (.pdb) on Windows +# Ideally meson should take care of it automatically. +# See: https://github.com/mesonbuild/meson/issues/12977 +if platform_windows and pdb_support + install_win_debug_script = find_program('./meson_install_win_debug.sh') + meson.add_install_script(install_win_debug_script) +endif ################################################################################ # Subdir installations diff --git a/meson_install_win_debug.sh b/meson_install_win_debug.sh new file mode 100644 index 0000000000..5d09524bc6 --- /dev/null +++ b/meson_install_win_debug.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +find . \( -iname '*.dll' -or -iname '*.exe' \) | \ +while IFS= read -r build_bin; +do + build_bin_name="${build_bin##*/}" + installed_bin=$(find ${MESON_INSTALL_DESTDIR_PREFIX} -iname "$build_bin_name") + if [ x"$installed_bin" != "x" ]; then + install_dir=$(dirname ${installed_bin}) + pdb_debug=$(echo $build_bin|sed 's/\.\(dll\|exe\)$/.pdb/') + if [ -f "$pdb_debug" ]; then + # Note: meson hides script outputs anyway on success. But this can be + # useful when debugging. + echo Installing $pdb_debug to $install_dir + if [ -z "$MESON_INSTALL_DRY_RUN" ]; then + cp -f $pdb_debug $install_dir + fi + fi + fi +done;