Fix `includedirs` for opencv (homebrew) (#3317)

* fix: fix `includedirs` for opencv (homebrew)

* fix: remove redundant `for`

* fix: remove the redundant logic

* Update xmake.lua

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/3326/head
YCG 9 months ago committed by GitHub
parent 2d5545d118
commit c68170bd04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      packages/o/opencv/xmake.lua

@ -43,6 +43,7 @@ package("opencv")
if is_plat("macosx") then
add_frameworks("Foundation", "CoreFoundation", "CoreGraphics", "AppKit", "OpenCL", "Accelerate")
add_extsources("brew::opencv")
elseif is_plat("linux") then
add_extsources("pacman::opencv", "apt::libopencv-dev")
add_syslinks("pthread", "dl")
@ -50,6 +51,22 @@ package("opencv")
add_syslinks("gdi32", "user32", "glu32", "opengl32", "advapi32", "comdlg32", "ws2_32")
end
on_fetch("macosx", function (package, opt)
if opt.system then
local result = package:find_package("brew::opencv", opt)
if result then
for _, includedir in ipairs(result.sysincludedirs or result.includedirs) do
local dir = path.join(includedir, "opencv4")
if os.isdir(dir) then
result.includedirs = table.wrap(result.includedirs)
table.insert(result.includedirs, dir)
end
end
end
return result
end
end)
on_load("linux", "macosx", "windows", "mingw@windows,msys", function (package)
if package:is_plat("windows") then
local arch = "x64"

Loading…
Cancel
Save