xmake.lua 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.1", "d129a47329e7811b31b7343901fdb7b64d029b0cce262405fbebacd11f9b00dd")
  7. add_versions("6.0.2", "5cda4d2490c9cc2cd8d7a4b87ca0ea2ef319724e728f761f55e09bc2394249b2")
  8. add_versions("6.0", "f4a66cf4e276a377d263ee3db627919d1000e29bf24664a5d0b8cb82081ef706")
  9. add_versions("5.6.1", "cf3900280d96847db8ac5e174d5e889f9764c7fa4e3d99f316f89910058335e6")
  10. add_versions("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2")
  11. add_versions("5.2.1", "ccdea67db79153417504f50c534cea3bb6b0e9754e7f32fb753fc19005114db0")
  12. add_versions("5.3", "49ccfb6b72a78d03ab026c6502099ba9358cf604d9d1f51c33e90b314635fe35")
  13. add_versions("5.4", "dbca692666866df5979ef14264570b85a00f21cb77a9f9420ec0823ce8fae473")
  14. add_versions("5.5.2", "77b17ba5d43fe844c0eca7fb7eff7d5687174b037290c390f1251ef44cc4909b")
  15. add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
  16. add_configs("gmp", {description = "Use gmp/mpfr.", default = is_plat("macosx", "linux"), type = "boolean"})
  17. if is_plat("mingw") and is_subhost("msys") then
  18. add_extsources("pacman::cgal")
  19. elseif is_plat("linux") then
  20. add_extsources("pacman::cgal", "apt::libcgal-dev")
  21. elseif is_plat("macosx") then
  22. add_extsources("brew::cgal")
  23. end
  24. add_deps("cmake")
  25. add_deps("eigen")
  26. add_deps("boost", {configs = {
  27. accumulators = true, algorithm = true, bimap = true, callable_traits = true, concept_check = true,
  28. container = true, core = true, detail = true, filesystem = true, format = true, functional = true,
  29. fusion = true, geometry = true, graph = true, heap = true, intrusive = true, iostreams = true,
  30. iterator = true, lambda = true, logic = true, math = true, mpl = true, multi_array = true,
  31. multi_index = true, multiprecision = true, numeric_conversion = true, optional = true,
  32. parameter = true, pool = true, preprocessor = true, property_map = true, property_tree = true,
  33. ptr_container = true, random = true, range = true, serialization = true, spirit = true,
  34. thread = true, tuple = true, type_traits = true, units = true, utility = true, variant = true}})
  35. on_check("windows", "mingw", function (package)
  36. if not package:config("header_only") and (package:version():lt("6.0") or package:config("gmp")) then
  37. raise("GMP is not supported on windows yet!")
  38. end
  39. end)
  40. on_load("windows", "mingw", "macosx", "linux", function (package)
  41. if package:config("header_only") then
  42. package:set("kind", "library", {headeronly = true})
  43. end
  44. if package:config("gmp") then
  45. package:add("deps", "gmp", "mpfr")
  46. else
  47. package:add("defines", "CGAL_DISABLE_GMP")
  48. package:add("defines", "CGAL_NO_GMP")
  49. end
  50. end)
  51. on_install("windows", "mingw", "macosx", "linux", function (package)
  52. if package:version():le("5.3") then
  53. io.gsub("CMakeLists.txt", "install%(DIRECTORY.-%/demo%/.-%/demo%/.-%)", "")
  54. end
  55. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
  56. table.insert(configs, "-DCGAL_HEADER_ONLY=" .. (package:config("header_only") and "ON" or "OFF"))
  57. table.insert(configs, "-DCGAL_DISABLE_GMP=" .. (package:config("gmp") and "OFF" or "ON"))
  58. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  59. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  60. import("package.tools.cmake").install(package, configs)
  61. end)
  62. on_test(function (package)
  63. assert(package:check_cxxsnippets({test = [[
  64. #include <vector>
  65. void test() {
  66. using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
  67. using DT = CGAL::Delaunay_triangulation<K>;
  68. DT::Point p;
  69. std::vector<DT::Point> points;
  70. }
  71. ]]}, {configs = {languages = "c++17"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
  72. end)