xmake.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("mcut")
  2. set_homepage("https://cutdigital.github.io/mcut.site/")
  3. set_description("Fast & robust mesh boolean library in C++")
  4. set_license("GPL-3.0")
  5. add_urls("https://github.com/cutdigital/mcut/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/cutdigital/mcut.git")
  7. add_versions("v1.3.0", "5f33a8196f2ea4cb700b7ceb493c0674ab7f98fec415cbf04d546366bcc566a2")
  8. add_versions("v1.2.0", "dd339f222468a09f9b54f81ad7f21ef9b5b0b306953615d55684ba581d757297")
  9. add_versions("v1.1.0", "a31efbb4c963a40574ee0bad946d02dc77df873f68d35524363bd71d2ae858bd")
  10. add_patches("1.3.0", path.join(os.scriptdir(), "patches", "1.2.0", "install.patch"), "f5eecb8fa8281c11ab8a10314b83bfba437009255fb46382d210010f584dabec")
  11. add_patches("1.2.0", path.join(os.scriptdir(), "patches", "1.2.0", "install.patch"), "f5eecb8fa8281c11ab8a10314b83bfba437009255fb46382d210010f584dabec")
  12. add_patches("1.1.0", path.join(os.scriptdir(), "patches", "1.1.0", "install.patch"), "438f5b76d8ad58253420844248c5da09404cc7ad4a7a19c174e90aacf714d0f0")
  13. if is_plat("linux") then
  14. add_syslinks("pthread")
  15. end
  16. add_deps("cmake")
  17. on_install("windows|x86", "windows|x64", "macosx", "linux", "mingw", function (package)
  18. -- patch gcc 13
  19. io.replace("include/mcut/internal/hmesh.h", "#include <vector>", "#include <vector>\n#include <cstdint>\n", {plain = true})
  20. local cxflags = {}
  21. if package:is_plat("mingw") then
  22. io.replace("include/mcut/internal/tpool.h", "_Acquires_lock_(return)", "", {plain = true})
  23. cxflags = "-Wa,-mbig-obj"
  24. elseif package:is_plat("windows") and package:config("shared") then
  25. package:add("defines", "MCUT_SHARED_LIB")
  26. end
  27. local configs = {"-DMCUT_BUILD_TESTS=OFF", "-DMCUT_BUILD_TUTORIALS=OFF"}
  28. table.insert(configs, "-DCMAKE_BUILD_TYPES=" .. (package:is_debug() and "Debug" or "Release"))
  29. table.insert(configs, "-DMCUT_BUILD_AS_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
  30. import("package.tools.cmake").install(package, configs, {cxflags = cxflags})
  31. end)
  32. on_test(function (package)
  33. assert(package:check_cxxsnippets({test = [[
  34. void test() {
  35. McContext context = MC_NULL_HANDLE;
  36. mcCreateContext(&context, MC_NULL_HANDLE);
  37. }
  38. ]]}, {configs = {languages = "c++11"}, includes = "mcut/mcut.h"}))
  39. end)