From 4833fdf2231b9f909bb108530ececfdead9752b0 Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 23 Sep 2023 19:21:03 +0800 Subject: [PATCH] boost_di: add package (#2644) * boost_di: add package * remove deps --- packages/b/boost_di/xmake.lua | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packages/b/boost_di/xmake.lua diff --git a/packages/b/boost_di/xmake.lua b/packages/b/boost_di/xmake.lua new file mode 100644 index 000000000..91ebb02df --- /dev/null +++ b/packages/b/boost_di/xmake.lua @@ -0,0 +1,39 @@ +package("boost_di") + set_kind("library", {headeronly = true}) + set_homepage("https://boost-ext.github.io/di") + set_description("DI: C++14 Dependency Injection Library") + + add_urls("https://github.com/boost-ext/di/archive/refs/tags/$(version).tar.gz", + "https://github.com/boost-ext/di.git") + + add_versions("v1.3.0", "853e02ade9bf39f2863b470350c3ef55caffc3090d7d9a503724ff480c8d7eff") + + on_install(function (package) + os.cp("include", package:installdir()) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + namespace di = boost::di; + class ctor { + public: + explicit ctor(int i) : i(i) {} + int i; + }; + struct aggregate { + double d; + }; + class example { + public: + example(aggregate a, const ctor& c) {} + }; + void test() { + const auto injector = di::make_injector( + di::bind.to(42), + di::bind.to(87.0) + ); + injector.create(); + } + ]]}, {configs = {languages = "c++14"}})) + end)