meson: add common compiler options similar to configure.ac

Co-authored-by: Marvin Scholz <epirat07@gmail.com>
This commit is contained in:
Steve Lhomme 2023-01-12 15:09:17 +01:00
parent 455b4ffbe0
commit 5b398308b6
2 changed files with 46 additions and 1 deletions

View File

@ -403,6 +403,47 @@ windows_version_test = '''
endif
add_project_arguments(cc.get_supported_arguments([
'-Wno-deprecated-copy', # Some Qt version are generating tons of warning that cannot be
# avoided so mute them
]), language: ['c', 'cpp', 'objc'])
add_project_arguments(cc.get_supported_arguments([
'-Wextra',
'-Wsign-compare',
'-Wundef',
'-Wpointer-arith',
'-Wvolatile-register-var',
'-Wformat',
'-Wformat-security',
'-Wduplicated-branches',
'-Wduplicated-cond',
]), language: ['c', 'cpp'])
add_project_arguments(cc.get_supported_arguments([
'-Wbad-function-cast',
'-Wwrite-strings',
'-Wmissing-prototypes',
'-Werror-implicit-function-declaration',
'-Winit-self',
'-Wlogical-op',
'-Wshadow=local',
'-Wmultistatement-macros',
'-pipe'
]), language: ['c'])
if get_option('branch_protection') \
.require(host_machine.cpu_family() == 'aarch64', error_message: 'Branch protection is only available for AArch64') \
.require(cc.has_argument('-mbranch-protection=standard'), error_message: 'Compiler does not support `-mbranch-protection`') \
.allowed()
add_project_arguments('-mbranch-protection=standard', language: ['c', 'cpp'])
endif
if cc.get_id() not in ['clang-cl']
add_project_arguments(cc.get_supported_arguments([
'-Wall', # too verbose with clang-cl
]), language: ['c', 'cpp'])
endif
add_project_arguments(cc.first_supported_argument(['-Werror-implicit-function-declaration', '-we4013']), language: ['c'])

View File

@ -40,6 +40,11 @@ option('run_as_root',
value : false,
description : 'Allow running VLC as root')
option('branch_protection',
type : 'feature',
value : 'auto',
description : 'AArch64 branch protection')
option('winstore_app',
type : 'boolean',
value : 'false',
@ -52,7 +57,6 @@ option('winstore_app',
# TODO: Missing avx option
# TODO: Missing neon option
# TODO: Missing sve option
# TODO: Missing branch_protection option
# TODO: Missing altivec option
# TODO: Missing update-check option