diff options
| author | ruki <[email protected]> | 2024-06-03 23:25:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-06-03 23:25:42 +0800 |
| commit | 8138175b772e6b357e76db889d54a86803775959 (patch) | |
| tree | 495b1261920c081d85861edecc2d86da05ed1bb9 | |
| parent | abe38b04e998519831853b993ddb14bb6d725b02 (diff) | |
improve to find dll for cargo
| -rw-r--r-- | xmake/modules/core/tools/rustc.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/package/manager/cargo/find_package.lua | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua index 13451aa96..4d38c56f2 100644 --- a/xmake/modules/core/tools/rustc.lua +++ b/xmake/modules/core/tools/rustc.lua @@ -80,6 +80,11 @@ function nf_framework(self, framework) local basename = path.basename(framework) -- return "mycrate" from libmycrate-f882feaebb8ba0ca.rlib or libmycrate.rlib local cratename = basename:match("lib(.-)%-.-") or basename:match("lib(.+)") + if not cratename and framework:endswith(".dll") then + -- @see https://github.com/xmake-io/xmake/issues/5156#issuecomment-2143978086 + -- mycrate-f882feaebb8ba0ca.dll or mycrate.dll + cratename = basename:split("-", {plain = true})[1] + end if cratename then return {"--extern", cratename .. "=" .. framework} end diff --git a/xmake/modules/package/manager/cargo/find_package.lua b/xmake/modules/package/manager/cargo/find_package.lua index 87f46bb8a..2c0e74506 100644 --- a/xmake/modules/package/manager/cargo/find_package.lua +++ b/xmake/modules/package/manager/cargo/find_package.lua @@ -151,7 +151,8 @@ function main(name, opt) if is_host("macosx") then libfiles_native_host = os.files(path.join(librarydir_host, "*.dylib")) elseif is_host("windows") then - libfiles_native_host = os.files(path.join(librarydir_host, "*.lib")) + libfiles_native_host = os.files(path.join(librarydir_host, "*.lib|*.dll.lib")) + table.join2(libfiles_native_host, os.files(path.join(librarydir_host, "*.dll"))) else libfiles_native_host = os.files(path.join(librarydir_host, "*.so")) end |
