From 9efd45f108c6fe2e06cba2ca4bb63ffaf35bd8b0 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 1 Dec 2023 22:33:49 +0800 Subject: improve to find dub packages #4455 --- xmake/modules/package/manager/dub/find_package.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xmake/modules/package/manager/dub/find_package.lua b/xmake/modules/package/manager/dub/find_package.lua index 372e6bbcf..e9f97b462 100644 --- a/xmake/modules/package/manager/dub/find_package.lua +++ b/xmake/modules/package/manager/dub/find_package.lua @@ -41,7 +41,7 @@ function main(name, opt) end -- get the library pattern - local libpattern = (opt.plat == "windows") and "*.lib" or "*.a" + local libpattern = (opt.plat == "windows") and "**.lib" or "**.a" -- find package local result @@ -66,9 +66,12 @@ function main(name, opt) end if pkgdir then local links = {} + local linkdirs = {} for _, libraryfile in ipairs(os.files(path.join(pkgdir, libpattern))) do table.insert(links, target.linkname(path.filename(libraryfile), {plat = opt.plat})) + table.insert(linkdirs, path.directory(libraryfile)) end + linkdirs = table.unique(linkdirs) local includedirs = {} local dubjson = path.join(pkgdir, "dub.json") if os.isfile(dubjson) then @@ -80,7 +83,7 @@ function main(name, opt) end end if #includedirs > 0 and #links > 0 then - result = {version = opt.require_version, links = links, linkdirs = pkgdir, includedirs = includedirs} + result = {version = opt.require_version, links = links, linkdirs = linkdirs, includedirs = includedirs} end end end -- cgit v1.3.1