diff options
| author | ruki <[email protected]> | 2020-05-21 22:42:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-21 10:14:21 +0800 |
| commit | 7ddbf1f6cb9a11ef792d256bee7da417f4058168 (patch) | |
| tree | d966cf35cd939243e988ca2df29ad097036fb024 /xmake/core/platform/platform.lua | |
| parent | 38b0a926dfdab29c5c1aaeb182bdba6bda5a2970 (diff) | |
add platform.toolchains
Diffstat (limited to 'xmake/core/platform/platform.lua')
| -rw-r--r-- | xmake/core/platform/platform.lua | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 3fc92be63..182ae17d9 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -503,9 +503,7 @@ function platform.plats() local plats = {} local dirs = platform.directories() for _, dir in ipairs(dirs) do - - -- get the platform list - local platpathes = os.match(path.join(dir, "*"), true) + local platpathes = os.dirs(path.join(dir, "*")) if platpathes then for _, platpath in ipairs(platpathes) do if os.isfile(path.join(platpath, "xmake.lua")) then @@ -518,6 +516,31 @@ function platform.plats() return plats end +-- get the all toolchains +function platform.toolchains() + + -- return it directly if exists + if platform._TOOLCHAINS then + return platform._TOOLCHAINS + end + + -- get all toolchains + local toolchains = {} + local dirs = toolchain.directories() + for _, dir in ipairs(dirs) do + local dirs = os.dirs(path.join(dir, "*")) + if dirs then + for _, dir in ipairs(dirs) do + if os.isfile(path.join(dir, "xmake.lua")) then + table.insert(toolchains, path.basename(dir)) + end + end + end + end + platform._TOOLCHAINS = toolchains + return toolchains +end + -- get the platform os function platform.os(plat) return platform.get("os", plat) |
