summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmmfly <[email protected]>2022-01-09 15:36:53 +0800
committerzmmfly <[email protected]>2022-01-09 15:36:53 +0800
commitc432697422a4177b755cf5c1396251ec0cd43d87 (patch)
treef3cdf920b5a159a1016b56399b7252079723f859
parent0702f048e67ce16f83c9dd2540185bb9bd34a525 (diff)
style sync.
-rw-r--r--xmake/toolchains/armclang/xmake.lua29
1 files changed, 5 insertions, 24 deletions
diff --git a/xmake/toolchains/armclang/xmake.lua b/xmake/toolchains/armclang/xmake.lua
index d78423849..f35f9fbfb 100644
--- a/xmake/toolchains/armclang/xmake.lua
+++ b/xmake/toolchains/armclang/xmake.lua
@@ -43,25 +43,6 @@ toolchain("armclang")
end)
on_load(function (toolchain)
- -- replace function
- -- this function from https://blog.csdn.net/gouki04/article/details/88559872
- string.replace = function(s, pattern, repl)
- local i,j = string.find(s, pattern, 1, true)
- if i and j then
- local ret = {}
- local start = 1
- while i and j do
- table.insert(ret, string.sub(s, start, i-1))
- table.insert(ret, repl)
- start = j + 1
- i,j = string.find(s, pattern, start , true )
- end
- table.insert(ret, string.sub(s, start))
- return table.concat(ret)
- end
- return s
- end
-
local arch = toolchain:arch()
local arch_lower = arch:lower()
local arch_replace = ""
@@ -69,19 +50,19 @@ toolchain("armclang")
-- convert for ldflag
if arch_lower:startswith("cortex-m") then
- arch_replace = string.replace(arch_lower, "cortex-m", "Cortex-M")
+ arch_replace = arch_lower:replace("cortex-m", "Cortex-M", {plain=true})
arch_target = "arm-arm-none-eabi"
end
if arch_lower:startswith("cortex-a") then
- arch_replace = string.replace(arch_lower, "cortex-a", "Cortex-A")
+ arch_replace = arch_lower:replace("cortex-a", "Cortex-A", {plain=true})
arch_target = "aarch64-arm-none-eabi"
end
if arch_lower then
toolchain:add("cxflags", "-target=" .. arch_target)
- toolchain:add("cxflags", "-mcpu=" .. arch_lower)
+ toolchain:add("cxflags", "-mcpu=" .. arch_lower)
toolchain:add("asflags", "-target=" .. arch_target)
- toolchain:add("asflags", "-mcpu=" .. arch_lower)
- toolchain:add("ldflags", "--cpu " .. arch_replace)
+ toolchain:add("asflags", "-mcpu=" .. arch_lower)
+ toolchain:add("ldflags", "--cpu " .. arch_replace)
end
end)