xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("crossguid")
  2. set_homepage("https://github.com/graeme-hill/crossguid")
  3. set_description("Lightweight cross platform C++ GUID/UUID library")
  4. set_license("MIT")
  5. add_urls("https://github.com/graeme-hill/crossguid.git")
  6. add_versions("2019.3.29", "ca1bf4b810e2d188d04cb6286f957008ee1b7681")
  7. -- Apply patch and necessary lib
  8. if is_plat("macosx", "iphoneos") then
  9. add_patches("2019.3.29", path.join(os.scriptdir(), "patches", "warnings.patch"), "9953cb5ef68bdffa7cc9cb138a2119dd3460f3055db14a13aecc4dd256104c09")
  10. add_frameworks("CoreFoundation")
  11. elseif is_plat("linux") then
  12. add_deps("libuuid")
  13. elseif is_plat("windows", "mingw") then
  14. add_syslinks("ole32")
  15. end
  16. add_deps("cmake")
  17. on_install("windows", "linux", "macosx", "iphoneos", "android", "mingw", function (package)
  18. io.replace(path.translate("include/crossguid/guid.hpp"), "#include <functional>", "#include <cstdint>\n#include<functional>", { plain = true })
  19. local configs = {"-DCROSSGUID_TESTS=OFF"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  21. import("package.tools.cmake").install(package, configs, {buildir = "build"})
  22. if package:is_plat("windows") then
  23. os.trycp("build/pdb/**.pdb", package:installdir("lib"))
  24. end
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. void test() {
  29. auto g = xg::newGuid();
  30. }
  31. ]]}, {configs = {languages = "c++17"}, includes = "crossguid/guid.hpp"}))
  32. end)