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: c002bbeb2f ("util: Add a Win32 futex impl")

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19087>
(cherry picked from commit 2b64ff9284)
This commit is contained in:
Yonggang Luo
2022-10-15 18:50:09 +08:00
committed by Dylan Baker
parent a6fcc62545
commit 1a52e9be02
2 changed files with 2 additions and 2 deletions

View File

@@ -220,7 +220,7 @@
"description": "util: Turn -DWINDOWS_NO_FUTEX to be pre_args",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "c002bbeb2f7a1bf2d5c020abdddcf25909c447b6"
},

View File

@@ -1630,7 +1630,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