xmake.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("debug_assert")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("http://foonathan.net/blog/2016/09/16/assertions.html")
  4. set_description("Simple, flexible and modular assertion macro.")
  5. set_license("zlib")
  6. add_urls("https://github.com/foonathan/debug_assert.git")
  7. add_urls("https://github.com/foonathan/debug_assert/archive/refs/tags/$(version).tar.gz")
  8. add_versions("v1.3.4", "6d8749eaa6b571b6b53e2355ed0e916a83842cd623ce7e5f65b521ec71b70454")
  9. add_deps("cmake")
  10. on_install(function (package)
  11. import("package.tools.cmake").install(package)
  12. end)
  13. on_test(function (package)
  14. assert(package:check_cxxsnippets({test = [[
  15. #include <iostream>
  16. struct module_a :
  17. debug_assert::default_handler, // it uses the default handler
  18. debug_assert::set_level<1> // and this level
  19. {
  20. };
  21. void module_a_func(void* ptr)
  22. {
  23. DEBUG_ASSERT(ptr, module_a{}); // minimal assertion
  24. DEBUG_ASSERT(2 + 2 == 4, module_a{}, debug_assert::level<2>{}); // assertion with level
  25. DEBUG_ASSERT(1 == 0, module_a{},
  26. "this should be true"); // assertion with additional parameters, i.e. a message
  27. DEBUG_UNREACHABLE(module_a{}); // mark unreachable statements
  28. }
  29. ]]}, {configs = {languages = "c++11"}, includes = {"debug_assert.hpp"}}))
  30. end)