tomlplusplus/meson.build
Mark Gillard 104b2741d1 minor refactoring in the parser to reduce binary sizes
also:
- fixed pedantic vtable warnings on clang with -Weverything
- renamed `_impl.h` headers to `.hpp`
- build system and CI config tweaks
2020-04-08 16:33:57 +03:00

134 lines
3.2 KiB
Meson

project(
'tomlplusplus',
'cpp',
version : '1.2.1',
license : 'MIT',
default_options : [
'cpp_std=c++17',
'warning_level=3',
'werror=true',
'cpp_eh=default',
'b_ndebug=if-release',
'b_lto=true'
]
)
tomlplusplus_dep = declare_dependency(
include_directories : include_directories('include'),
version : meson.project_version(),
)
build_tests = get_option('BUILD_TESTS').enabled() or (get_option('BUILD_TESTS').auto() and not meson.is_subproject())
build_examples = get_option('BUILD_EXAMPLES').enabled() or (get_option('BUILD_EXAMPLES').auto() and not meson.is_subproject())
if build_tests or build_examples
compiler = meson.get_compiler('cpp')
message(['compiler ID: ', compiler.get_id()])
message(['compiler version: ', compiler.version()])
if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
add_project_arguments([
'-Wno-unused-command-line-argument',
'-march=native',
'-fno-rtti',
#'-fdata-sections',
#'-ffunction-sections',
#'-Wl,--gc-sections'
],
language : 'cpp'
)
endif
if compiler.get_id() == 'gcc'
add_project_arguments([
'-fmax-errors=5',
'-Wno-init-list-lifetime'
],
language : 'cpp'
)
endif
if compiler.get_id() == 'clang'
add_project_arguments([
'-ferror-limit=5',
'-fchar8_t',
#'-Weverything',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-float-equal',
'-Wno-switch-enum',
'-Wno-documentation',
'-Wno-documentation-unknown-command',
'-Wno-padded',
#'-Wno-weak-vtables',
'-Wno-double-promotion',
'-Wno-covered-switch-default',
#'-ftime-trace'
],
language : 'cpp'
)
endif
if compiler.get_id() == 'intel-cl'
add_project_arguments([
'/Qoption,cpp,--unicode_source_kind,UTF-8',
'/std=c++latest',
'/wd82', # storage class is not first
'/wd280', # selector expression is constant (why the fuck is that a warning?)
'/wd411', # class provides no constructor (duh, it's an aggregate)
'/wd1011', # missing return statement (false negative)
'/wd1628', # function marked [[noreturn]] returns (false positive)
'/wd3280' # declaration hides member (triggered in Catch2)
],
language : 'cpp'
)
endif
inc = include_directories('include', 'extern')
if build_tests
subdir('tests')
else
message('Not building tests')
endif
if build_examples
subdir('examples')
else
message('Not building examples')
endif
endif
install_subdir('include/toml++/',
strip_directory: true,
install_dir: 'include/toml++'
)
pkgc = import('pkgconfig')
pkgc.generate (
name: meson.project_name(),
version: meson.project_version(),
description: 'Header-only TOML config file parser and serializer for modern C++'
)
# meson cmake stuff requires at least 0.50
if meson.version().version_compare('>= 0.50')
if get_option('GENERATE_CMAKE_CONFIG').enabled() or (get_option('GENERATE_CMAKE_CONFIG').auto() and not meson.is_subproject())
cmake = import('cmake')
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version()
)
cmake_conf = configuration_data()
cmake.configure_package_config_file(
name: meson.project_name(),
input: 'cmake/tomlplusplus.cmake.in',
configuration: cmake_conf,
)
endif
endif