summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-01 22:25:27 +0800
committerruki <[email protected]>2024-09-01 22:25:27 +0800
commita8c60009ba4b17694e13b45b733819c2fc3dce8b (patch)
tree57d6c9ac2fe33d795b3f3fedfd234f1328e44c4c
parent21ae0fa4451c40b14199fdb0df8cf61c51e26de9 (diff)
improve cosmocc for windows
-rw-r--r--tests/projects/c/cosmocc/console/xmake.lua6
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua3
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/projects/c/cosmocc/console/xmake.lua b/tests/projects/c/cosmocc/console/xmake.lua
index babd520a2..1327045c1 100644
--- a/tests/projects/c/cosmocc/console/xmake.lua
+++ b/tests/projects/c/cosmocc/console/xmake.lua
@@ -2,6 +2,12 @@ add_rules("mode.debug", "mode.release")
add_requires("cosmocc")
+-- TODO, we should add envs to toolchains/cosmocc
+if is_subhost("windoows") then
+ add_requires("msys2")
+ add_packages("msys2")
+end
+
target("test")
set_kind("binary")
add_files("src/*.c")
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
index 3923916d9..3b20eb938 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -74,9 +74,10 @@ end
-- check program
function sandbox_lib_detect_find_program._check(program, opt)
+ opt = opt or {}
local findname = program
if os.subhost() == "windows" then
- if not program:endswith(".exe") and not program:endswith(".cmd") and not program:endswith(".bat") then
+ if not opt.shell and not program:endswith(".exe") and not program:endswith(".cmd") and not program:endswith(".bat") then
findname = program .. ".exe"
end
elseif os.subhost() == "msys" and os.isfile(program) and os.filesize(program) < 256 then