xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("poselib")
  2. set_homepage("https://github.com/PoseLib/PoseLib")
  3. set_description("Minimal solvers for calibrated camera pose estimation")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/PoseLib/PoseLib/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/PoseLib/PoseLib.git")
  7. add_versions("v2.0.4", "caa0c1c9b882f6e36b5ced6f781406ed97d4c1f0f61aa31345ebe54633d67c16")
  8. add_deps("cmake")
  9. add_deps("eigen")
  10. on_install("!wasm and (!windows or windows|!arm64)", function (package)
  11. io.replace("CMakeLists.txt", "-march=native", "", {plain = true})
  12. io.replace("CMakeLists.txt", "-Wall -Werror -fPIC", "", {plain = true})
  13. local configs = {}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. if package:config("shared") and package:is_plat("windows") then
  17. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  18. end
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:check_cxxsnippets({test = [[
  23. void test() {
  24. std::vector<Eigen::Vector3d> x1(10, Eigen::Vector3d{});
  25. std::vector<Eigen::Vector3d> x2(10, Eigen::Vector3d{});
  26. Eigen::Matrix3d h;
  27. int res = poselib::homography_4pt(x1, x2, &h);
  28. }
  29. ]]}, {configs = {languages = "c++17"}, includes = "PoseLib/poselib.h"}))
  30. end)