From ae03f213b0ac7b70248a1951fc253020e8b055c8 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 21 Dec 2024 08:20:15 -0800 Subject: [PATCH 1/9] generate pdb files for windows builds so we can retrieve them when debugging player-reported crashes --- CMakeLists.txt | 3 ++- build/build-win64-from-linux.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d09cf448b..27624d2cc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,10 +267,11 @@ if(UNIX) set(CMAKE_INSTALL_RPATH ${DFHACK_LIBRARY_DESTINATION}) elseif(MSVC) # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP /Z7") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od") string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") endif() # use shared libraries for protobuf diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 0fdc3bb756..0b774d014a 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -13,6 +13,7 @@ builder_uid=$(id -u) mkdir -p win64-cross mkdir -p win64-cross/output +mkdir -p win64-cross/pdb mkdir -p win64-cross/ccache # Check for sudo; we want to use the real user @@ -43,7 +44,7 @@ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/b -e steam_password \ --name dfhack-win \ ghcr.io/dfhack/build-env:master \ - bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install" \ + bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && echo 'finding pdb files' && find . && find . -iname '*.pdb' -exec cp --parents '{}' win64-cross/pdb/ \; && echo 'all done'" \ ; then echo echo "Build failed" From fd0f5b705088aa4b7c01e8b2ceb4ba84b004c4f4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 12:38:23 -0800 Subject: [PATCH 2/9] upload pdb files as an artifact --- .github/workflows/build-windows.yml | 9 +++++++++ .github/workflows/package.yml | 1 + build/build-win64-from-linux.sh | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 24306b72f9..212952deb3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -56,6 +56,9 @@ on: launchdf: type: boolean default: false + save-pdb: + type: boolean + default: false jobs: @@ -145,3 +148,9 @@ jobs: with: name: ${{ steps.artifactname.outputs.name }} path: ${{ steps.artifactname.outputs.name }}.tar.bz2 + - name: Upload PDBs + if: inputs.artifact-name && inputs.save-pdb + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifactname.outputs.name }}_pdb + path: build/win64-cross/pdb diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 41e72ea636..e1c478e395 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -52,6 +52,7 @@ jobs: docs: true html: false launchdf: ${{ inputs.launchdf }} + save-pdb: true secrets: inherit package-linux: diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 0b774d014a..5dd187892f 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -44,7 +44,7 @@ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/b -e steam_password \ --name dfhack-win \ ghcr.io/dfhack/build-env:master \ - bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && echo 'finding pdb files' && find . && find . -iname '*.pdb' -exec cp --parents '{}' win64-cross/pdb/ \; && echo 'all done'" \ + bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && find . -iname '*.pdb' -exec cp --parents '{}' pdb/ \;" \ ; then echo echo "Build failed" From 8e682977c0ddf92673540211fe52d7da61f5c1e8 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 12:46:51 -0800 Subject: [PATCH 3/9] increase compiler cache size to accomodate larger debug artifacts --- .github/workflows/build-windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 212952deb3..76bf19e87b 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -118,9 +118,9 @@ jobs: run: | cd build ccache -d win64-cross/ccache --show-stats --verbose - ccache -d win64-cross/ccache --max-size 150M - ccache -d win64-cross/ccache --cleanup ccache -d win64-cross/ccache --max-size 500M + ccache -d win64-cross/ccache --cleanup + ccache -d win64-cross/ccache --max-size 2G ccache -d win64-cross/ccache --zero-stats - name: Save ccache if: inputs.platform-files && !inputs.cache-readonly From a0595444644367aaac82ac791e79440ed28c126a Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 12:57:40 -0800 Subject: [PATCH 4/9] also produce symbols for Steam deployments --- .github/workflows/steam-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/steam-deploy.yml b/.github/workflows/steam-deploy.yml index 28d4ee9471..9e50b7deb4 100644 --- a/.github/workflows/steam-deploy.yml +++ b/.github/workflows/steam-deploy.yml @@ -40,6 +40,7 @@ jobs: common-files: false stonesense: true launchdf: true + save-pdb: true secrets: inherit depot-linux64: From 9608154e91f0598a62d4942708215a714c86373d Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 13:12:06 -0800 Subject: [PATCH 5/9] also produce pdbs for plugins --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27624d2cc7..9f2f077f26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,7 @@ elseif(MSVC) string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /DEBUG") endif() # use shared libraries for protobuf From b0d0c7f1d80e6ec2a9a7fe36906125ca5a19bb6c Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 13:12:24 -0800 Subject: [PATCH 6/9] only search known build dirs for pdbs in particular, don't double-find pdbs that have already been copied into the pdb directory --- build/build-win64-from-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 5dd187892f..8474346c7e 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -44,7 +44,7 @@ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/b -e steam_password \ --name dfhack-win \ ghcr.io/dfhack/build-env:master \ - bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && find . -iname '*.pdb' -exec cp --parents '{}' pdb/ \;" \ + bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && find depends library plugins -iname '*.pdb' -exec cp --parents '{}' pdb/ \;" \ ; then echo echo "Build failed" From 0ebd92b3fce285cb01a4e7f4304aaa15d4f121e4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 15:39:38 -0800 Subject: [PATCH 7/9] flatten pdb tree --- build/build-win64-from-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 8474346c7e..7f878ef1c6 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -44,7 +44,7 @@ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/b -e steam_password \ --name dfhack-win \ ghcr.io/dfhack/build-env:master \ - bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && find depends library plugins -iname '*.pdb' -exec cp --parents '{}' pdb/ \;" \ + bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install && find depends library plugins -iname '*.pdb' -exec cp '{}' pdb/ \;" \ ; then echo echo "Build failed" From 968af71c49ec8d71fe2af1cc22bcdcb3574cc8a8 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 23 Dec 2024 16:11:13 -0800 Subject: [PATCH 8/9] write build url to stderr and status file --- .github/workflows/build-linux.yml | 1 + .github/workflows/build-windows.yml | 2 +- library/CMakeLists.txt | 1 + library/Core.cpp | 7 +++++-- library/DFHackVersion.cpp | 4 ++++ library/include/DFHackVersion.h | 2 ++ library/modules/Persistence.cpp | 20 +++++++++++++++++++- 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 3d3f6f7c6f..c7fcdccef3 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -135,6 +135,7 @@ jobs: -G Ninja \ -DCMAKE_INSTALL_PREFIX=build/image \ -DCMAKE_BUILD_TYPE=Release \ + -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' \ ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=ccache' || '' }} \ ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \ -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 76bf19e87b..4c2120eab0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -110,7 +110,7 @@ jobs: win-msvc - name: Cross-compile env: - CMAKE_EXTRA_ARGS: -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }} + CMAKE_EXTRA_ARGS: -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }} run: | cd build bash -x build-win64-from-linux.sh diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index c43772af58..df64de3bd7 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -346,6 +346,7 @@ set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS DF_VERSION="${DF_VERSION}" DFHACK_RELEASE="${DFHACK_RELEASE}" DFHACK_ABI_VERSION=${DFHACK_ABI_VERSION} + DFHACK_RUN_URL="${DFHACK_RUN_URL}" ) if(DFHACK_PRERELEASE) set_property(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS diff --git a/library/Core.cpp b/library/Core.cpp index 22c6139b13..951fb62f3a 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1547,8 +1547,11 @@ bool Core::InitMainThread() { if (!freopen("stderr.log", "w", stderr)) std::cerr << "Could not redirect stderr to stderr.log" << std::endl; - std::cerr << "DFHack build: " << Version::git_description() << "\n" - << "Starting with working directory: " << Filesystem::getcwd() << std::endl; + std::cerr << "DFHack build: " << Version::git_description() << std::endl; + if (strlen(Version::dfhack_run_url())) { + std::cerr << "Build url: " << Version::dfhack_run_url() << std::endl; + } + std::cerr << "Starting with working directory: " << Filesystem::getcwd() << std::endl; std::cerr << "Binding to SDL.\n"; if (!DFSDL::init(con)) { diff --git a/library/DFHackVersion.cpp b/library/DFHackVersion.cpp index 42aac251ee..4fb8883432 100644 --- a/library/DFHackVersion.cpp +++ b/library/DFHackVersion.cpp @@ -25,6 +25,10 @@ namespace DFHack { { return DFHACK_BUILD_ID; } + const char *dfhack_run_url() + { + return DFHACK_RUN_URL; + } const char *git_description() { return DFHACK_GIT_DESCRIPTION; diff --git a/library/include/DFHackVersion.h b/library/include/DFHackVersion.h index fbf2539bf9..f4ab705e0c 100644 --- a/library/include/DFHackVersion.h +++ b/library/include/DFHackVersion.h @@ -5,6 +5,7 @@ namespace DFHack { const char *dfhack_version(); const char *dfhack_release(); const char *dfhack_build_id(); + const char *dfhack_run_url(); int dfhack_abi_version(); const char *git_description(); @@ -23,6 +24,7 @@ namespace DFHack { #define DFHACK_VERSION (DFHack::Version::dfhack_version()) #define DFHACK_RELEASE (DFHack::Version::dfhack_release()) #define DFHACK_BUILD_ID (DFHack::Version::dfhack_build_id()) + #define DFHACK_RUN_URL (DFHack::Version::dfhack_run_url()) #define DFHACK_ABI_VERSION (DFHack::Version::dfhack_abi_version()) #define DFHACK_GIT_DESCRIPTION (DFHack::Version::git_description()) diff --git a/library/modules/Persistence.cpp b/library/modules/Persistence.cpp index 54d2c1a9f2..6b5e494a6e 100644 --- a/library/modules/Persistence.cpp +++ b/library/modules/Persistence.cpp @@ -23,9 +23,11 @@ distribution. */ #include "Core.h" +#include "DFHackVersion.h" #include "Debug.h" #include "Internal.h" #include "LuaTools.h" +#include "MemAccess.h" #include "modules/Filesystem.h" #include "modules/Gui.h" @@ -186,11 +188,26 @@ static std::string getSaveFilePath(const std::string &world, const std::string & } void Persistence::Internal::save(color_ostream& out) { - if (!Core::getInstance().isWorldLoaded()) + Core &core = Core::getInstance(); + + if (!core.isWorldLoaded()) return; CoreSuspender suspend; + // write status + { + auto file = std::ofstream(getSaveFilePath("current", "status")); + file << "DF version: " << core.p->getDescriptor()->getVersion() << std::endl; + file << "DFHack version: " << Version::dfhack_version() << " (" << Version::git_commit(true) << ")" << std::endl; + file << "Tagged release: " << (Version::is_release() ? "yes" : "no") << std::endl; + file << "Pre-release: " << (Version::is_prerelease() ? "yes" : "no") << std::endl; + if (strlen(Version::dfhack_run_url())) { + file << "Build url: " << Version::dfhack_run_url() << std::endl; + } + } + + // write entity data for (auto & entity_store_entry : store) { int entity_id = entity_store_entry.first; Json::Value json(Json::arrayValue); @@ -205,6 +222,7 @@ void Persistence::Internal::save(color_ostream& out) { file << json; } + // write perf counters { auto file = std::ofstream(getSaveFilePath("current", "perf-counters")); color_ostream_wrapper wrapper(file); From 0376eba6c90cd903e98a5fe1248604a5d64fbdfe Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 24 Dec 2024 07:23:56 -0800 Subject: [PATCH 9/9] only build debug symbols for release builds --- .github/workflows/build-windows.yml | 11 ++++------- .github/workflows/package.yml | 1 - .github/workflows/steam-deploy.yml | 1 - CMakeLists.txt | 11 ++++++++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 4c2120eab0..b4e1e8b539 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -56,9 +56,6 @@ on: launchdf: type: boolean default: false - save-pdb: - type: boolean - default: false jobs: @@ -110,7 +107,7 @@ jobs: win-msvc - name: Cross-compile env: - CMAKE_EXTRA_ARGS: -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }} + CMAKE_EXTRA_ARGS: -DBUILD_PDBS:BOOL=${{ inputs.cache-id == 'release' }} -DDFHACK_RUN_URL='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' -DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files && inputs.plugins }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} ${{ inputs.xml-dump-type-sizes && '-DINSTALL_XMLDUMP:BOOL=1' || '' }} run: | cd build bash -x build-win64-from-linux.sh @@ -118,9 +115,9 @@ jobs: run: | cd build ccache -d win64-cross/ccache --show-stats --verbose - ccache -d win64-cross/ccache --max-size 500M + ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '500M' || '150M' }} ccache -d win64-cross/ccache --cleanup - ccache -d win64-cross/ccache --max-size 2G + ccache -d win64-cross/ccache --max-size ${{ inputs.cache-id == 'release' && '2G' || '500M' }} ccache -d win64-cross/ccache --zero-stats - name: Save ccache if: inputs.platform-files && !inputs.cache-readonly @@ -149,7 +146,7 @@ jobs: name: ${{ steps.artifactname.outputs.name }} path: ${{ steps.artifactname.outputs.name }}.tar.bz2 - name: Upload PDBs - if: inputs.artifact-name && inputs.save-pdb + if: inputs.artifact-name && inputs.cache-id == 'release' uses: actions/upload-artifact@v4 with: name: ${{ steps.artifactname.outputs.name }}_pdb diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e1c478e395..41e72ea636 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -52,7 +52,6 @@ jobs: docs: true html: false launchdf: ${{ inputs.launchdf }} - save-pdb: true secrets: inherit package-linux: diff --git a/.github/workflows/steam-deploy.yml b/.github/workflows/steam-deploy.yml index 9e50b7deb4..28d4ee9471 100644 --- a/.github/workflows/steam-deploy.yml +++ b/.github/workflows/steam-deploy.yml @@ -40,7 +40,6 @@ jobs: common-files: false stonesense: true launchdf: true - save-pdb: true secrets: inherit depot-linux64: diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f2f077f26..d340d5c8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,12 +267,17 @@ if(UNIX) set(CMAKE_INSTALL_RPATH ${DFHACK_LIBRARY_DESTINATION}) elseif(MSVC) # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP /Z7") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od") string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /DEBUG") + + option(BUILD_PDBS "Build PDB debug symbol files." OFF) + if(BUILD_PDBS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Z7") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /DEBUG") + endif() endif() # use shared libraries for protobuf