xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("boost_di")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://boost-ext.github.io/di")
  4. set_description("DI: C++14 Dependency Injection Library")
  5. add_urls("https://github.com/boost-ext/di/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/boost-ext/di.git")
  7. add_versions("v1.3.0", "853e02ade9bf39f2863b470350c3ef55caffc3090d7d9a503724ff480c8d7eff")
  8. on_install(function (package)
  9. os.cp("include", package:installdir())
  10. end)
  11. on_test(function (package)
  12. assert(package:check_cxxsnippets({test = [[
  13. #include <boost/di.hpp>
  14. namespace di = boost::di;
  15. class ctor {
  16. public:
  17. explicit ctor(int i) : i(i) {}
  18. int i;
  19. };
  20. struct aggregate {
  21. double d;
  22. };
  23. class example {
  24. public:
  25. example(aggregate a, const ctor& c) {}
  26. };
  27. void test() {
  28. const auto injector = di::make_injector(
  29. di::bind<int>.to(42),
  30. di::bind<double>.to(87.0)
  31. );
  32. injector.create<example>();
  33. }
  34. ]]}, {configs = {languages = "c++14"}}))
  35. end)