From 91febd50c6559337fa49bdc7ef52ca5f586c0437 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 24 Sep 2024 19:49:41 +0900 Subject: [PATCH] [win] Fix some bitrot for building Needed an option to disable LTO, and a couple of errors that crept in with preprocessor and vulkan improvements. --- config.d/compiling.m4 | 10 +++++++++- libs/video/targets/vid_win_vulkan.c | 5 +++++ tools/cross/mingw64/cross-configure.sh | 1 + tools/qfcc/source/cpp.c | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.d/compiling.m4 b/config.d/compiling.m4 index f9fa50942..454b39278 100644 --- a/config.d/compiling.m4 +++ b/config.d/compiling.m4 @@ -132,6 +132,12 @@ AC_ARG_ENABLE(optimize, optimize=yes ) +AC_ARG_ENABLE(lto, + AS_HELP_STRING([--disable-lto], [disable link-time optimizations]), + use_lto=$enable_lto, + use_lto=yes +) + if test "x$host_cpu" = xaarch64; then simd=neon else @@ -172,7 +178,9 @@ AC_MSG_CHECKING(for optimization) if test "x$optimize" = xyes -a "x$leave_cflags_alone" != "xyes"; then AC_MSG_RESULT(yes) BUILD_TYPE="$BUILD_TYPE Optimize" - QF_CC_OPTION(-flto=auto) + if test "x$use_lto" = xyes; then + QF_CC_OPTION(-flto=auto) + fi if test "x$GCC" = xyes; then saved_cflags="$CFLAGS" dnl CFLAGS="" diff --git a/libs/video/targets/vid_win_vulkan.c b/libs/video/targets/vid_win_vulkan.c index 5dd212ef3..856be1d8b 100644 --- a/libs/video/targets/vid_win_vulkan.c +++ b/libs/video/targets/vid_win_vulkan.c @@ -176,7 +176,11 @@ win_vulkan_create_surface (vulkan_ctx_t *ctx) static void delete_vulkan_context (vulkan_ctx_t *ctx) { + if (ctx->presentation) { + free (ctx->presentation); + } va_destroy_context (ctx->va_ctx); + free (ctx); } vulkan_ctx_t * @@ -184,6 +188,7 @@ Win_Vulkan_Context (vid_internal_t *vi) { vulkan_ctx_t *ctx = calloc (1, sizeof (vulkan_ctx_t)); *ctx = (vulkan_ctx_t) { + .delete = delete_vulkan_context, .load_vulkan = load_vulkan_library, .unload_vulkan = unload_vulkan_library, .get_presentation_support = win_vulkan_get_presentation_support, diff --git a/tools/cross/mingw64/cross-configure.sh b/tools/cross/mingw64/cross-configure.sh index 5c890df11..14039ba90 100755 --- a/tools/cross/mingw64/cross-configure.sh +++ b/tools/cross/mingw64/cross-configure.sh @@ -20,4 +20,5 @@ export QCSYSPREFIX=$MINGW_USR --enable-silent-rules \ --host=x86_64-w64-mingw32.static \ --disable-shared \ + --disable-lto \ $* diff --git a/tools/qfcc/source/cpp.c b/tools/qfcc/source/cpp.c index 2c36aa35c..2de7aff2f 100644 --- a/tools/qfcc/source/cpp.c +++ b/tools/qfcc/source/cpp.c @@ -576,7 +576,7 @@ run_cpp (const char *filename, const char *ext) } #ifdef _WIN32 - if (!options.save_temps && !options.preprocess_only) + if (!options.save_temps && !options.preprocess_only) { mktemp (tempname->str); }