From e42b5c2cbf58c7c38d89f4976fdf8e41227a74f7 Mon Sep 17 00:00:00 2001
From: Eidolon <furyhunter600@gmail.com>
Date: Thu, 16 May 2024 15:42:04 -0500
Subject: [PATCH] Always make debuglink .debug in CI

---
 .gitlab/ci/jobs/windows-x86.yml | 3 ++-
 CMakeLists.txt                  | 1 +
 src/CMakeLists.txt              | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitlab/ci/jobs/windows-x86.yml b/.gitlab/ci/jobs/windows-x86.yml
index 603549ce39..f0cf653e34 100644
--- a/.gitlab/ci/jobs/windows-x86.yml
+++ b/.gitlab/ci/jobs/windows-x86.yml
@@ -92,7 +92,8 @@ Windows x86:
             -DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE \
             -DCMAKE_C_COMPILER=/usr/bin/i686-w64-mingw32-gcc-posix \
             -DCMAKE_CXX_COMPILER=/usr/bin/i686-w64-mingw32-g++-posix \
-            -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake
+            -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake \
+            -DSRB2_CONFIG_ALWAYS_MAKE_DEBUGLINK=ON
 
       - |
           # cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 885b5caac5..1f852c981d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,7 @@ option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF
 option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
 option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF)
 option(SRB2_CONFIG_DEV_BUILD "Compile a development build." OFF)
+option(SRB2_CONFIG_ALWAYS_MAKE_DEBUGLINK "Always make a debuglink .debug." OFF)
 option(SRB2_CONFIG_TESTERS "Compile a build for testers." OFF)
 option(SRB2_CONFIG_MOBJCONSISTANCY "Compile with MOBJCONSISTANCY defined." OFF)
 option(SRB2_CONFIG_PACKETDROP "Compile with PACKETDROP defined." OFF)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 52f1b16301..af64bb0bcc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -611,7 +611,7 @@ add_subdirectory(modp_b64)
 # strip debug symbols into separate file when using gcc.
 # to be consistent with Makefile, don't generate for OS X.
 if((CMAKE_COMPILER_IS_GNUCC) AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin))
-	if(${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo)
+	if(${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo OR SRB2_CONFIG_ALWAYS_MAKE_DEBUGLINK)
 		message(STATUS "Will make separate debug symbols in *.debug")
 		add_custom_command(TARGET SRB2SDL2 POST_BUILD
 			COMMAND ${OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
-- 
GitLab