Add support for meson build system.

This commit is contained in:
King_DuckZ 2020-03-28 21:00:36 +01:00
parent fcd09b2f85
commit 0a90a289a2
6 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,13 @@
conf = configuration_data()
version_arr = meson.project_version().split('.')
conf.set('PROJECT_VERSION_MAJOR', version_arr[0])
conf.set('PROJECT_VERSION_MINOR', version_arr[1])
conf.set('PROJECT_VERSION_PATCH', version_arr[2])
project_config_file = configure_file(
input: 'vectorwrapper.hpp.in',
output: '@BASENAME@',
configuration: conf,
format: 'cmake',
install: false,
)

33
meson.build Normal file
View file

@ -0,0 +1,33 @@
project('vectorwrapper', 'cpp',
version: '1.1.0',
meson_version: '>=0.50.0',
default_options:['cpp_std=c++11', 'b_ndebug=if-release']
)
public_includes = include_directories('include')
subdir('include/vectorwrapper')
vectorwrapper_dep = declare_dependency(
include_directories: [public_includes],
)
install_headers(
'include/vectorwrapper/has_method.hpp',
'include/vectorwrapper/implem_vec_base.hpp',
'include/vectorwrapper/implem_vec_base.inl',
'include/vectorwrapper/implem_vec_common.hpp',
'include/vectorwrapper/sequence_bt.hpp',
'include/vectorwrapper/sequence_range.hpp',
'include/vectorwrapper/size_type.hpp',
'include/vectorwrapper/vector_cast.hpp',
'include/vectorwrapper/vectorops.hpp',
'include/vectorwrapper/vector_ostream.hpp',
'include/vectorwrapper/vectorwrapper.inl',
project_config_file,
subdir: 'vectorwrapper',
)
if get_option('build_testing')
subdir('test')
endif

1
meson_options.txt Normal file
View file

@ -0,0 +1 @@
option('build_testing', type: 'boolean', value: true)

4
test/meson.build Normal file
View file

@ -0,0 +1,4 @@
gtest_dep = dependency('gtest', main: true, required: true)
subdir('unit')
subdir('unit_noconv')

17
test/unit/meson.build Normal file
View file

@ -0,0 +1,17 @@
compiler_opts = ['-DVWR_WITH_IMPLICIT_CONVERSIONS', '-DVWR_EXTRA_ACCESSORS']
exec_target = executable(meson.project_name(),
'test_conversions.cpp',
'test_ops.cpp',
'example.cpp',
'test_get_at.cpp',
'test_operators.cpp',
'test_sequence_range.cpp',
'test_offset_getters.cpp',
'test_custom_type.cpp',
install: false,
dependencies: [gtest_dep, vectorwrapper_dep],
cpp_args: compiler_opts,
)
test(meson.project_name() + ' unit test', exec_target)

View file

@ -0,0 +1,10 @@
compiler_opts = ['-DVWR_OUTER_NAMESPACE=vwr_outer_ns']
exec_target = executable(meson.project_name(),
'test_conversions.cpp',
install: false,
dependencies: [gtest_dep, vectorwrapper_dep],
cpp_args: compiler_opts,
)
test(meson.project_name() + ' unit test without implicit conversions', exec_target)