diff options
| author | ruki <[email protected]> | 2020-11-01 21:57:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-01 21:57:31 +0800 |
| commit | 98f442fd4da0bc5912fd2d5b31347c678d5c484d (patch) | |
| tree | 9191efac1a16fa96ff1b0d35c4c5e9d55b956751 | |
| parent | db442a672ce924832a7ba50ff441a4853515a823 (diff) | |
add cross for toolchain
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 6 | ||||
| -rw-r--r-- | xmake/toolchains/cross/check.lua | 2 | ||||
| -rw-r--r-- | xmake/toolchains/cross/load.lua | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index ba9a9cf1f..9597ec88b 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -171,6 +171,11 @@ function _instance:script(name) return self:info():get(name) end +-- get the cross +function _instance:cross() + return config.get("cross") or self:get("cross") +end + -- get the bin directory function _instance:bindir() return config.get("bin") or self:get("bindir") @@ -343,6 +348,7 @@ function toolchain.apis() values = { "toolchain.set_kind" + , "toolchain.set_cross" , "toolchain.set_bindir" , "toolchain.set_sdkdir" , "toolchain.set_archs" diff --git a/xmake/toolchains/cross/check.lua b/xmake/toolchains/cross/check.lua index c4f650082..ad62c83b2 100644 --- a/xmake/toolchains/cross/check.lua +++ b/xmake/toolchains/cross/check.lua @@ -28,7 +28,7 @@ function main(toolchain) -- is cross? local sdkdir = toolchain:sdkdir() local bindir = toolchain:bindir() - local cross = config.get("cross") + local cross = toolchain:cross() if not sdkdir and not bindir and not cross then return end diff --git a/xmake/toolchains/cross/load.lua b/xmake/toolchains/cross/load.lua index 26fea7d5e..660a21fab 100644 --- a/xmake/toolchains/cross/load.lua +++ b/xmake/toolchains/cross/load.lua @@ -28,7 +28,7 @@ function main(toolchain) import("core.project.config") -- get cross prefix - local cross = config.get("cross") or "" + local cross = toolchain:cross() or "" -- set toolset toolchain:set("toolset", "cc", cross .. "gcc", cross .. "clang") |
