From b2324c456276dc451a19edb9ace2fb640df3e0c4 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 16 Mar 2022 23:20:15 +0800 Subject: improve find_mingw --- xmake/modules/detect/sdks/find_mingw.lua | 5 ++++- xmake/modules/private/action/require/impl/actions/install.lua | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index e5276834b..52cf75608 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -48,8 +48,11 @@ function _find_mingwdir(sdkdir) if not sdkdir then local pathenv = os.getenv("PATH") if pathenv then + local buildhash_pattern = string.rep('%x', 32) + local match_pattern = "[\\/]packages[\\/]%w[\\/][^\\/]+[\\/][^\\/]+[\\/]" .. buildhash_pattern .. "[\\/]bin" for _, p in ipairs(path.splitenv(pathenv)) do - if p:find(string.ipattern("mingw[%w%-%_%+]*[\\/]bin")) and path.filename(p) == "bin" and os.isdir(p) then + if (p:find(match_pattern) or p:find(string.ipattern("mingw[%w%-%_%+]*[\\/]bin"))) and + path.filename(p) == "bin" and os.isdir(p) then sdkdir = path.directory(p) break end diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index fb8abd6b4..9548b9f5b 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -109,7 +109,6 @@ function _fix_paths_for_precompiled_package(package) local buildhash_pattern = string.rep('%x', 32) local match_pattern = "[\\/]packages[\\/]%w[\\/][^\\/]+[\\/][^\\/]+[\\/]" .. buildhash_pattern .. "[\\/]" local prefix = path.directory(core_package.installdir()) - local filepaths = {path.join(package:installdir(), "**.cmake|include/**")} for _, filepath in ipairs(filepaths) do for _, file in ipairs(os.files(filepath)) do -- cgit v1.3.1