From f75bba94279da494cbc84a0877af2ee6a1576a03 Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 09:00:38 +0800 Subject: [PATCH 1/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index 69b6a1df9b..cdfef677c0 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -28,13 +28,14 @@ import("detect.sdks.find_cross_toolchain") -- find mingw directory function _find_mingwdir(sdkdir) - + cprint("_find_mingwdir #1 %s", sdkdir) -- get mingw directory if not sdkdir then if is_host("macosx", "linux") and os.isdir("/opt/llvm-mingw") then sdkdir = "/opt/llvm-mingw" elseif is_host("macosx") and os.isdir("/usr/local/opt/mingw-w64") then sdkdir = "/usr/local/opt/mingw-w64" + cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" elseif is_subhost("msys") then @@ -78,6 +79,7 @@ function _find_mingw(sdkdir, bindir, cross) -- find mingw root directory sdkdir = _find_mingwdir(sdkdir) + cprint("_find_mingw #1 %s", sdkdir) if not sdkdir then return end From 4989b6b9fa31e5235e7bf7a318a4bc32952289ea Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 10:36:55 +0800 Subject: [PATCH 2/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index cdfef677c0..cd4c7e85fa 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -36,6 +36,9 @@ function _find_mingwdir(sdkdir) elseif is_host("macosx") and os.isdir("/usr/local/opt/mingw-w64") then sdkdir = "/usr/local/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) + elseif is_host("macosx") and os.isdir("/opt/homebrew/Cellar/mingw-w64") then + sdkdir = "/opt/homebrew/Cellar/mingw-w64" + cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" elseif is_subhost("msys") then From 16684a7aef604c1dbf26a9d8d704d6ae57cbd82d Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:15:47 +0800 Subject: [PATCH 3/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index cd4c7e85fa..1cd2c7e0d0 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -37,7 +37,7 @@ function _find_mingwdir(sdkdir) sdkdir = "/usr/local/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("macosx") and os.isdir("/opt/homebrew/Cellar/mingw-w64") then - sdkdir = "/opt/homebrew/Cellar/mingw-w64" + sdkdir = string.sub(find_directory("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" From 7e2d8f87d4e1ea137d29ad264caae50ea8968d59 Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:21:00 +0800 Subject: [PATCH 4/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index 1cd2c7e0d0..1959c632dd 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -37,7 +37,7 @@ function _find_mingwdir(sdkdir) sdkdir = "/usr/local/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("macosx") and os.isdir("/opt/homebrew/Cellar/mingw-w64") then - sdkdir = string.sub(find_directory("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) + sdkdir = string.sub(find_path("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" From e80ed6f4ca41149382d24d2be1706ea5705b5e42 Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:25:08 +0800 Subject: [PATCH 5/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index 1959c632dd..fd03b2fc0b 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -20,6 +20,7 @@ -- imports import("lib.detect.find_path") +import("lib.detect.find_directory") import("core.base.option") import("core.base.global") import("core.project.config") @@ -37,7 +38,7 @@ function _find_mingwdir(sdkdir) sdkdir = "/usr/local/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("macosx") and os.isdir("/opt/homebrew/Cellar/mingw-w64") then - sdkdir = string.sub(find_path("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) + sdkdir = string.sub(find_directory("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" From 57a632aa1501799d5f199a2cf06e27b28ae686b1 Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:33:38 +0800 Subject: [PATCH 6/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index fd03b2fc0b..b5eca3d5dc 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -20,7 +20,6 @@ -- imports import("lib.detect.find_path") -import("lib.detect.find_directory") import("core.base.option") import("core.base.global") import("core.project.config") @@ -37,8 +36,8 @@ function _find_mingwdir(sdkdir) elseif is_host("macosx") and os.isdir("/usr/local/opt/mingw-w64") then sdkdir = "/usr/local/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) - elseif is_host("macosx") and os.isdir("/opt/homebrew/Cellar/mingw-w64") then - sdkdir = string.sub(find_directory("bin", "/opt/homebrew/Cellar/mingw-w64"), 1, -5) + elseif is_host("macosx") and os.isdir("/opt/homebrew/opt/mingw-w64") then + sdkdir = "/opt/homebrew/opt/mingw-w64" cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" From eeeb76b2d14cd942302231bdcdde04dc39cf9928 Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:40:13 +0800 Subject: [PATCH 7/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index b5eca3d5dc..9a1f242533 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -28,17 +28,16 @@ import("detect.sdks.find_cross_toolchain") -- find mingw directory function _find_mingwdir(sdkdir) - cprint("_find_mingwdir #1 %s", sdkdir) -- get mingw directory if not sdkdir then if is_host("macosx", "linux") and os.isdir("/opt/llvm-mingw") then sdkdir = "/opt/llvm-mingw" elseif is_host("macosx") and os.isdir("/usr/local/opt/mingw-w64") then + -- for macOS Intel sdkdir = "/usr/local/opt/mingw-w64" - cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("macosx") and os.isdir("/opt/homebrew/opt/mingw-w64") then + -- for Apple Silicon sdkdir = "/opt/homebrew/opt/mingw-w64" - cprint("_find_mingwdir #2 %s", sdkdir) elseif is_host("linux") then sdkdir = "/usr" elseif is_subhost("msys") then @@ -82,7 +81,6 @@ function _find_mingw(sdkdir, bindir, cross) -- find mingw root directory sdkdir = _find_mingwdir(sdkdir) - cprint("_find_mingw #1 %s", sdkdir) if not sdkdir then return end From dcfffe48969339ee4263e69c22a5d1de60fc824b Mon Sep 17 00:00:00 2001 From: c8ef Date: Sat, 27 Apr 2024 11:41:31 +0800 Subject: [PATCH 8/8] Update find_mingw.lua --- xmake/modules/detect/sdks/find_mingw.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index 9a1f242533..4085a6cb84 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -28,6 +28,7 @@ import("detect.sdks.find_cross_toolchain") -- find mingw directory function _find_mingwdir(sdkdir) + -- get mingw directory if not sdkdir then if is_host("macosx", "linux") and os.isdir("/opt/llvm-mingw") then