mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-08 23:24:20 +00:00
meson: add options and tests (#255)
This commit is contained in:
parent
95c71dab42
commit
fc88b4936a
4 changed files with 58 additions and 1 deletions
|
|
@ -15,6 +15,7 @@
|
|||
[](https://conan.io/center/magic_enum)
|
||||
[](https://github.com/microsoft/vcpkg/tree/master/ports/magic-enum)
|
||||
[](https://www.cppget.org/magic_enum?q=magic_enum)
|
||||
[](https://github.com/mesonbuild/wrapdb/blob/master/subprojects/magic_enum.wrap)
|
||||
[](LICENSE)
|
||||
[](https://wandbox.org/permlink/JPMZqT9mgaUdooyC)
|
||||
[](https://godbolt.org/z/BxfmsH)
|
||||
|
|
|
|||
17
meson.build
17
meson.build
|
|
@ -6,6 +6,21 @@ project(
|
|||
|
||||
magic_enum_include = include_directories('include')
|
||||
|
||||
magic_enum_args = []
|
||||
|
||||
if get_option('noascii')
|
||||
magic_enum_args += '-DMAGIC_ENUM_ENABLE_NONASCII'
|
||||
endif
|
||||
|
||||
if get_option('hash')
|
||||
magic_enum_args += '-DMAGIC_ENUM_ENABLE_HASH'
|
||||
endif
|
||||
|
||||
magic_enum_dep = declare_dependency(
|
||||
include_directories: magic_enum_include,
|
||||
)
|
||||
compile_args: magic_enum_args,
|
||||
)
|
||||
|
||||
if get_option('test')
|
||||
subdir('test')
|
||||
endif
|
||||
|
|
|
|||
20
meson_options.txt
Normal file
20
meson_options.txt
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
option(
|
||||
'test',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'Build and run tests'
|
||||
)
|
||||
|
||||
option(
|
||||
'noascii',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Enable support for non-ASCII enumeration identifier'
|
||||
)
|
||||
|
||||
option(
|
||||
'hash',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Do hashing at build time - longer build times, but O(1) string lookup'
|
||||
)
|
||||
21
test/meson.build
Normal file
21
test/meson.build
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
catch2_dep = declare_dependency(
|
||||
include_directories: '3rdparty/Catch2'
|
||||
)
|
||||
|
||||
test_files = {
|
||||
'basic test' : files('test.cpp'),
|
||||
'flags test' : files('test_flags.cpp'),
|
||||
'aliases test' : files('test_aliases.cpp'),
|
||||
'containers test' : files('test_containers.cpp'),
|
||||
}
|
||||
|
||||
foreach test_name, test_src : test_files
|
||||
test_exe = executable(
|
||||
test_name.underscorify(),
|
||||
test_src,
|
||||
|
||||
dependencies: [magic_enum_dep, catch2_dep]
|
||||
)
|
||||
|
||||
test(test_name, test_exe)
|
||||
endforeach
|
||||
Loading…
Add table
Add a link
Reference in a new issue