diff options
| author | ruki <[email protected]> | 2017-08-03 11:15:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-03 11:15:46 +0800 |
| commit | bcb21e7b854ee16baf2c0b992ded6b4e7cefb76c (patch) | |
| tree | f1276b9715ff5e363bfac14bd848f15c761e0367 /xmake/core/platform/platform.lua | |
| parent | b40bc697d9ce4e20836b60941daabfeaae080b28 (diff) | |
add cross platform and custom platform name
Diffstat (limited to 'xmake/core/platform/platform.lua')
| -rw-r--r-- | xmake/core/platform/platform.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 9e66824d0..c7448f559 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -181,12 +181,19 @@ function platform.load(plat) for _, dir in ipairs(platform._directories()) do -- find this directory - scriptpath = path.join(path.join(dir, plat), "xmake.lua") + scriptpath = path.join(dir, plat, "xmake.lua") if os.isfile(scriptpath) then break end end + -- unknown platform? switch to cross compilation platform + local cross = false + if not scriptpath or not os.isfile(scriptpath) then + scriptpath = path.join(os.programdir(), "platforms", "cross", "xmake.lua") + cross = true + end + -- not exists? if not scriptpath or not os.isfile(scriptpath) then return nil, string.format("the platform %s not found!", plat) @@ -198,13 +205,16 @@ function platform.load(plat) return nil, errors end + -- get result + local result = utils.ifelse(cross, results["cross"], results[plat]) + -- check the platform name - if not results[plat] then + if not result then return nil, string.format("the platform %s not found!", plat) end -- new an instance - local instance, errors = _instance.new(plat, results[plat], platform._interpreter():rootdir()) + local instance, errors = _instance.new(plat, result, platform._interpreter():rootdir()) if not instance then return nil, errors end |
