build: Harmonize c_args handling
The slightly different styles in the different build files make it harder to reason about or share c_args. This notably ensures we never set any extra c_args for plain builds and fixes the cc.get_supported_arguments() check in Cogl, Clutter and Mtk. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3333>
This commit is contained in:
parent
aaa63c1e08
commit
ee65ca791b
@ -12,18 +12,20 @@ clutter_c_args = [
|
||||
]
|
||||
|
||||
clutter_debug_c_args = []
|
||||
if get_option('debug')
|
||||
clutter_debug_c_args += [
|
||||
'-DCLUTTER_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer'
|
||||
]
|
||||
elif buildtype != 'plain'
|
||||
clutter_debug_c_args += [
|
||||
'-DG_DISABLE_ASSERT',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
if buildtype != 'plain'
|
||||
if get_option('debug')
|
||||
clutter_debug_c_args += [
|
||||
'-DCLUTTER_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer',
|
||||
]
|
||||
else
|
||||
clutter_debug_c_args += [
|
||||
'-DG_DISABLE_ASSERT',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
endif
|
||||
endif
|
||||
supported_clutter_debug_c_args = cc.get_supported_arguments(clutter_debug_c_args)
|
||||
clutter_debug_c_args = cc.get_supported_arguments(clutter_debug_c_args)
|
||||
clutter_c_args += clutter_debug_c_args
|
||||
|
||||
clutter_pkg_deps = [
|
||||
|
@ -84,20 +84,21 @@ if have_gles2
|
||||
endif
|
||||
|
||||
cogl_debug_c_args = []
|
||||
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 != 'plain'
|
||||
cogl_debug_c_args += [
|
||||
'-DG_DISABLE_CAST_CHECKS'
|
||||
]
|
||||
if buildtype != 'plain'
|
||||
if get_option('debug')
|
||||
cogl_debug_c_args += [
|
||||
'-DCOGL_GL_DEBUG',
|
||||
'-DCOGL_OBJECT_DEBUG',
|
||||
'-DCOGL_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer',
|
||||
]
|
||||
else
|
||||
cogl_debug_c_args += [
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
endif
|
||||
endif
|
||||
supported_cogl_debug_c_args = cc.get_supported_arguments(cogl_debug_c_args)
|
||||
cogl_debug_c_args = cc.get_supported_arguments(cogl_debug_c_args)
|
||||
cogl_c_args += cogl_debug_c_args
|
||||
|
||||
subdir('cogl')
|
||||
|
21
meson.build
21
meson.build
@ -466,7 +466,7 @@ add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
||||
|
||||
buildtype = get_option('buildtype')
|
||||
if buildtype != 'plain'
|
||||
all_warnings = [
|
||||
mutter_c_args = [
|
||||
'-fno-strict-aliasing',
|
||||
'-Wpointer-arith',
|
||||
'-Wmissing-declarations',
|
||||
@ -506,17 +506,16 @@ if buildtype != 'plain'
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-type-limits',
|
||||
]
|
||||
supported_warnings = cc.get_supported_arguments(all_warnings)
|
||||
add_project_arguments(supported_warnings, language: 'c')
|
||||
endif
|
||||
|
||||
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')
|
||||
if get_option('debug')
|
||||
mutter_c_args += [
|
||||
'-DG_ENABLE_DEBUG',
|
||||
'-fno-omit-frame-pointer',
|
||||
]
|
||||
endif
|
||||
|
||||
supported_mutter_c_args = cc.get_supported_arguments(mutter_c_args)
|
||||
add_project_arguments(supported_mutter_c_args, language: 'c')
|
||||
endif
|
||||
|
||||
cc.compiles('void main (void) { __builtin_ffsl (0); __builtin_popcountl (0); }')
|
||||
|
@ -14,17 +14,19 @@ mtk_c_args = [
|
||||
]
|
||||
|
||||
mtk_debug_c_args = []
|
||||
if get_option('debug')
|
||||
mtk_debug_c_args += [
|
||||
'-fno-omit-frame-pointer'
|
||||
]
|
||||
elif buildtype != 'plain'
|
||||
mtk_debug_c_args += [
|
||||
'-DG_DISABLE_ASSERT',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
if buildtype != 'plain'
|
||||
if get_option('debug')
|
||||
mtk_debug_c_args += [
|
||||
'-fno-omit-frame-pointer'
|
||||
]
|
||||
else
|
||||
mtk_debug_c_args += [
|
||||
'-DG_DISABLE_ASSERT',
|
||||
'-DG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
endif
|
||||
endif
|
||||
supported_mtk_debug_c_args = cc.get_supported_arguments(mtk_debug_c_args)
|
||||
mtk_debug_c_args = cc.get_supported_arguments(mtk_debug_c_args)
|
||||
mtk_c_args += mtk_debug_c_args
|
||||
|
||||
mtk_pkg_deps = [
|
||||
|
Loading…
Reference in New Issue
Block a user