From 2b64ff92843339de4321d1c2f9da6931d0533912 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 15 Oct 2022 18:50:09 +0800 Subject: [PATCH] util: Turn -DWINDOWS_NO_FUTEX to be pre_args Turn -DWINDOWS_NO_FUTEX to be pre_args for not need add direct dependencies to dep_futex for libraries and executables. So only add dependencies to idep_mesautil is enough. And this will make sure all source code are either using Windows futex, or use mtx_t consistently across different sources, other than mixed usage of futex and mtx_t before this commit. If -DWINDOWS_NO_FUTEX is not globally available, that would cause /src/util/simple_mtx.h:116: undefined reference to `futex_wait' This error is raised when * compiled with -D min-windows-version=7 * moved futex_wait from futex.h to futex.c * used simple_mtx_t in more codes Or linkage error: src/compiler/libcompiler.a.p/glsl_types.cpp.obj: in function `futex_wake': /../../src/util/futex.h:154: undefined reference to `WaitOnAddress' When: * compiled with -D min-windows-version=7 * used simple_mtx_t in more codes Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7494 Fixes: c002bbeb2f7 ("util: Add a Win32 futex impl") Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Part-of: --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8e45a2689a1..fc5a32ae9b8 100644 --- a/meson.build +++ b/meson.build @@ -1639,7 +1639,7 @@ endif dep_futex = null_dep if host_machine.system() == 'windows' if (get_option('min-windows-version') < 8) - dep_futex = declare_dependency(compile_args : ['-DWINDOWS_NO_FUTEX']) + pre_args += '-DWINDOWS_NO_FUTEX' else dep_futex = cc.find_library('synchronization', required : true) endif