meson: Cleanup debug build handling
Add debug flags based on meson's `debug` option instead of `buildtype`. This allows custom build configurations to behave like a debug or release build. Add `-fno-omit-frame-pointer` to Mutter/Cogl. Not to Clutter though, as that would require more changes to how Clutter's gir is created Remove `-DG_DISABLE_CAST_CHECKS` from Clutter in debug builds Add `-DG_DISABLE_CHECKS`, `-DG_DISABLE_ASSERT` and `-DG_DISABLE_CAST_CHECKS` to all non-debug builds but `plain`, which explicitly should not have any compile flags Use `cc.get_supported_arguments`, so it becomes more obvious to the user which flags are set during compilation https://gitlab.gnome.org/GNOME/mutter/merge_requests/497
This commit is contained in:
parent
2145333969
commit
a859d76c72
@ -12,19 +12,18 @@ clutter_c_args = [
|
||||
]
|
||||
|
||||
clutter_debug_c_args = []
|
||||
if buildtype.startswith('debug')
|
||||
clutter_debug_c_args += '-DG_DISABLE_CAST_CHECKS'
|
||||
if buildtype == 'debug'
|
||||
clutter_debug_c_args += '-DCLUTTER_ENABLE_DEBUG'
|
||||
endif
|
||||
elif buildtype == 'release'
|
||||
if get_option('debug')
|
||||
clutter_debug_c_args += [
|
||||
'-DCLUTTER_ENABLE_DEBUG'
|
||||
]
|
||||
elif buildtype != 'plain'
|
||||
clutter_debug_c_args += [
|
||||
'-DG_DISABLE_ASSERT',
|
||||
'-DG_DISABLE_CHECKS',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
endif
|
||||
|
||||
supported_clutter_debug_c_args = cc.get_supported_arguments(clutter_debug_c_args)
|
||||
clutter_c_args += clutter_debug_c_args
|
||||
|
||||
clutter_pkg_deps = [
|
||||
|
@ -87,19 +87,21 @@ if have_gles2
|
||||
endif
|
||||
|
||||
cogl_debug_c_args = []
|
||||
if buildtype.startswith('debug')
|
||||
buildtype = get_option('buildtype')
|
||||
if get_option('debug')
|
||||
cogl_debug_c_args += [
|
||||
'-DCOGL_GL_DEBUG',
|
||||
'-DCOGL_OBJECT_DEBUG',
|
||||
'-DCOGL_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer'
|
||||
]
|
||||
elif buildtype == 'release'
|
||||
elif buildtype != 'plain'
|
||||
cogl_debug_c_args += [
|
||||
'-DG_DISABLE_CHECKS',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
'-DG_DISABLE_CAST_CHECKS'
|
||||
]
|
||||
endif
|
||||
|
||||
supported_cogl_debug_c_args = cc.get_supported_arguments(cogl_debug_c_args)
|
||||
cogl_c_args += cogl_debug_c_args
|
||||
|
||||
if have_cogl_tests
|
||||
|
12
meson.build
12
meson.build
@ -318,12 +318,14 @@ supported_warnings = cc.get_supported_arguments(all_warnings)
|
||||
|
||||
add_project_arguments(supported_warnings, language: 'c')
|
||||
|
||||
debug_c_args = []
|
||||
buildtype = get_option('buildtype')
|
||||
if buildtype.startswith('debug')
|
||||
debug_c_args += '-DG_ENABLE_DEBUG'
|
||||
if get_option('debug')
|
||||
debug_c_args = [
|
||||
'-DG_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer'
|
||||
]
|
||||
supported_debug_c_args = cc.get_supported_arguments(debug_c_args)
|
||||
add_project_arguments(supported_debug_c_args, language: 'c')
|
||||
endif
|
||||
add_project_arguments(debug_c_args, language: 'c')
|
||||
|
||||
cc.compiles('void main (void) { __builtin_ffsl (0); __builtin_popcountl (0); }')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user