xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("ntkernel-error-category")
  2. set_homepage("https://github.com/ned14/ntkernel-error-category")
  3. set_description("A C++ 11 std::error_category for the NT kernel's NTSTATUS error codes ")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/ned14/ntkernel-error-category/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ned14/ntkernel-error-category.git")
  7. add_versions("v1.0.0", "481b60ac0b1d2c179120b3e6589884217508b6b5025a25dd6bf47399aa5d2cc5")
  8. add_configs("headeronly", {description = "Use header only version.", default = true, type = "boolean"})
  9. on_install(function (package)
  10. local configs = {}
  11. if package:config("headeronly") then
  12. configs.kind = "headeronly"
  13. package:add("defines", "NTKERNEL_ERROR_CATEGORY_INLINE")
  14. elseif not package:config("configs.shared") then
  15. package:add("defines", "NTKERNEL_ERROR_CATEGORY_STATIC")
  16. end
  17. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  18. import("package.tools.xmake").install(package, configs)
  19. end)
  20. on_test(function (package)
  21. assert(package:check_cxxsnippets({test = [[
  22. #include <system_error>
  23. #include <ntkernel-error-category/ntkernel_category.hpp>
  24. void test () {
  25. using namespace ntkernel_error_category;
  26. std::error_code ec(static_cast<int>(0xc000003a), ntkernel_category());
  27. }
  28. ]]}, {configs = {languages = "c++17"}}))
  29. end)