Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/o/openmvs/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,37 @@ package("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_urls("https://github.com/cdcseacave/openMVS/archive/refs/tags/$(version).tar.gz",
"https://github.com/cdcseacave/openMVS.git")

add_versions("2.3.0", "ac7312fb71dbab18c5b2755ad9ac3caa40ec689f6f369c330ca73c87c1f34258")
add_versions("v2.3.0", "ac7312fb71dbab18c5b2755ad9ac3caa40ec689f6f369c330ca73c87c1f34258")

add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end

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("cmake", "eigen <5.0", "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)
on_load(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
package:add("linkdirs", "lib/OpenMVS")
if package:has_tool("cxx", "cl") then
package:add("cxxflags", "/Zc:__cplusplus")
end

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)
on_install("windows", "linux", "macosx", function (package)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While extending on_install to support more platforms is correct, the logic for adding library links was removed from this block but not replaced with a cross-platform equivalent. This will likely cause linking errors for projects that depend on openmvs.

The original code was Windows-specific. Please add a cross-platform implementation inside the on_install block, after import("package.tools.cmake").install(package, configs). For example:

        -- Add library links for consumers
        local libdir = package:installdir("lib/OpenMVS")
        if os.isdir(libdir) then
            for _, name in ipairs(os.findlibs("*", {libdir})) do
                package:add("links", name)
            end
        end

io.replace("CMakeLists.txt", "# Project-wide settings", [[
# Project-wide settings
find_package(PkgConfig REQUIRED)
Expand All @@ -44,12 +50,6 @@ package("openmvs")
"-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)
Expand Down
Loading