mirror of https://github.com/djcb/mu.git
build: improve option checking / flags
This commit is contained in:
parent
b5b90a0673
commit
0b2d5c912c
32
meson.build
32
meson.build
|
@ -46,6 +46,11 @@ endif
|
||||||
################################################################################
|
################################################################################
|
||||||
# compilers / flags
|
# compilers / flags
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# compilers
|
||||||
|
cc = meson.get_compiler('c')
|
||||||
|
cxx= meson.get_compiler('cpp')
|
||||||
|
|
||||||
extra_flags = [
|
extra_flags = [
|
||||||
'-Wno-unused-parameter',
|
'-Wno-unused-parameter',
|
||||||
'-Wno-cast-function-type',
|
'-Wno-cast-function-type',
|
||||||
|
@ -53,33 +58,36 @@ extra_flags = [
|
||||||
'-Wformat=2',
|
'-Wformat=2',
|
||||||
'-Wstack-protector',
|
'-Wstack-protector',
|
||||||
'-Wno-switch-enum',
|
'-Wno-switch-enum',
|
||||||
'-Wno-volatile',
|
|
||||||
# assuming these are false alarm... (in fmt, with gcc13):
|
# assuming these are false alarm... (in fmt, with gcc13):
|
||||||
'-Wno-array-bounds',
|
'-Wno-array-bounds',
|
||||||
'-Wno-stringop-overflow',
|
'-Wno-stringop-overflow']
|
||||||
# clang
|
|
||||||
'-Wc11-extensions', # for clang
|
if (cxx.get_id() == 'clang')
|
||||||
|
extra_flags += [
|
||||||
|
'-Wc11-extensions',
|
||||||
'-Wno-keyword-macro',
|
'-Wno-keyword-macro',
|
||||||
'-Wno-deprecated-volatile',
|
'-Wno-deprecated-volatile',
|
||||||
'-Wno-#warnings',
|
'-Wno-#warnings']
|
||||||
|
endif
|
||||||
|
|
||||||
|
extra_cpp_flags= [
|
||||||
|
'-Wno-volatile'
|
||||||
]
|
]
|
||||||
|
|
||||||
if get_option('buildtype') == 'debug'
|
if get_option('buildtype') == 'debug'
|
||||||
extra_flags += [
|
extra_flags += [
|
||||||
'-ggdb',
|
'-ggdb',
|
||||||
'-fvar-tracking',
|
'-g3']
|
||||||
'-fvar-tracking-assignments']
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# compilers
|
|
||||||
cc = meson.get_compiler('c')
|
|
||||||
cxx= meson.get_compiler('cpp')
|
|
||||||
|
|
||||||
# extra arguments, if available
|
# extra arguments, if available
|
||||||
foreach extra_arg : extra_flags
|
foreach extra_arg : extra_flags
|
||||||
if cc.has_argument (extra_arg)
|
if cc.has_argument (extra_arg)
|
||||||
add_project_arguments([extra_arg], language: 'c')
|
add_project_arguments([extra_arg], language: 'c')
|
||||||
endif
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
foreach extra_arg : extra_flags + extra_cpp_flags
|
||||||
if cxx.has_argument (extra_arg)
|
if cxx.has_argument (extra_arg)
|
||||||
add_project_arguments([extra_arg], language: 'cpp')
|
add_project_arguments([extra_arg], language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
@ -168,8 +176,6 @@ else
|
||||||
message('CLD2 not found; no support for language detection')
|
message('CLD2 not found; no support for language detection')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dependency('cld2', required : false)
|
|
||||||
|
|
||||||
# note: these are for the unit-tests
|
# note: these are for the unit-tests
|
||||||
|
|
||||||
cp=find_program('cp')
|
cp=find_program('cp')
|
||||||
|
|
Loading…
Reference in New Issue