From 5d3ce49e76c7d8baf29eb071cfe4f1912a46139a Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 9 Mar 2024 03:15:50 +0800 Subject: [PATCH] meson: Extract with_mesa_debug and with_mesa_ndebug for latter usage Signed-off-by: Yonggang Luo Acked-by: David Heidelberg Reviewed-by: Eric Engestrom Part-of: --- meson.build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index bde6ec6d5ba..f4b3152b017 100644 --- a/meson.build +++ b/meson.build @@ -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 ') == '' 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