Skip to content

Commit a8981df

Browse files
authored
openmvs: fix build (#8484)
* openmvs: fix build * update * fix links * fix linux clang * fix error * remove linux clang
1 parent 2864e7f commit a8981df

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

packages/o/openmvs/xmake.lua

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,44 @@ package("openmvs")
33
set_description("open Multi-View Stereo reconstruction library")
44
set_license("AGPL-3.0")
55

6-
add_urls("https://github.com/cdcseacave/openMVS/archive/refs/tags/v$(version).tar.gz")
6+
add_urls("https://github.com/cdcseacave/openMVS/archive/refs/tags/$(version).tar.gz",
7+
"https://github.com/cdcseacave/openMVS.git")
78

8-
add_versions("2.3.0", "ac7312fb71dbab18c5b2755ad9ac3caa40ec689f6f369c330ca73c87c1f34258")
9+
add_versions("v2.3.0", "ac7312fb71dbab18c5b2755ad9ac3caa40ec689f6f369c330ca73c87c1f34258")
910

10-
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
11+
if is_plat("windows") then
12+
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
13+
end
1114

1215
add_configs("ceres", {description = "Enable CERES optimization library", default = false, type = "boolean"})
1316
add_configs("cuda", {description = "Enable CUDA library", default = false, type = "boolean"})
1417
add_configs("openmp", {description = "Enable OpenMP library", default = true, type = "boolean"})
1518
add_configs("python", {description = "Enable Python library bindings", default = false, type = "boolean"})
1619

17-
add_deps("cmake", "eigen", "glew", "opencv", "cgal", "vcglib", "zstd")
20+
add_deps("cmake", "cgal", "eigen <5.0", "glew", "opencv", "vcglib", "zstd")
1821
add_deps("boost", {configs = {iostreams = true, container = true, graph=true, program_options = true, serialization = true, thread = true, zlib = true, zstd = true}})
1922

20-
on_load("windows", function (package)
21-
package:add("defines", "BOOST_ALL_NO_LIB") -- disable boost auto-linking
22-
if package:toolchain("msvc") then package:add("cxxflags", "/Zc:__cplusplus") end -- enable msvc __cplusplus
23+
if on_check then
24+
on_check("linux", function (package)
25+
assert(not package:has_tool("cxx", "clang"), "Linux Clang is not supported yet.")
26+
end)
27+
end
28+
29+
add_includedirs("include", "include/OpenMVS")
30+
add_linkdirs("lib/OpenMVS")
31+
add_links("MVS", "Math", "IO", "Common")
32+
on_load(function (package)
33+
if package:has_tool("cxx", "cl") then
34+
package:add("cxxflags", "/Zc:__cplusplus")
35+
end
2336

2437
if package:config("ceres") then package:add("deps", "ceres-solver") end
2538
if package:config("cuda") then package:add("deps", "cuda") end
2639
if package:config("openmp") then package:add("deps", "openmp") end
2740
if package:config("python") then package:add("deps", "python") end
2841
end)
2942

30-
on_install("windows|x64", "windows|x86", function (package)
43+
on_install("windows|!arm64", "linux", function (package)
3144
io.replace("CMakeLists.txt", "# Project-wide settings", [[
3245
# Project-wide settings
3346
find_package(PkgConfig REQUIRED)
@@ -44,17 +57,11 @@ package("openmvs")
4457
"-DOpenMVS_ENABLE_TESTS=OFF",
4558
}
4659
import("package.tools.cmake").install(package, configs)
47-
48-
package:add("linkdirs", "lib/OpenMVS")
49-
local libs = os.files(package:installdir("lib/OpenMVS/*.lib"))
50-
for _, filepath in ipairs(libs) do
51-
package:add("links", path.basename(filepath))
52-
end
5360
end)
5461

5562
on_test(function (package)
5663
assert(package:check_cxxsnippets({test = [[
57-
#include <openMVS/MVS.h>
64+
#include "MVS.h"
5865
using namespace MVS;
5966
void test() {
6067
SEACAVE::cListTest<true>(100);
@@ -63,5 +70,5 @@ package("openmvs")
6370
SEACAVE::TestRayTriangleIntersection<float>(1000);
6471
SEACAVE::TestRayTriangleIntersection<double>(1000);
6572
}
66-
]]}, {configs = {languages = "c++11"}}))
73+
]]}, {configs = {languages = "c++14"}}))
6774
end)

0 commit comments

Comments
 (0)