diff options
| author | ruki <[email protected]> | 2025-09-17 00:53:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-17 00:53:34 +0800 |
| commit | 8f2b49d09f78829ebca18c910647421e3509c9b5 (patch) | |
| tree | 9231ef9c49f5269626d7c66bebe54f1669ac9eed | |
| parent | 63c49fb4d349a51899a04a6de77e79623cfa43f1 (diff) | |
improve to find cl
| -rw-r--r-- | xmake/modules/detect/tools/find_ar.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_cl.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_clang_cl.lua | 9 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_link.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_llvm_ar.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ml.lua | 14 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ml64.lua | 16 |
7 files changed, 22 insertions, 36 deletions
diff --git a/xmake/modules/detect/tools/find_ar.lua b/xmake/modules/detect/tools/find_ar.lua index 47dc11276..caac33278 100644 --- a/xmake/modules/detect/tools/find_ar.lua +++ b/xmake/modules/detect/tools/find_ar.lua @@ -51,7 +51,8 @@ end -- @endcode -- function main(opt) - opt = opt or {} + opt = opt or {} opt.check = opt.check or _check + opt.norunfile = true return find_program(opt.program or "ar", opt) end diff --git a/xmake/modules/detect/tools/find_cl.lua b/xmake/modules/detect/tools/find_cl.lua index f7c970987..2e38cd71f 100644 --- a/xmake/modules/detect/tools/find_cl.lua +++ b/xmake/modules/detect/tools/find_cl.lua @@ -35,10 +35,9 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options - opt = opt or {} - opt.check = opt.check or function (program) + opt = opt or {} + opt.norunfile = true + opt.check = opt.check or function (program) local ok = try { function () os.runv(program, {}, {envs = opt.envs}); return true end } if not ok then -- @see https://github.com/xmake-io/xmake/issues/3057 diff --git a/xmake/modules/detect/tools/find_clang_cl.lua b/xmake/modules/detect/tools/find_clang_cl.lua index f222f2989..e297fa250 100644 --- a/xmake/modules/detect/tools/find_clang_cl.lua +++ b/xmake/modules/detect/tools/find_clang_cl.lua @@ -35,15 +35,10 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options opt = opt or {} - - -- find program - local program = find_program(opt.program or "clang-cl.exe", opt) - - -- find program version + opt.norunfile = true local version = nil + local program = find_program(opt.program or "clang-cl.exe", opt) if program and opt and opt.version then version = find_programver(program, opt) end diff --git a/xmake/modules/detect/tools/find_link.lua b/xmake/modules/detect/tools/find_link.lua index 16a0e478b..7966e2ede 100644 --- a/xmake/modules/detect/tools/find_link.lua +++ b/xmake/modules/detect/tools/find_link.lua @@ -43,6 +43,7 @@ function main(opt) -- init options opt = opt or {} + opt.norunfile = true opt.check = opt.check or function (program) local toolchain = opt.toolchain if toolchain and toolchain:name() == "masm32" then diff --git a/xmake/modules/detect/tools/find_llvm_ar.lua b/xmake/modules/detect/tools/find_llvm_ar.lua index 44fe88628..ba3c29dc9 100644 --- a/xmake/modules/detect/tools/find_llvm_ar.lua +++ b/xmake/modules/detect/tools/find_llvm_ar.lua @@ -37,17 +37,13 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options opt = opt or {} + opt.norunfile = true opt.check = opt.check or "-h" opt.command = opt.command or "--version" - -- find program - local program = find_program(opt.program or "llvm-ar", opt) - - -- find program version local version = nil + local program = find_program(opt.program or "llvm-ar", opt) if program and opt.version then version = find_programver(program, opt) end diff --git a/xmake/modules/detect/tools/find_ml.lua b/xmake/modules/detect/tools/find_ml.lua index 513fe31ab..3163130c2 100644 --- a/xmake/modules/detect/tools/find_ml.lua +++ b/xmake/modules/detect/tools/find_ml.lua @@ -35,16 +35,14 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) + opt = opt or {} + opt.norunfile = true + opt.check = opt.check or function (program) + os.runv(program, {}, {envs = opt.envs}) + end - -- init options - opt = opt or {} - opt.check = opt.check or function (program) os.runv(program, {}, {envs = opt.envs}) end - - -- find program - local program = find_program(opt.program or "ml.exe", opt) - - -- find program version local version = nil + local program = find_program(opt.program or "ml.exe", opt) if program and opt and opt.version then opt.command = opt.command or function () local _, info = os.iorunv(program, {}, {envs = opt.envs}); return info end opt.parse = opt.parse or function (output) return output:match("Version (%d+%.?%d*%.?%d*.-)%s") end diff --git a/xmake/modules/detect/tools/find_ml64.lua b/xmake/modules/detect/tools/find_ml64.lua index 1535fc6e8..8551fc414 100644 --- a/xmake/modules/detect/tools/find_ml64.lua +++ b/xmake/modules/detect/tools/find_ml64.lua @@ -35,23 +35,19 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) + opt = opt or {} + opt.norunfile = true + opt.check = opt.check or function (program) + os.runv(program, {}, {envs = opt.envs}) + end - -- init options - opt = opt or {} - opt.check = opt.check or function (program) os.runv(program, {}, {envs = opt.envs}) end - - -- find program - local program = find_program(opt.program or "ml64.exe", opt) - - -- find program version local version = nil + local program = find_program(opt.program or "ml64.exe", opt) if program and opt and opt.version then opt.command = opt.command or function () local _, info = os.iorunv(program, {}, {envs = opt.envs}); return info end opt.parse = opt.parse or function (output) return output:match("Version (%d+%.?%d*%.?%d*.-)%s") end version = find_programver(program, opt) end - - -- ok? return program, version end |
