diff options
| author | ruki <[email protected]> | 2024-12-17 00:46:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-12-17 00:46:52 +0800 |
| commit | f113930e9714a5b2b9227f008a08d66c0e725a2a (patch) | |
| tree | 955ddd83d485ad05dad85d0a9e28d83311be4c7f | |
| parent | b504cb32e1c05f69ab2e5ea38a6c13e667d4c335 (diff) | |
improve to find nuget packages
| -rw-r--r-- | xmake/modules/package/manager/nuget/find_package.lua | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/xmake/modules/package/manager/nuget/find_package.lua b/xmake/modules/package/manager/nuget/find_package.lua index 55b83a6f8..896eeb243 100644 --- a/xmake/modules/package/manager/nuget/find_package.lua +++ b/xmake/modules/package/manager/nuget/find_package.lua @@ -60,17 +60,24 @@ import("core.project.target") function _find_package(name, result, opt) local arch = opt.arch local plat = opt.plat - local mode = opt.mode + local configs = opt.configs or {} local libinfo = opt.libraries[name] if libinfo then + local libarchs = {x64 = "x64", x86 = "Win32", arm64 = "arm64"} + local runtimes = { + MT = "MultiThreaded", + MTd = "MultiThreadedDebug", + MD = "MultiThreadedDLL", + MDd = "MultiThreadedDebugDLL"} local installdir = path.join(opt.packagesdir, name) local libdir = "build/native/lib" - local runtime = "MultiThreadedDLL" + local runtime = assert(runtimes[configs.runtimes], "unknown runtimes %s", configs.runtimes) local toolset = "v142" - local libmode = mode == "debug" and "Debug" or "Release" + local libarch = libarchs[arch] or "x64" + local libmode = configs.debug and "Debug" or "Release" for _, file in ipairs(libinfo.files) do local filepath = path.join(installdir, file) - file = file:lower():trim() + file = file:trim() -- get includedirs if file:find("/include/", 1, true) then @@ -80,8 +87,8 @@ function _find_package(name, result, opt) -- get linkdirs and links if file:endswith(".lib") then - local libfile = path.unix(path.join(libdir, toolset, libmode, runtime)) - if file:startswith(libfile) then + local libfile = path.unix(path.join(libdir, libarch, toolset, libmode, runtime)) + if file:startswith(libfile .. "/") then result.links = result.links or {} result.linkdirs = result.linkdirs or {} result.libfiles = result.libfiles or {} @@ -137,6 +144,7 @@ function main(name, opt) metainfo.plat = opt.plat metainfo.arch = opt.arch metainfo.mode = opt.mode + metainfo.configs = opt.configs metainfo.targets = targets metainfo.libraries = manifest.libraries if manifest.project and manifest.project.restore then @@ -151,3 +159,4 @@ function main(name, opt) end end + |
