diff options
| author | ruki <[email protected]> | 2023-12-01 22:33:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-12-01 22:33:49 +0800 |
| commit | 9efd45f108c6fe2e06cba2ca4bb63ffaf35bd8b0 (patch) | |
| tree | 6e001817083aecea6e2c266f48dee7c9236271af /xmake | |
| parent | 8404a2822d32e3d953cd87d16d21640635bd353e (diff) | |
improve to find dub packages #4455
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/modules/package/manager/dub/find_package.lua | 7 |
1 files 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 |
