xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("uuid_v4")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/crashoz/uuid_v4")
  4. set_description("Super fast C++ library to generate and parse UUIDv4")
  5. set_license("MIT")
  6. add_urls("https://github.com/crashoz/uuid_v4/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/crashoz/uuid_v4.git", {submodules = false})
  8. add_versions("v1.0.0", "0d858bc8e7466be693332f4f16768b29f605ff386443f37a07b1f872db29ff2d")
  9. if on_check then
  10. on_check(function (package)
  11. if not package:is_arch("x64", "x86", "x86_64") then
  12. raise("package(uuid_v4) only support x86 arch")
  13. end
  14. end)
  15. end
  16. on_load(function (package)
  17. if package:gitref() or package:version():gt("1.0.0") then
  18. package:add("deps", "cmake")
  19. end
  20. end)
  21. on_install(function (package)
  22. if package:gitref() or package:version():gt("1.0.0") then
  23. import("package.tools.cmake").install(package)
  24. else
  25. os.cp("uuid_v4.h", package:installdir("include"))
  26. os.cp("endianness.h", package:installdir("include"))
  27. end
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <uuid_v4.h>
  32. void test() {
  33. UUIDv4::UUIDGenerator<std::mt19937_64> uuidGenerator;
  34. UUIDv4::UUID uuid = uuidGenerator.getUUID();
  35. }
  36. ]]}, {configs = {languages = "c++17"}}))
  37. end)