xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. local configs = {"-DCROSSGUID_TESTS=OFF"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  20. import("package.tools.cmake").install(package, configs, {buildir = "build"})
  21. if package:is_plat("windows") then
  22. os.trycp("build/pdb/**.pdb", package:installdir("lib"))
  23. end
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. void test() {
  28. auto g = xg::newGuid();
  29. }
  30. ]]}, {configs = {languages = "c++17"}, includes = "crossguid/guid.hpp"}))
  31. end)