Skip to content

Commit fed1a43

Browse files
Derive MinGW GCC lib dir dynamically in WINEPATH (#90)
* Initial plan * Derive MinGW GCC lib dir dynamically instead of hard-coding version Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com> * Add RESULT_VARIABLE to MinGW GCC detection for better error handling Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com>
1 parent 5701531 commit fed1a43

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,30 @@ function(rtosc_add_test testname testbinary)
189189
set(_runner_temp "")
190190
endif()
191191

192+
# Dynamically find the GCC private lib directory for the MinGW cross-compiler.
193+
# This avoids hard-coding the GCC version (e.g. "13-win32") which changes
194+
# across runner image updates and different toolchain installations.
195+
execute_process(
196+
COMMAND x86_64-w64-mingw32-gcc -print-libgcc-file-name
197+
OUTPUT_VARIABLE _mingw_libgcc_file
198+
RESULT_VARIABLE _mingw_gcc_result
199+
OUTPUT_STRIP_TRAILING_WHITESPACE
200+
ERROR_QUIET
201+
)
202+
if(_mingw_gcc_result EQUAL 0 AND _mingw_libgcc_file)
203+
get_filename_component(_mingw_gcc_lib_dir "${_mingw_libgcc_file}" DIRECTORY)
204+
else()
205+
set(_mingw_gcc_lib_dir "")
206+
endif()
207+
192208
# Compose WINEPATH
193209
set(_winepath
194210
"/usr/x86_64-w64-mingw32/bin/;"
195211
"/usr/x86_64-w64-mingw32/lib/;"
196-
"/usr/lib/gcc/x86_64-w64-mingw32/13-win32"
197212
)
213+
if(_mingw_gcc_lib_dir)
214+
list(APPEND _winepath "${_mingw_gcc_lib_dir}")
215+
endif()
198216

199217
if(_runner_temp)
200218
list(APPEND _winepath

0 commit comments

Comments
 (0)