xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.2.2", "e893e3560383744a13b896225a1ae97cf910fa30125cad66264b18446b9f931e")
  8. add_configs("use_z", {description = "Build Clipper2Z", default = "OFF", type = "string", values = {"ON", "OFF", "ONLY"}})
  9. if is_plat("linux") then
  10. add_syslinks("m")
  11. end
  12. add_deps("cmake")
  13. on_install(function (package)
  14. local configs = {"-DCLIPPER2_UTILS=OFF", "-DCLIPPER2_EXAMPLES=OFF", "-DCLIPPER2_TESTS=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. table.insert(configs, "-DCLIPPER2_USINGZ=" .. package:config("use_z"))
  18. if package:config("use_z") ~= "OFF" then
  19. package:add("defines", "USINGZ")
  20. end
  21. os.cd("CPP")
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. #include <clipper2/clipper.h>
  27. using namespace Clipper2Lib;
  28. void test() {
  29. Paths64 subject, clip, solution;
  30. subject.push_back(MakePath({100, 50, 10, 79, 65, 2, 65, 98, 10, 21}));
  31. }
  32. ]]}, {configs = {languages = "c++17"}}))
  33. end)