xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("clipper2")
  2. set_homepage("https://github.com/AngusJohnson/Clipper2")
  3. set_description("Polygon Clipping and Offsetting - C++, C# and Delphi")
  4. set_license("BSL-1.0")
  5. add_urls("https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_$(version).tar.gz",
  6. "https://github.com/AngusJohnson/Clipper2.git")
  7. add_versions("1.3.0", "8e537ec320e140afaa8fba1f23120416693cc1d71b0f76ad801d24b88b5e0b3c")
  8. add_versions("1.2.4", "a013d391c25c5f665cdb5cbd75cdd842dcc28f6e1bd098454beb359f6f212f33")
  9. add_versions("1.2.3", "d65bd45f50331e9dd2de3c68137c6be069fe25732095bef0128d547c997b1fda")
  10. add_versions("1.2.2", "e893e3560383744a13b896225a1ae97cf910fa30125cad66264b18446b9f931e")
  11. add_configs("use_z", {description = "Build Clipper2Z", default = "OFF", type = "string", values = {"ON", "OFF", "ONLY"}})
  12. if is_plat("linux") then
  13. add_syslinks("m")
  14. end
  15. add_deps("cmake")
  16. on_install(function (package)
  17. local configs = {"-DCLIPPER2_UTILS=OFF", "-DCLIPPER2_EXAMPLES=OFF", "-DCLIPPER2_TESTS=OFF"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  20. table.insert(configs, "-DCLIPPER2_USINGZ=" .. package:config("use_z"))
  21. if package:config("use_z") ~= "OFF" then
  22. package:add("defines", "USINGZ")
  23. end
  24. os.cd("CPP")
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <clipper2/clipper.h>
  30. using namespace Clipper2Lib;
  31. void test() {
  32. Paths64 subject, clip, solution;
  33. subject.push_back(MakePath({100, 50, 10, 79, 65, 2, 65, 98, 10, 21}));
  34. }
  35. ]]}, {configs = {languages = "c++17"}}))
  36. end)