xmake.lua 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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("eigen")
  24. add_deps("boost", {configs = {
  25. accumulators = true, algorithm = true, bimap = true, callable_traits = true, concept_check = true,
  26. container = true, core = true, detail = true, filesystem = true, format = true, functional = true,
  27. fusion = true, geometry = true, graph = true, heap = true, intrusive = true, iostreams = true,
  28. iterator = true, lambda = true, logic = true, math = true, mpl = true, multi_array = true,
  29. multi_index = true, multiprecision = true, numeric_conversion = true, optional = true,
  30. parameter = true, pool = true, preprocessor = true, property_map = true, property_tree = true,
  31. ptr_container = true, random = true, range = true, serialization = true, spirit = true,
  32. thread = true, tuple = true, type_traits = true, units = true, utility = true, variant = true}})
  33. on_check("windows", "mingw", function (package)
  34. if not package:config("header_only") and (package:version():lt("6.0") or package:config("gmp")) then
  35. raise("GMP is not supported on windows yet!")
  36. end
  37. end)
  38. on_load("windows", "mingw", "macosx", "linux", function (package)
  39. if package:config("header_only") then
  40. package:set("kind", "library", {headeronly = true})
  41. end
  42. if package:config("gmp") then
  43. package:add("deps", "gmp", "mpfr")
  44. else
  45. package:add("defines", "CGAL_DISABLE_GMP")
  46. package:add("defines", "CGAL_NO_GMP")
  47. end
  48. end)
  49. on_install("windows", "mingw", "macosx", "linux", function (package)
  50. if package:version():le("5.3") then
  51. io.gsub("CMakeLists.txt", "install%(DIRECTORY.-%/demo%/.-%/demo%/.-%)", "")
  52. end
  53. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
  54. table.insert(configs, "-DCGAL_HEADER_ONLY=" .. (package:config("header_only") and "ON" or "OFF"))
  55. table.insert(configs, "-DCGAL_DISABLE_GMP=" .. (package:config("gmp") and "OFF" or "ON"))
  56. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  57. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  58. import("package.tools.cmake").install(package, configs)
  59. end)
  60. on_test(function (package)
  61. assert(package:check_cxxsnippets({test = [[
  62. #include <vector>
  63. void test() {
  64. using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
  65. using DT = CGAL::Delaunay_triangulation<K>;
  66. DT::Point p;
  67. std::vector<DT::Point> points;
  68. }
  69. ]]}, {configs = {languages = "c++17"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
  70. end)