xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.2", "2bcd01f1d555bdb59a277b932f9021701c5cd26d1d7411f024394db69c5c11cf")
  8. add_versions("v1.3.0", "853e02ade9bf39f2863b470350c3ef55caffc3090d7d9a503724ff480c8d7eff")
  9. on_install(function (package)
  10. os.cp("include", package:installdir())
  11. end)
  12. on_test(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. #include <boost/di.hpp>
  15. namespace di = boost::di;
  16. class ctor {
  17. public:
  18. explicit ctor(int i) : i(i) {}
  19. int i;
  20. };
  21. struct aggregate {
  22. double d;
  23. };
  24. class example {
  25. public:
  26. example(aggregate a, const ctor& c) {}
  27. };
  28. void test() {
  29. const auto injector = di::make_injector(
  30. di::bind<int>.to(42),
  31. di::bind<double>.to(87.0)
  32. );
  33. injector.create<example>();
  34. }
  35. ]]}, {configs = {languages = "c++14"}}))
  36. end)