Pārlūkot izejas kodu

add openmvs, fix some packages (#7283)

* add openmvs, fix some packages

* re-check cgal x86 build, while using boost

* fix header error

* windows|x64/x86

---------

Co-authored-by: Saikari <[email protected]>
choyy 2 mēneši atpakaļ
vecāks
revīzija
dd0994a8a5

+ 2 - 0
packages/b/breakpad/port/xmake.lua

@@ -39,6 +39,7 @@ target("breakpad")
                       "src/client/windows/crash_generation/*.cc",
                       "src/client/windows/handler/*.cc")
             remove_files("src/common/windows/*test*.cc",
+                         "src/processor/disassembler_objdump.cc",
                          "src/common/language.cc",
                          "src/common/path_helper.cc",
                          "src/common/stabs_to_module.cc",
@@ -50,6 +51,7 @@ target("breakpad")
                             "src/(client/windows/crash_generation/*.h)",
                             "src/(client/windows/handler/*.h)")
             remove_headerfiles("src/common/windows/*test*.h",
+                               "src/processor/disassembler_objdump.h",
                                "src/common/language.h",
                                "src/common/path_helper.h",
                                "src/common/stabs_to_module.h",

+ 10 - 1
packages/c/cgal/xmake.lua

@@ -25,7 +25,16 @@ package("cgal")
     end
 
     add_deps("cmake")
-    add_deps("boost", "eigen")
+    add_deps("eigen")
+    add_deps("boost", {configs = {
+        accumulators = true, algorithm = true, bimap = true, callable_traits = true, concept_check = true,
+        container = true, core = true, detail = true, filesystem = true, format = true, functional = true,
+        fusion = true, geometry = true, graph = true, heap = true, intrusive = true, iostreams = true,
+        iterator = true, lambda = true, logic = true, math = true, mpl = true, multi_array = true,
+        multi_index = true, multiprecision = true, numeric_conversion = true, optional = true,
+        parameter = true, pool = true, preprocessor = true, property_map = true, property_tree = true,
+        ptr_container = true, random = true, range = true, serialization = true, spirit = true,
+        thread = true, tuple = true, type_traits = true, units = true, utility = true, variant = true}})
     on_check("windows", "mingw", function (package)
         if not package:config("header_only") and (package:version():lt("6.0") or package:config("gmp")) then
             raise("GMP is not supported on windows yet!")

+ 67 - 0
packages/o/openmvs/xmake.lua

@@ -0,0 +1,67 @@
+package("openmvs")
+    set_homepage("https://github.com/cdcseacave/openMVS")
+    set_description("open Multi-View Stereo reconstruction library")
+    set_license("AGPL-3.0")
+
+    add_urls("https://github.com/cdcseacave/openMVS/archive/refs/tags/v$(version).tar.gz")
+
+    add_versions("2.3.0", "ac7312fb71dbab18c5b2755ad9ac3caa40ec689f6f369c330ca73c87c1f34258")
+
+    add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+
+    add_configs("ceres", {description = "Enable CERES optimization library", default = false, type = "boolean"})
+    add_configs("cuda", {description = "Enable CUDA library", default = false, type = "boolean"})
+    add_configs("openmp", {description = "Enable OpenMP library", default = true, type = "boolean"})
+    add_configs("python", {description = "Enable Python library bindings", default = false, type = "boolean"})
+
+    add_deps("cmake", "eigen", "glew", "opencv", "cgal", "vcglib", "zstd")
+    add_deps("boost", {configs = {iostreams = true, container = true, graph=true, program_options = true, serialization = true, thread = true, zlib = true, zstd = true}})
+
+    on_load("windows", function (package)
+        package:add("defines", "BOOST_ALL_NO_LIB") -- disable boost auto-linking
+        if package:toolchain("msvc") then package:add("cxxflags", "/Zc:__cplusplus") end -- enable msvc __cplusplus
+
+        if package:config("ceres") then package:add("deps", "ceres-solver") end
+        if package:config("cuda") then package:add("deps", "cuda") end
+        if package:config("openmp") then package:add("deps", "openmp") end
+        if package:config("python") then package:add("deps", "python") end
+    end)
+
+    on_install("windows|x64", "windows|x86", function (package)
+        io.replace("CMakeLists.txt", "# Project-wide settings", [[
+            # Project-wide settings
+            find_package(PkgConfig REQUIRED)
+            pkg_check_modules(libzstd REQUIRED IMPORTED_TARGET libzstd)
+        ]], {plain = true})
+        io.replace("libs/Common/Types.h", "#include <new>", "#include <new>\n#include <bitset>", {plain = true})
+        local configs = {
+            "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"),
+            "-DOpenMVS_USE_PYTHON=" .. (package:config("python") and "ON" or "OFF"),
+            "-DOpenMVS_USE_CERES=" .. (package:config("ceres") and "ON" or "OFF"),
+            "-DOpenMVS_USE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"),
+            "-DCGAL_DISABLE_GMP=ON",
+            "-DOpenMVS_BUILD_TOOLS=OFF",
+            "-DOpenMVS_ENABLE_TESTS=OFF",
+        }
+        import("package.tools.cmake").install(package, configs)
+
+        package:add("linkdirs", "lib/OpenMVS")
+        local libs = os.files(package:installdir("lib/OpenMVS/*.lib"))
+        for _, filepath in ipairs(libs) do
+            package:add("links", path.basename(filepath))
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <openMVS/MVS.h>
+            using namespace MVS;
+            void test() {
+                SEACAVE::cListTest<true>(100);
+                SEACAVE::OctreeTest<double,2>(100);
+                SEACAVE::OctreeTest<float,3>(100);
+                SEACAVE::TestRayTriangleIntersection<float>(1000);
+                SEACAVE::TestRayTriangleIntersection<double>(1000);
+            }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)