xmake.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package("colmap")
  2. set_homepage("https://colmap.github.io/")
  3. set_description("COLMAP - Structure-from-Motion and Multi-View Stereo.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/colmap/colmap/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/colmap/colmap.git")
  7. add_versions("3.13.0", "98a8f8cf6358774be223239a9b034cc9d55bf66c43f54fc6ddea9128a1ee197a")
  8. add_patches(">3.0", "patches/deps.patch", "93f43c149b95195bf03f30b22710502faa4c26242e7a7059881464c0b1fde2e6")
  9. add_configs("simd", {description = "Enable SIMD optimizations.", default = true, type = "boolean"})
  10. add_configs("openmp", {description = "Enable OpenMP parallelization.", default = true, type = "boolean"})
  11. add_configs("ipo", {description = "Enable interprocedural optimization.", default = true, type = "boolean"})
  12. add_configs("cuda", {description = "Enable CUDA, if available.", default = true, type = "boolean"})
  13. add_configs("gui", {description = "Enable the graphical UI.", default = false, type = "boolean"})
  14. add_configs("opengl", {description = "Enable OpenGL, if available.", default = true, type = "boolean"})
  15. add_configs("asan", {description = "Enable AddressSanitizer flags.", default = false, type = "boolean"})
  16. add_configs("tsan", {description = "Enable ThreadSanitizer flags.", default = false, type = "boolean"})
  17. add_configs("ubsan", {description = "Enable UndefinedBehaviorSanitizer flags.", default = false, type = "boolean"})
  18. add_configs("profiling", {description = "Enable google-perftools linker flags.", default = false, type = "boolean"})
  19. add_configs("cgal", {description = "Enable the CGAL library.", default = true, type = "boolean"})
  20. add_configs("lsd", {description = "Enable the LSD library.", default = true, type = "boolean"})
  21. add_deps("ceres-solver", "cmake", "eigen", "faiss", "flann", "freeimage", "glew", "glog", "metis", "pkgconf", "poselib", "sqlite3")
  22. add_deps("boost", {configs = { graph = true, program_options = true, system = true }})
  23. on_load(function (package)
  24. local confs = {"cgal", "opengl", "openmp"}
  25. for _, conf in ipairs(confs) do
  26. if package:config(conf) then
  27. package:add("deps", conf)
  28. end
  29. end
  30. end)
  31. on_install("windows|x64", "linux", "macosx", function (package)
  32. local configs = {
  33. "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"),
  34. "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"),
  35. "-DTESTS_ENABLED=OFF",
  36. "-DDOWNLOAD_ENABLED=OFF",
  37. "-DUNINSTALL_ENABLED=OFF",
  38. "-DFETCH_POSELIB=OFF",
  39. "-DFETCH_FAISS=OFF",
  40. }
  41. local confs = {"simd", "openmp", "ipo", "cuda", "gui", "opengl", "asan", "tsan", "ubsan", "profiling", "cgal", "lsd"}
  42. for _, conf in ipairs(confs) do
  43. table.insert(configs, "-D" .. conf:upper() .. "_ENABLED=" .. (package:config(conf) and "ON" or "OFF"))
  44. end
  45. import("package.tools.cmake").install(package, configs)
  46. end)
  47. on_test(function (package)
  48. assert(package:check_cxxsnippets({test = [[
  49. #include <colmap/util/string.h>
  50. void test() {
  51. std::string message = "colmap";
  52. std::string formatted = colmap::StringPrintf("Hello %s!", message.c_str());
  53. }
  54. ]]}, {configs = {languages = "c++11"}}))
  55. end)