summaryrefslogtreecommitdiff
path: root/xmake/modules/package/manager/brew/find_package.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/package/manager/brew/find_package.lua')
-rw-r--r--xmake/modules/package/manager/brew/find_package.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/modules/package/manager/brew/find_package.lua b/xmake/modules/package/manager/brew/find_package.lua
index 49db5a464..9706bfd8e 100644
--- a/xmake/modules/package/manager/brew/find_package.lua
+++ b/xmake/modules/package/manager/brew/find_package.lua
@@ -67,14 +67,16 @@ function main(name, opt)
-- find package from pkg-config/*.pc, attempt to find it from `brew --prefix`/package first
local result = nil
- local pcfile = find_file(pcname .. ".pc", path.join(brew_pkg_rootdir, nameinfo[1], "*/lib/pkgconfig"))
+ local pcfile = find_file(pcname .. ".pc", path.join(brew_pkg_rootdir, nameinfo[1], "*/lib/pkgconfig")) or
+ find_file(pcname .. ".pc", path.join(brew_pkg_rootdir, nameinfo[1], "*/share/pkgconfig"))
if not pcfile then
-- attempt to find it from `brew --prefix package`
local brew = find_tool("brew")
local brew_pkgdir = brew and try {function () return os.iorunv(brew.program, {"--prefix", nameinfo[1]}) end}
if brew_pkgdir then
brew_pkgdir = brew_pkgdir:trim()
- pcfile = find_file(pcname .. ".pc", path.join(brew_pkgdir, "lib/pkgconfig"))
+ pcfile = find_file(pcname .. ".pc", path.join(brew_pkgdir, "lib/pkgconfig")) or
+ find_file(pcname .. ".pc", path.join(brew_pkgdir, "share/pkgconfig"))
end
end
if pcfile then
@@ -97,11 +99,11 @@ function main(name, opt)
if pkgdir then
local links = {}
for _, libfile in ipairs(os.files(path.join(pkgdir, "lib", "*.a"))) do
- table.insert(links, target.linkname(path.filename(libfile)))
+ table.insert(links, target.linkname(path.filename(libfile), {plat = opt.plat}))
end
for _, libfile in ipairs(os.files(path.join(pkgdir, "lib", opt.plat == "macosx" and "*.dylib" or "*.so"))) do
if not os.islink(libfile) then
- table.insert(links, target.linkname(path.filename(libfile)))
+ table.insert(links, target.linkname(path.filename(libfile), {plat = opt.plat}))
end
end
opt.links = links