Browse Source

fixup! WIP: Switch to Meson

zrythm_meson
David Robillard 1 year ago
parent
commit
a6e345277a
  1. 59
      meson.build
  2. 196
      meson/meson.build
  3. 2
      meson_options.txt

59
meson.build

@ -14,6 +14,65 @@ project('lv2', ['c'],
pkg = import('pkgconfig')
cc = meson.get_compiler('c')
# Set ultra strict warnings for developers, if requested
if get_option('strict')
subdir('meson')
c_warnings = all_c_warnings
if cc.get_id() == 'clang'
c_warnings += [
'-Wno-cast-align',
'-Wno-cast-qual',
'-Wno-documentation-unknown-command',
'-Wno-double-promotion',
'-Wno-float-conversion',
'-Wno-float-equal',
'-Wno-implicit-float-conversion',
'-Wno-padded',
'-Wno-reserved-id-macro',
'-Wno-shorten-64-to-32',
'-Wno-sign-conversion',
'-Wno-switch-enum',
'-Wno-unused-parameter',
]
elif cc.get_id() == 'gcc'
c_warnings += [
'-Wno-cast-align',
'-Wno-cast-qual',
'-Wno-conversion',
'-Wno-double-promotion',
'-Wno-float-equal',
'-Wno-inline',
'-Wno-padded',
'-Wno-parentheses',
'-Wno-suggest-attribute=const',
'-Wno-suggest-attribute=malloc',
'-Wno-suggest-attribute=pure',
'-Wno-switch-enum',
'-Wno-unused-parameter',
]
elif cc.get_id() == 'msvc'
c_warnings += [
'/wd4061', # enumerator in switch is not explicitly handled
'/wd4100', # unreferenced formal parameter
'/wd4244', # conversion with possible loss of data
'/wd4267', # conversion from size_t to a smaller type
'/wd4310', # cast truncates constant value
'/wd4365', # signed/unsigned mismatch
'/wd4464', # relative include path contains ".."
'/wd4514', # unreferenced inline function has been removed
'/wd4706', # assignment within conditional expression
'/wd4710', # function not inlined
'/wd4711', # function selected for automatic inline expansion
'/wd4820', # padding added after construct
'/wd5045', # will insert Spectre mitigation for memory load
]
endif
add_project_arguments(cc.get_supported_arguments(c_warnings),
language: ['c'])
endif
if host_machine.system() == 'darwin'
lv2dir = '/Library/Audio/Plug-Ins/LV2'
default_lv2_path = [

196
meson/meson.build

@ -0,0 +1,196 @@
# General code to enable approximately all warnings.
#
# This is trivial for clang and MSVC, but GCC does not have such an option, and
# has several esoteric warnings, so we need to enable everything we want
# explicitly. We enable everything that does not require a value argument,
# except for warnings that are only relevant for very old languages (earlier
# than C99 or C++11) or non-standard extensions.
#
# Omitted common warnings:
#
# Wabi=
# Waggregate-return
# Walloc-size-larger-than=BYTES
# Walloca-larger-than=BYTES
# Wframe-larger-than=BYTES
# Wlarger-than=BYTES
# Wstack-usage=BYTES
# Wsystem-headers
# Wtraditional
# Wtraditional-conversion
# Wtrampolines
# Wvla-larger-than=BYTES
#
# Omitted C warnings:
#
# Wc90-c99-compat
# Wdeclaration-after-statement
# Wtraditional
# Wtraditional-conversion
#
# Omitted C++ warnings:
#
# Wnamespaces
# Wtemplates
gcc_common_warnings = [
'-Walloc-zero',
'-Walloca',
'-Wanalyzer-too-complex',
'-Warith-conversion',
'-Warray-bounds=2',
'-Wattribute-alias=2',
'-Wcast-align=strict',
'-Wcast-qual',
'-Wconversion',
'-Wdate-time',
'-Wdisabled-optimization',
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wfloat-equal',
'-Wformat-overflow=2',
'-Wformat-signedness',
'-Wformat-truncation=2',
'-Wformat=2',
'-Wimplicit-fallthrough=2',
'-Winit-self',
'-Winline',
'-Winvalid-pch',
'-Wlogical-op',
'-Wmissing-declarations',
'-Wmissing-include-dirs',
'-Wmultichar',
'-Wnormalized=nfc',
'-Wnull-dereference',
'-Wpacked',
'-Wpadded',
'-Wredundant-decls',
'-Wscalar-storage-order',
'-Wshadow',
'-Wshift-overflow=2',
'-Wsizeof-array-argument',
'-Wstack-protector',
'-Wstrict-aliasing=3',
'-Wstrict-overflow=5',
'-Wstringop-overflow=3',
'-Wsuggest-attribute=cold',
'-Wsuggest-attribute=const',
'-Wsuggest-attribute=format',
'-Wsuggest-attribute=malloc',
'-Wsuggest-attribute=noreturn',
'-Wsuggest-attribute=pure',
'-Wswitch-default',
'-Wswitch-enum',
'-Wsync-nand',
'-Wundef',
'-Wunused-const-variable=2',
'-Wunused-macros',
'-Wvarargs',
'-Wvector-operation-performance',
'-Wvla',
'-Wwrite-strings',
]
gcc_c_warnings = [
'-Wbad-function-cast',
'-Wc++-compat',
'-Wc99-c11-compat',
'-Wdesignated-init',
'-Wdiscarded-array-qualifiers',
'-Wdiscarded-qualifiers',
'-Wincompatible-pointer-types',
'-Wjump-misses-init',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wold-style-definition',
'-Wstrict-prototypes',
'-Wunsuffixed-float-constants',
]
# Set all_c_warnings for the current C compiler
if is_variable('cc')
if cc.get_id() == 'clang'
all_c_warnings = ['-Weverything']
elif cc.get_id() == 'gcc'
all_c_warnings = gcc_common_warnings + [
'-Wbad-function-cast',
'-Wc++-compat',
'-Wc99-c11-compat',
'-Wdesignated-init',
'-Wdiscarded-array-qualifiers',
'-Wdiscarded-qualifiers',
'-Wincompatible-pointer-types',
'-Wjump-misses-init',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wold-style-definition',
'-Wstrict-prototypes',
'-Wunsuffixed-float-constants',
]
elif cc.get_id() == 'msvc'
all_c_warnings = ['/Wall']
else
all_c_warnings = []
endif
endif
# Set all_cpp_warnings for the current C++ compiler
if is_variable('cpp')
if cpp.get_id() == 'clang'
all_cpp_warnings = [
'-Weverything',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic'
]
elif cpp.get_id() == 'gcc'
all_cpp_warnings = gcc_common_warnings + [
'-Wabi-tag',
'-Waligned-new=all',
'-Wcatch-value=3',
'-Wcomma-subscript',
'-Wconditionally-supported',
'-Wctor-dtor-privacy',
'-Wdeprecated-copy-dtor',
'-Weffc++',
'-Wextra-semi',
'-Wmismatched-tags',
'-Wmultiple-inheritance',
'-Wnoexcept',
'-Wnoexcept-type',
'-Wnon-virtual-dtor',
'-Wold-style-cast',
'-Woverloaded-virtual',
'-Wplacement-new=2',
'-Wredundant-tags',
'-Wregister',
'-Wsign-promo',
'-Wstrict-null-sentinel',
'-Wsuggest-final-methods',
'-Wsuggest-final-types',
'-Wsuggest-override',
'-Wuseless-cast',
'-Wvirtual-inheritance',
'-Wvolatile',
'-Wzero-as-null-pointer-constant',
]
elif cpp.get_id() == 'msvc'
all_cpp_warnings = ['/Wall']
else
all_cpp_warnings = []
endif
endif
# Set all_objc_warnings for the current Objective C compiler
if is_variable('objcc')
all_objc_warnings = []
if objcc.get_id() == 'clang'
all_objc_warnings = ['-Weverything']
elif objc.get_id() == 'gcc'
all_objc_warnings = gcc_common_warnings + [
'-Wno-direct-ivar-access',
]
else
all_objc_warnings = []
endif
endif

2
meson_options.txt

@ -0,0 +1,2 @@
option('strict', type: 'boolean', value: false, yield: true,
description: 'Enable ultra-strict warnings')
Loading…
Cancel
Save