diff options
| author | cofecofe <[email protected]> | 2024-06-24 15:31:54 +0800 |
|---|---|---|
| committer | cofecofe <[email protected]> | 2024-06-24 15:31:54 +0800 |
| commit | 325cc705e90699ae827bdcb0f48c2e596900b86c (patch) | |
| tree | e14e8d73aded1d2932ad07bb7fc7ca3da80bf1fc | |
| parent | fa31b585a779625eb70954b37aac7bb7df4a5518 (diff) | |
change different module to get compiler version.
| -rw-r--r-- | xmake/modules/detect/sdks/find_mdk.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_armclang.lua | 4 | ||||
| -rw-r--r-- | xmake/toolchains/armclang/xmake.lua | 7 |
3 files changed, 7 insertions, 6 deletions
diff --git a/xmake/modules/detect/sdks/find_mdk.lua b/xmake/modules/detect/sdks/find_mdk.lua index 231b3cf4d..a2af360f1 100644 --- a/xmake/modules/detect/sdks/find_mdk.lua +++ b/xmake/modules/detect/sdks/find_mdk.lua @@ -73,8 +73,6 @@ function _find_mdk(sdkdir) -- armclang sdk directory local sdkdir_armclang = path.join(sdkdir, "armclang") if os.isdir(sdkdir_armclang) and os.isfile(path.join(sdkdir_armclang, "bin", "armclang.exe")) then - local sdk_armclang_ver = os.iorun(path.join(sdkdir_armclang, "bin", "armclang.exe").." --version_number") - result.sdk_armclang_vernum = tonumber(sdk_armclang_ver) result.sdkdir_armclang = sdkdir_armclang end return result diff --git a/xmake/modules/detect/tools/find_armclang.lua b/xmake/modules/detect/tools/find_armclang.lua index ed6b0bbfe..6232138c9 100644 --- a/xmake/modules/detect/tools/find_armclang.lua +++ b/xmake/modules/detect/tools/find_armclang.lua @@ -39,7 +39,9 @@ import("detect.sdks.find_mdk") function main(opt) -- init options - opt = opt or {} + opt = opt or {} + opt.command = opt.command or "--version" + opt.parse = opt.parse or function (output) return output:match("Arm Compiler for Embedded (%d+%.?%d+%.?%d+)%s") end -- find program local program = find_program(opt.program or "armclang.exe", opt) diff --git a/xmake/toolchains/armclang/xmake.lua b/xmake/toolchains/armclang/xmake.lua index 76fac3b53..3fa8885d4 100644 --- a/xmake/toolchains/armclang/xmake.lua +++ b/xmake/toolchains/armclang/xmake.lua @@ -57,9 +57,10 @@ toolchain("armclang") arch_target = "aarch64-arm-none-eabi" end - import("detect.sdks.find_mdk") - local mdk = find_mdk() - if mdk.sdk_armclang_vernum > 6140000 then + import("lib.detect.find_tool") + import("core.base.semver") + local armclang = find_tool("armclang", {version = true}) + if semver.compare(armclang.version, "6.13")>0 then toolchain:set("toolset", "as", "armclang") toolchain:add("cxflags", "--target=" .. arch_target) toolchain:add("cxflags", "-mcpu=" .. arch_cpu) |
