fix toml-test in ci

This commit is contained in:
Mark Gillard 2023-01-22 22:09:41 +02:00
parent 2b770b19cc
commit d8bb7176d5
4 changed files with 22 additions and 17 deletions

View File

@ -48,10 +48,11 @@ is_icc_cl = cpp.get_id() == 'intel-cl'
is_icc = is_icc_cl or cpp.get_id() == 'intel'
is_lld = cpp.get_linker_id() == 'ld.lld'
has_exceptions = get_option('cpp_eh') != 'none'
unreleased_features = get_option('unreleased_features')
build_tests = (get_option('build_tests') or is_devel) and not is_subproject
build_examples = (get_option('build_examples') or is_devel) and not is_subproject
build_tt = (get_option('build_tt') or is_devel) and not is_subproject
build_tt = (get_option('build_tt') or is_devel) and not is_subproject and has_exceptions and not unreleased_features
build_lib = get_option('build_lib') or get_option('compile_library') or build_tests or build_examples or build_tt
#-----------------------------------------------------------------------------------------------------------------------
@ -108,7 +109,6 @@ if is_pedantic
'-Wold-style-cast',
'-Woverloaded-virtual',
'-Wpacked',
'-Wpadded',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
@ -125,24 +125,19 @@ if is_pedantic
'-Wuseless-cast',
'-Wvariadic-macros',
'-Wwrite-strings',
'-Wmissing-noreturn',
# msvc
'/Wall'
'-Wmissing-noreturn'
)
if is_release
global_args += cpp.get_supported_arguments(
'-Wsuggest-attribute=const',
'-Wsuggest-attribute=pure'
)
endif
endif
# unnecessary pedantry:
global_args += cpp.get_supported_arguments(
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-documentation',
'-Wno-documentation-unknown-command',
'-Wno-switch-enum',
'-Wno-covered-switch-default'
'-Wno-covered-switch-default',
'-Wno-padded',
'-Wno-float-equal'
)
if get_option('time_trace')
global_args += cpp.get_supported_arguments('-ftime-trace')

View File

@ -2,9 +2,10 @@ option('devel', type: 'boolean', value: false, description: 'Tell meson whe
option('build_lib', type: 'boolean', value: false, description: 'Compile the library, rather than consuming it in header-only mode. (default: false) (implied by devel)')
option('build_examples', type: 'boolean', value: false, description: 'Build the examples (default: false) (implied by devel)')
option('build_tests', type: 'boolean', value: false, description: 'Build tests (default: false) (implied by devel)')
option('build_tt', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder and decoder. (default: false) (implied by devel)')
option('build_tt', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder and decoder. (default: false) (implied by devel) (disabled by unreleased_features)')
option('pedantic', type: 'boolean', value: false, description: 'Enable as many compiler warnings as possible (default: false) (implied by devel)')
option('time_trace', type: 'boolean', value: false, description: 'Enable the -ftime-trace option (Clang only)')
option('unreleased_features', type: 'boolean', value: false, description: 'Enable TOML_UNRELEASED_FEATURES=1 (default: false) (only relevant when compiling the library)')
option('generate_cmake_config', type: 'boolean', value: true, description: 'Generate a cmake package config file (default: true - no effect when included as a subproject)')
option('use_vendored_libs', type: 'boolean', value: true, description: 'Use the libs from the vendor dir when building tests.')

View File

@ -11,14 +11,25 @@ lib_args = cpp.get_supported_arguments('-DTOML_HEADER_ONLY=0')
if get_option('default_library') != 'static'
lib_args += cpp.get_supported_arguments('-DTOML_SHARED_LIB=1')
endif
if is_devel
if unreleased_features
lib_args += cpp.get_supported_arguments('-DTOML_ENABLE_UNRELEASED_FEATURES=1')
endif
# these are the _internal_ args, just for compiling the lib
lib_internal_args = []
lib_internal_args += global_args
lib_internal_args += lib_args
if is_pedantic and is_release
lib_internal_args += cpp.get_supported_arguments(
'-Wsuggest-attribute=const',
'-Wsuggest-attribute=pure'
)
endif
tomlplusplus_lib = library(
meson.project_name(),
files('toml.cpp'),
cpp_args: [ global_args, lib_args ],
cpp_args: lib_internal_args,
gnu_symbol_visibility: 'hidden',
include_directories: include_dir,
install: not is_subproject,

View File

@ -40,6 +40,4 @@
#pragma warning(pop)
#endif
#define TOML_ENABLE_UNRELEASED_FEATURES 0
#define TOML_EXCEPTIONS 1
#include <toml++/toml.h>