From 0a90a289a2c354c88130dbf04a4c15c696e0a9de Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 28 Mar 2020 21:00:36 +0100 Subject: [PATCH] Add support for meson build system. --- include/vectorwrapper/meson.build | 13 ++++++++++++ meson.build | 33 +++++++++++++++++++++++++++++++ meson_options.txt | 1 + test/meson.build | 4 ++++ test/unit/meson.build | 17 ++++++++++++++++ test/unit_noconv/meson.build | 10 ++++++++++ 6 files changed, 78 insertions(+) create mode 100644 include/vectorwrapper/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 test/meson.build create mode 100644 test/unit/meson.build create mode 100644 test/unit_noconv/meson.build diff --git a/include/vectorwrapper/meson.build b/include/vectorwrapper/meson.build new file mode 100644 index 0000000..e344c93 --- /dev/null +++ b/include/vectorwrapper/meson.build @@ -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, +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..d6d2165 --- /dev/null +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..b6219ff --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('build_testing', type: 'boolean', value: true) diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..e79cbad --- /dev/null +++ b/test/meson.build @@ -0,0 +1,4 @@ +gtest_dep = dependency('gtest', main: true, required: true) + +subdir('unit') +subdir('unit_noconv') diff --git a/test/unit/meson.build b/test/unit/meson.build new file mode 100644 index 0000000..b110c0e --- /dev/null +++ b/test/unit/meson.build @@ -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) diff --git a/test/unit_noconv/meson.build b/test/unit_noconv/meson.build new file mode 100644 index 0000000..3cd9a67 --- /dev/null +++ b/test/unit_noconv/meson.build @@ -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)