xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libfive")
  2. set_homepage("https://libfive.com/")
  3. set_description("libfive is a software library and set of tools for solid modeling, especially suited for parametric and procedural design.")
  4. add_urls("https://github.com/libfive/libfive.git")
  5. add_versions("2021.04.08", "e6a6448694f2204b003e29bba45754461261b9b2")
  6. add_versions("2022.02.22", "03b592cfc0fa3d9b3cf8117c191e0836d88a89a3")
  7. add_deps("cmake", "libpng", "boost")
  8. if is_plat("windows") then
  9. add_deps("eigen 3.3.x")
  10. else
  11. add_deps("pkg-config", "eigen")
  12. end
  13. on_install("windows", "macosx", "linux", function (package)
  14. if package:is_plat("windows") then
  15. io.replace("libfive/src/CMakeLists.txt", "EIGEN_INCLUDE_DIRS", "EIGEN3_INCLUDE_DIRS", {plain = true})
  16. io.replace("CMakeLists.txt", "%/MD.", "")
  17. end
  18. io.replace("libfive/src/CMakeLists.txt", "bash -c \"git diff --quiet --exit-code || echo +\"", "git diff --quiet --exit-code", {plain = true})
  19. io.replace("libfive/src/CMakeLists.txt", "${GIT_REV}${GIT_DIFF}", "${GIT_REV}+${GIT_DIFF}", {plain = true})
  20. io.replace("libfive/src/CMakeLists.txt", "if ?%(UNIX%)", "if (TRUE)")
  21. local configs = {"-DBUILD_GUILE_BINDINGS=OFF", "-DBUILD_PYTHON_BINDINGS=OFF", "-DBUILD_STUDIO_APP=OFF", "-DBUILD_TESTS=OFF"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. if package:config("pic") ~= false then
  25. table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
  26. end
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("libfive_mesh_delete", {includes = "libfive.h"}))
  31. end)