[gnome-settings-daemon/wip/lantw/meson-Check-for-debug-and-optimization-in-the-same-way-as-GTK-4: 40/40] meson: Check for debug and optimization in the same way as GTK 4




commit b5b22f8240e352fdcc25f79b929b79b26db44bfe
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun May 3 18:30:15 2020 +0800

    meson: Check for debug and optimization in the same way as GTK 4
    
    Now meson returns 'custom' as the 'buildtype' when the user sets
    'optimization' and 'debug' to a combination it does not know, making it
    more likely to have none of 'debug' and 'release' in 'buildtype'.
    Therefore, it should be better to use 'optimization' and 'debug' options
    directly if we don't want an explicit option to control it.

 meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index a8955a49..cb691077 100644
--- a/meson.build
+++ b/meson.build
@@ -36,8 +36,6 @@ gsd_xdg_autostart = join_paths(gsd_sysconfdir, 'xdg', 'autostart')
 gsd_3_0_api_name = '@0@-@1@'.format(meson.project_name(), '3.0')
 gsd_gtk_modules_directory = join_paths(gsd_libdir, gsd_3_0_api_name, 'gtk-modules')
 
-gsd_buildtype = get_option('buildtype')
-
 host_is_darwin = host_machine.system().contains('darwin')
 host_is_linux = host_machine.system().contains('linux')
 host_is_linux_not_s390 = host_is_linux and not host_machine.cpu().contains('s390')
@@ -62,7 +60,7 @@ endforeach
 common_flags = ['-DHAVE_CONFIG_H']
 compiler_flags = []
 
-if gsd_buildtype.contains('debug')
+if get_option('debug')
   common_flags += ['-DG_ENABLE_DEBUG']
 
   test_cflags = [
@@ -78,7 +76,7 @@ if gsd_buildtype.contains('debug')
   ]
 
   compiler_flags = cc.get_supported_arguments(test_cflags)
-elif gsd_buildtype.contains('release')
+elif get_option('optimization') in ['2', '3', 's']
   common_flags += ['-DG_DISABLE_CAST_CHECKS']
 endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]