Skip to content

Instantly share code, notes, and snippets.

@z33ky
Created January 7, 2019 09:55
Show Gist options
  • Save z33ky/b815c9c7e2197a5a6d0264839e825ba9 to your computer and use it in GitHub Desktop.
Save z33ky/b815c9c7e2197a5a6d0264839e825ba9 to your computer and use it in GitHub Desktop.
meson test
project('blah', 'cpp',
default_options : ['cpp_std=c++17'],
meson_version : '>=0.47.0',
)
configure_file(input: '.buildgitignore', output: '.gitignore', copy: true)
compiler = meson.get_compiler('cpp')
compiler_id = compiler.get_id()
if ['clang', 'gcc'].contains(compiler_id)
add_project_arguments(
'-fstrict-aliasing',
'-pedantic',
'-Wall',
'-Wextra',
'-Wconversion',
'-Wdeprecated',
'-Wfloat-equal',
'-Wnon-virtual-dtor',
'-Wold-style-cast',
'-Wsign-compare',
'-Wsign-conversion',
'-Wstrict-aliasing=1',
'-Wswitch-default',
'-Wundef',
'-Wunreachable-code',
language : 'cpp',
)
extra_warnings = get_option('extra_warnings')
if extra_warnings != 'none' and compiler.has_argument('-Weverything')
warn_not_flags = ['c++98-compat', 'c++98-compat-pedantic', 'exit-time-destructors', 'ignored-qualifiers']
if extra_warnings == 'some'
warn_not_flags += 'padded'
endif
foreach flag : warn_not_flags
warn_flag = '-W' + flag
if compiler.has_argument(warn_flag)
message('Disabling ' + warn_flag)
add_project_arguments('-Wno-' + flag, language : 'cpp')
endif
endforeach
endif
elif compiler_id == 'msvc'
add_project_arguments('/W4', language : 'cpp')
endif
doxygen = find_program('doxygen', required : false)
if doxygen.found()
#find_program('dot')
custom_target('docs',
input : 'Doxyfile',
output : 'docs',
command : [doxygen, join_paths(meson.source_root(), 'Doxyfile')],
build_by_default : false,
)
else
warning('Doxygen not found. Target \'docs\' not available.')
endif
subdir('src')
executable('bin/server', server_files)
option('extra_warnings', type : 'combo', choices : ['none', 'some', 'many'], value : 'some', description : 'How many extra warnings to enable.')
server_files = files([
'a.cpp',
'b.cpp',
'c.cpp',
'd.cpp',
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment