mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
meson: let meson detect supported compiler flags
This commit is contained in:
parent
57a9e82f79
commit
3ba73bde48
1 changed files with 31 additions and 41 deletions
72
meson.build
72
meson.build
|
|
@ -60,49 +60,39 @@ pipewire_headers_dir = join_paths(pipewire_name, 'pipewire')
|
||||||
gnome = import('gnome')
|
gnome = import('gnome')
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
|
|
||||||
have_cpp = add_languages('cpp', required : false)
|
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
if cc.get_id() == 'gcc'
|
common_flags = [
|
||||||
add_global_arguments('-fvisibility=hidden',
|
'-fvisibility=hidden',
|
||||||
'-Wsign-compare',
|
'-Werror=suggest-attribute=format',
|
||||||
'-Wpointer-arith',
|
'-Wsign-compare',
|
||||||
'-Wpointer-sign',
|
'-Wpointer-arith',
|
||||||
'-Wformat',
|
'-Wpointer-sign',
|
||||||
'-Wformat-security',
|
'-Wformat',
|
||||||
'-Werror=suggest-attribute=format',
|
'-Wformat-security',
|
||||||
'-Wmissing-braces',
|
'-Wimplicit-fallthrough',
|
||||||
'-Wtype-limits',
|
'-Wmissing-braces',
|
||||||
'-Wold-style-declaration',
|
'-Wtype-limits',
|
||||||
'-Wvariadic-macros',
|
'-Wvariadic-macros',
|
||||||
'-Wno-missing-field-initializers',
|
'-Wno-missing-field-initializers',
|
||||||
'-Wno-unused-parameter',
|
'-Wno-unused-parameter',
|
||||||
'-Wno-pedantic',
|
'-Wno-pedantic',
|
||||||
'-Wunused-result',
|
'-Wold-style-declaration',
|
||||||
'-DFASTPATH',
|
'-Wunused-result',
|
||||||
# '-DSPA_DEBUG_MEMCPY',
|
]
|
||||||
language : 'c')
|
|
||||||
add_global_arguments('-fvisibility=hidden',
|
cc_flags = common_flags + [
|
||||||
'-Wsign-compare',
|
'-DFASTPATH',
|
||||||
'-Wpointer-arith',
|
# '-DSPA_DEBUG_MEMCPY',
|
||||||
'-Wformat',
|
]
|
||||||
'-Wformat-security',
|
add_project_arguments(cc.get_supported_arguments(cc_flags), language: 'c')
|
||||||
'-Werror=suggest-attribute=format',
|
|
||||||
'-Wmissing-braces',
|
have_cpp = add_languages('cpp', required : false)
|
||||||
'-Wtype-limits',
|
|
||||||
'-Wvariadic-macros',
|
if have_cpp
|
||||||
'-Wno-missing-field-initializers',
|
cxx = meson.get_compiler('cpp')
|
||||||
'-Wno-unused-parameter',
|
cxx_flags = common_flags
|
||||||
'-Wno-pedantic',
|
add_project_arguments(cxx.get_supported_arguments(cxx_flags), language: 'cpp')
|
||||||
'-Wunused-result',
|
|
||||||
language : 'cpp')
|
|
||||||
# warn on implicit fall-through if supported by compiler (gcc >= 7.x)
|
|
||||||
gcc_major_version = cc.version().split('.')[0]
|
|
||||||
if(gcc_major_version.to_int() >= 7)
|
|
||||||
add_global_arguments('-Wimplicit-fallthrough', language : 'c')
|
|
||||||
add_global_arguments('-Wimplicit-fallthrough', language : 'cpp')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sse_args = '-msse'
|
sse_args = '-msse'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue