xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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_versions("2022.11.13", "7ea47091830eec9a9c6a338c8a29da70494692a5")
  8. add_deps("cmake")
  9. on_install(function (package)
  10. import("package.tools.cmake").install(package)
  11. end)
  12. on_test(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. #include <iostream>
  15. struct module_a :
  16. debug_assert::default_handler, // it uses the default handler
  17. debug_assert::set_level<1> // and this level
  18. {
  19. };
  20. void module_a_func(void* ptr)
  21. {
  22. DEBUG_ASSERT(ptr, module_a{}); // minimal assertion
  23. DEBUG_ASSERT(2 + 2 == 4, module_a{}, debug_assert::level<2>{}); // assertion with level
  24. DEBUG_ASSERT(1 == 0, module_a{},
  25. "this should be true"); // assertion with additional parameters, i.e. a message
  26. DEBUG_UNREACHABLE(module_a{}); // mark unreachable statements
  27. }
  28. ]]}, {configs = {languages = "c++11"}, includes = {"debug_assert.hpp"}}))
  29. end)