2
0

xmake.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2")
  7. add_versions("5.2.1", "ccdea67db79153417504f50c534cea3bb6b0e9754e7f32fb753fc19005114db0")
  8. add_versions("5.3", "49ccfb6b72a78d03ab026c6502099ba9358cf604d9d1f51c33e90b314635fe35")
  9. add_versions("5.4", "dbca692666866df5979ef14264570b85a00f21cb77a9f9420ec0823ce8fae473")
  10. add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
  11. if is_plat("mingw") and is_subhost("msys") then
  12. add_extsources("pacman::cgal")
  13. elseif is_plat("linux") then
  14. add_extsources("pacman::cgal", "apt::libcgal-dev")
  15. elseif is_plat("macosx") then
  16. add_extsources("brew::cgal")
  17. end
  18. add_deps("cmake")
  19. add_deps("boost", "eigen")
  20. if is_plat("macosx", "linux") then
  21. add_deps("gmp", "mpfr")
  22. end
  23. on_load("windows", function (package)
  24. package:add("defines", "CGAL_NO_GMP")
  25. if not package:config("header_only") then
  26. raise("Non-header-only version is not supported yet!")
  27. end
  28. end)
  29. on_install("windows", "macosx", "linux", function (package)
  30. if package:version():le("5.3") then
  31. io.gsub("CMakeLists.txt", "install%(DIRECTORY.-%/demo%/.-%/demo%/.-%)", "")
  32. end
  33. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
  34. table.insert(configs, "-DCGAL_HEADER_ONLY=" .. (package:config("header_only") and "ON" or "OFF"))
  35. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  36. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  37. import("package.tools.cmake").install(package, configs)
  38. end)
  39. on_test(function (package)
  40. assert(package:check_cxxsnippets({test = [[
  41. #include <vector>
  42. void test() {
  43. using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
  44. using DT = CGAL::Delaunay_triangulation<K>;
  45. DT::Point p;
  46. std::vector<DT::Point> points;
  47. }
  48. ]]}, {configs = {languages = "c++14"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
  49. end)