From a3ae0fe6a65ca7c3a30261865d8b93105272850f Mon Sep 17 00:00:00 2001 From: Reza Housseini <reza.housseini@mecos.com> Date: Mon, 11 May 2020 10:22:43 +0200 Subject: [PATCH] Add meson build files --- example/meson.build | 96 ++++++++++++++++++++++++++++++++++++++ extension/test/meson.build | 26 +++++++++++ meson.build | 29 ++++++++++++ meson_options.txt | 2 + test/meson.build | 90 +++++++++++++++++++++++++++++++++++ 5 files changed, 243 insertions(+) create mode 100644 example/meson.build create mode 100644 extension/test/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 test/meson.build diff --git a/example/meson.build b/example/meson.build new file mode 100644 index 0000000000..01f0da4fe0 --- /dev/null +++ b/example/meson.build @@ -0,0 +1,96 @@ +progs = [ + 'annotations', + 'automatic_injection', + 'bind_non_owning_ptr', + 'bind_templates', + 'bind_to_constructor', + 'bindings', + 'configuration', + 'constructor_injection', + 'constructor_signature', + 'custom_policy', + 'custom_provider', + 'custom_scope', + 'deduce_scope', + 'dynamic_bindings', + 'eager_singletons', + 'example', + 'fwd_bindings', + 'is_creatable', + 'modules', + 'motivation', + 'multiple_bindings', + 'multiple_interfaces', + 'pool_provider', + 'scopes', + 'try_it', + 'polymorphism/concepts', + 'polymorphism/function', + 'polymorphism/inheritance', + 'polymorphism/templates', + 'polymorphism/type_erasure', + 'polymorphism/variant', + 'performance/create_bound_interface', + 'performance/create_bound_interface_via_exposed_module', + 'performance/create_bound_interface_via_module', + 'performance/create_named_type', + 'performance/create_type_with_bound_instance', + 'performance/create_type_without_bindings', + 'tutorial/basic_annotations_to_the_rescue', + 'tutorial/basic_create_objects_tree', + 'tutorial/basic_decide_the_life_times', + 'tutorial/basic_first_steps_with_bindings', + 'tutorial/basic_first_steps_with_bindings_override', + 'tutorial/basic_first_steps_with_dynamic_bindings', + 'tutorial/basic_first_steps_with_multiple_bindings', + 'tutorial/basic_first_steps_with_template_bindings', + 'tutorial/basic_split_your_configuration', + 'tutorial/basic_split_your_configuration_expose', + 'user_guide/annotated_constructor_injection', + 'user_guide/annotated_constructor_injection_with_constructor_definition', + 'user_guide/annotated_constructor_injection_with_ctor_traits', + 'user_guide/annotated_constructor_injection_with_the_same_names', + 'user_guide/bind_cross_platform', + 'user_guide/bind_deduce_type_to_value', + 'user_guide/bind_dynamic_bindings', + 'user_guide/bind_interface_to_implementation', + 'user_guide/bind_multiple_bindings', + 'user_guide/bind_multiple_bindings_initializer_list', + 'user_guide/bind_multiple_interfaces', + 'user_guide/bind_type_override', + 'user_guide/bind_type_to_compile_time_value', + 'user_guide/bind_type_to_value', + 'user_guide/constructor_injection_aggregate', + 'user_guide/constructor_injection_ambiguous_constructors_via_BOOST_DI_INJECT', + 'user_guide/constructor_injection_ambiguous_constructors_via_BOOST_DI_INJECT_TRAITS', + 'user_guide/constructor_injection_ambiguous_constructors_via_ctor_traits', + 'user_guide/constructor_injection_ambiguous_constructors_via_inject', + 'user_guide/constructor_injection_ambiguous_constructors_via_vaargs', + 'user_guide/constructor_injection_default_values', + 'user_guide/constructor_injection_direct', + 'user_guide/constructor_injection_long_parameter_list', + 'user_guide/constructor_injection_multiple_constructors', + 'user_guide/injector_empty', + 'user_guide/module', + 'user_guide/module_exposed_annotated_type', + 'user_guide/module_exposed_complex_types', + 'user_guide/module_exposed_many_types', + 'user_guide/module_exposed_type', + 'user_guide/policies_constructible_global', + 'user_guide/policies_constructible_local', + 'user_guide/policies_print_type_extended', + 'user_guide/policies_print_types', + 'user_guide/providers_heap_no_throw', + 'user_guide/providers_stack_over_heap', + 'user_guide/scopes_custom', + 'user_guide/scopes_deduce_default', + 'user_guide/scopes_instance', + 'user_guide/scopes_singleton', + 'user_guide/scopes_unique' +] +foreach p : progs + exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : include_directories('..')) + test(p.underscorify(), exe) +endforeach diff --git a/extension/test/meson.build b/extension/test/meson.build new file mode 100644 index 0000000000..1f1429f213 --- /dev/null +++ b/extension/test/meson.build @@ -0,0 +1,26 @@ +progs = [ + ['bindings_constructor_bindings', 'bindings/constructor_bindings.cpp'], + ['bindings_contextual_bindings', 'bindings/contextual_bindings.cpp'], + ['injections_extensible_injector', 'injections/extensible_injector.cpp'], + ['injections_assisted_injection', 'injections/assisted_injection.cpp'], + ['injections_factory', 'injections/factory.cpp'], + ['injections_shared_factory', 'injections/shared_factory.cpp'], + ['injections_lazy', 'injections/lazy.cpp'], + ['injections_named_parameters', 'injections/named_parameters.cpp'], + ['injections_xml_injection', 'injections/xml_injection.cpp'], + ['policies_serialize', 'policies/serialize.cpp'], + ['policies_types_dumper', 'policies/types_dumper.cpp'], + ['policies_uml_dumper', 'policies/uml_dumper.cpp'], + ['providers_heap', 'providers/heap.cpp'], + ['providers_mocks_provider', 'providers/mocks_provider.cpp'], + ['providers_runtime_provider', 'providers/runtime_provider.cpp'], + ['scopes_scoped', 'scopes/scoped.cpp'], + ['scopes_session', 'scopes/session.cpp'], + ['scopes_shared', 'scopes/shared.cpp'], + ['injector', 'injector.cpp'] +] + +foreach p : progs + exe = executable(p[0], p[1], dependencies : boost_di_dep) + test(p[0], exe) +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000..f67f0a7b75 --- /dev/null +++ b/meson.build @@ -0,0 +1,29 @@ +project('boost_di', 'cpp', + version: '1.1.0', + license: 'boost', + default_options : ['warning_level=3', 'cpp_std=c++14'] +) + +boost_di_dep = declare_dependency( + include_directories: include_directories('include', 'extension/include') +) + +if not meson.is_subproject() + install_headers('include/boost/di.hpp', subdir: 'di') + + pkgc = import('pkgconfig') + pkgc.generate(name: 'boost_di', + version: meson.project_version(), + description: 'C++14 Dependency Injection Library' + ) +endif + + +if get_option('BOOST_DI_OPT_BUILD_TESTS') + subdir('extension/test') + subdir('test') +endif + +if get_option('BOOST_DI_OPT_BUILD_EXAMPLES') + subdir('example') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000..713babeac5 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,2 @@ +option('BOOST_DI_OPT_BUILD_TESTS', type : 'boolean', value : false, description : 'Build and perform Boost.DI tests') +option('BOOST_DI_OPT_BUILD_EXAMPLES', type : 'boolean', value : false, description : 'Build and perform Boost.DI examples') diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000000..9d059e5395 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,90 @@ +if meson.get_compiler('cpp').get_id() == 'msvc' + cpp_args = ['-DBOOST_DI_NAMESPACE=', '-D_CRT_SECURE_NO_WARNINGS'] + p = 'ft/di_injector_except' + exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : 'common', + cpp_args : cpp_args) + test(p.underscorify(), exe) +else + cpp_args = ['-DBOOST_DI_NAMESPACE='] + p = 'ft/di_injector_except' + exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : 'common', + cpp_args : [cpp_args, '-fexceptions']) + test(p.underscorify(), exe) +endif + +progs = [ + 'ut/inject', + 'ut/aux_/preprocessor', + 'ut/aux_/type_traits', + 'ut/aux_/utility', + 'ut/concepts/boundable', + 'ut/concepts/callable', + 'ut/concepts/configurable', + 'ut/concepts/creatable', + 'ut/concepts/providable', + 'ut/concepts/scopable', + 'ut/core/any_type', + 'ut/core/array', + 'ut/core/binder', + 'ut/core/bindings', + 'ut/core/dependency', + 'ut/core/injector', + 'ut/core/policy', + 'ut/core/pool', + 'ut/core/provider', + 'ut/core/wrapper', + 'ut/policies/constructible', + 'ut/providers/stack_over_heap', + 'ut/scopes/deduce', + 'ut/scopes/instance', + 'ut/scopes/singleton', + 'ut/scopes/unique', + 'ut/type_traits/ctor_traits', + 'ut/type_traits/memory_traits', + 'ut/type_traits/named_traits', + 'ut/type_traits/rebind_traits', + 'ut/type_traits/scope_traits', + 'ut/wrappers/unique', + 'ut/wrappers/shared', + 'ut/bindings', + 'ut/config', + 'ut/injector', + 'ut/make_injector', + 'ft/di_bind', + 'ft/di_config', + 'ft/di_config_global_policies', + 'ft/di_config_global_provider', + 'ft/di_errors', + 'ft/di_inject', + 'ft/di_injector', + 'ft/di_no_memory_inc', + 'pt/di_compile_time', +] + +foreach p : progs + exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : 'common', + cpp_args : cpp_args) + test(p.underscorify(), exe) +endforeach + +progs = ['ft/di_glibcxx_debug', 'ft/di_no_std_inc'] +foreach p : progs + exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : 'common', + cpp_args : [cpp_args, '-DBOOST_DI_TEST_HPP']) + test(p.underscorify(), exe) +endforeach + +p = 'pt/di_run_time' +exe = executable(p.underscorify(), p + '.cpp', + dependencies : boost_di_dep, + include_directories : 'common', + cpp_args : [cpp_args, '-DBOOST_DI_TEST_HPP', '-O3']) +test(p.underscorify(), exe)