2
0

xmake.lua 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package("cgal")
  2. set_homepage("https://www.cgal.org/")
  3. set_description("CGAL is a software project that provides easy access to efficient and reliable geometric algorithms in the form of a C++ library.")
  4. set_license("LGPL-3.0")
  5. add_urls("https://github.com/CGAL/cgal/releases/download/v$(version)/CGAL-$(version)-library.zip")
  6. add_versions("6.0", "f4a66cf4e276a377d263ee3db627919d1000e29bf24664a5d0b8cb82081ef706")
  7. add_versions("5.6.1", "cf3900280d96847db8ac5e174d5e889f9764c7fa4e3d99f316f89910058335e6")
  8. add_versions("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2")
  9. add_versions("5.2.1", "ccdea67db79153417504f50c534cea3bb6b0e9754e7f32fb753fc19005114db0")
  10. add_versions("5.3", "49ccfb6b72a78d03ab026c6502099ba9358cf604d9d1f51c33e90b314635fe35")
  11. add_versions("5.4", "dbca692666866df5979ef14264570b85a00f21cb77a9f9420ec0823ce8fae473")
  12. add_versions("5.5.2", "77b17ba5d43fe844c0eca7fb7eff7d5687174b037290c390f1251ef44cc4909b")
  13. add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
  14. add_configs("gmp", {description = "Use gmp/mpfr.", default = is_plat("macosx", "linux"), type = "boolean"})
  15. if is_plat("mingw") and is_subhost("msys") then
  16. add_extsources("pacman::cgal")
  17. elseif is_plat("linux") then
  18. add_extsources("pacman::cgal", "apt::libcgal-dev")
  19. elseif is_plat("macosx") then
  20. add_extsources("brew::cgal")
  21. end
  22. add_deps("cmake")
  23. add_deps("boost", "eigen")
  24. on_check("windows", "mingw", function (package)
  25. if not package:config("header_only") and (package:version():lt("6.0") or package:config("gmp")) then
  26. raise("GMP is not supported on windows yet!")
  27. end
  28. end)
  29. on_load("windows", "mingw", "macosx", "linux", function (package)
  30. if package:config("header_only") then
  31. package:set("kind", "library", {headeronly = true})
  32. end
  33. if package:config("gmp") then
  34. package:add("deps", "gmp", "mpfr")
  35. else
  36. package:add("defines", "CGAL_DISABLE_GMP")
  37. package:add("defines", "CGAL_NO_GMP")
  38. end
  39. end)
  40. on_install("windows", "mingw", "macosx", "linux", function (package)
  41. if package:version():le("5.3") then
  42. io.gsub("CMakeLists.txt", "install%(DIRECTORY.-%/demo%/.-%/demo%/.-%)", "")
  43. end
  44. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
  45. table.insert(configs, "-DCGAL_HEADER_ONLY=" .. (package:config("header_only") and "ON" or "OFF"))
  46. table.insert(configs, "-DCGAL_DISABLE_GMP=" .. (package:config("gmp") and "OFF" or "ON"))
  47. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  48. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  49. import("package.tools.cmake").install(package, configs)
  50. end)
  51. on_test(function (package)
  52. assert(package:check_cxxsnippets({test = [[
  53. #include <vector>
  54. void test() {
  55. using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
  56. using DT = CGAL::Delaunay_triangulation<K>;
  57. DT::Point p;
  58. std::vector<DT::Point> points;
  59. }
  60. ]]}, {configs = {languages = "c++17"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
  61. end)