xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("cdt")
  2. set_homepage("https://artem-ogre.github.io/CDT/")
  3. set_description("Constrained Delaunay Triangulation (C++)")
  4. set_license("MPL-2.0")
  5. add_urls("https://github.com/artem-ogre/CDT/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/artem-ogre/CDT.git", {submodules = false})
  7. add_versions("1.4.4", "97e57bdd1cf8219dcc81634236a502390a20dda3599dd3414a74343b7f03427f")
  8. add_versions("1.4.1", "86df99eb5f02a73eeb8c6ea45765eed0d7f206e8d4d9f6479f77e3c590ae5bb3")
  9. add_configs("exceptions", {description = "Enable the use of C++ exceptions", default = true, type = "boolean"})
  10. if is_plat("wasm") then
  11. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  12. end
  13. add_deps("cmake")
  14. on_install(function (package)
  15. if not package:config("shared") then
  16. package:add("defines", "CDT_STATIC_DEFINE")
  17. end
  18. os.cd("CDT")
  19. local configs = {"-DCDT_USE_AS_COMPILED_LIBRARY=ON"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. table.insert(configs, "-DCDT_DISABLE_EXCEPTIONS=" .. (package:config("exceptions") and "OFF" or "ON"))
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <CDT.h>
  28. using namespace CDT;
  29. void test() {
  30. auto cdt = Triangulation<double>{};
  31. cdt.insertVertices({
  32. {0.0, 1e38},
  33. {1.0, 1e38},
  34. });
  35. }
  36. ]]}, {configs = {languages = "cxx17"}}))
  37. end)