meson: Extract with_mesa_debug and with_mesa_ndebug for latter usage

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28092>
This commit is contained in:
Yonggang Luo
2024-03-09 03:15:50 +08:00
committed by Marge Bot
parent cf8f894921
commit 5d3ce49e76

View File

@@ -45,6 +45,11 @@ if get_option('layout') != 'mirror'
error('`mirror` is the only build directory layout supported')
endif
with_mesa_debug = get_option('buildtype') == 'debug'
# This means the final value of b_ndebug==true
with_mesa_ndebug = get_option('b_ndebug') == 'true' or (get_option('buildtype') == 'release' and get_option('b_ndebug') == 'if-release')
# Arguments for the preprocessor, put these in a separate array from the C and
# C++ (cpp in meson terminology) arguments since they need to be added to the
# default arguments for both C and C++.
@@ -952,7 +957,7 @@ if cc.get_define('ETIME', prefix : '#include <errno.h>') == ''
endif
# Define DEBUG for debug builds only (debugoptimized is not included on this one)
if get_option('buildtype') == 'debug'
if with_mesa_debug
pre_args += '-DDEBUG'
endif
@@ -1140,7 +1145,7 @@ else
# Variables that are only used for assertions are considered unused when assertions
# are disabled. Don't treat this as an error, since we build with -Werror even if
# assertions are disabled.
if get_option('b_ndebug') == 'true' or (get_option('buildtype') == 'release' and get_option('b_ndebug') == 'if-release')
if with_mesa_ndebug
_trial_c += ['-Wno-unused-variable', '-Wno-unused-but-set-variable', '/wd4189']
_trial_cpp += ['-Wno-unused-variable', '-Wno-unused-but-set-variable', '/wd4189']
endif