Skip to content

Commit

Permalink
improve armcc and armclang toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 26, 2021
1 parent ab85e9e commit 63c4692
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion xmake/core/tool/toolchain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ end
-- get the bin directory
function _instance:bindir()
local bindir = self:config("bindir") or config.get("bin") or self:info():get("bindir")
if not bindir and self:cross() and self:sdkdir() and os.isdir(path.join(self:sdkdir(), "bin")) then
if not bindir and self:is_cross() and self:sdkdir() and os.isdir(path.join(self:sdkdir(), "bin")) then
bindir = path.join(self:sdkdir(), "bin")
end
return bindir
Expand Down
12 changes: 10 additions & 2 deletions xmake/toolchains/armcc/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ toolchain("armcc")
set_homepage("https://www2.keil.com/mdk5/compiler/5")
set_description("ARM Compiler Version 5 of Keil MDK")

set_kind("standalone")
set_kind("cross")

set_toolset("cc", "armcc")
set_toolset("cxx", "armcc")
Expand All @@ -33,9 +33,17 @@ toolchain("armcc")
set_toolset("as", "armasm")

on_check(function (toolchain)
return import("lib.detect.find_tool")("armcc")
import("lib.detect.find_tool")
import("detect.sdks.find_mdk")
local mdk = find_mdk()
if mdk and mdk.sdkdir_armcc and find_tool("armcc") then
toolchain:config_set("sdkdir", mdk.sdkdir_armcc)
toolchain:configs_save()
return true
end
end)


on_load(function (toolchain)
local arch = toolchain:arch()
if arch then
Expand Down
11 changes: 9 additions & 2 deletions xmake/toolchains/armclang/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ toolchain("armclang")
set_homepage("https://www2.keil.com/mdk5/compiler/6")
set_description("ARM Compiler Version 6 of Keil MDK")

set_kind("standalone")
set_kind("cross")

set_toolset("cc", "armclang")
set_toolset("cxx", "armclang")
Expand All @@ -33,7 +33,14 @@ toolchain("armclang")
set_toolset("as", "armasm")

on_check(function (toolchain)
return import("lib.detect.find_tool")("armclang")
import("lib.detect.find_tool")
import("detect.sdks.find_mdk")
local mdk = find_mdk()
if mdk and mdk.sdkdir_armclang and find_tool("armclang") then
toolchain:config_set("sdkdir", mdk.sdkdir_armclang)
toolchain:configs_save()
return true
end
end)

on_load(function (toolchain)
Expand Down

0 comments on commit 63c4692

Please sign in to comment.