summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-25 08:23:04 +0800
committerruki <[email protected]>2015-05-25 08:23:04 +0800
commit99582c402d5580877247344cca1f708f15e16d7b (patch)
tree0f1cc984aebee65381cde3693bbd32de7a9bfb0d /xmake/scripts
parent24e6b488718dab5dc58a7b4adc901884d716f478 (diff)
init platform configure
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/platform/android/_android.lua3
-rw-r--r--xmake/scripts/platform/ios/_ios.lua3
-rw-r--r--xmake/scripts/platform/linux/_linux.lua3
-rw-r--r--xmake/scripts/platform/macosx/_macosx.lua3
-rw-r--r--xmake/scripts/platform/platform.lua53
-rw-r--r--xmake/scripts/platform/windows/_windows.lua3
6 files changed, 37 insertions, 31 deletions
diff --git a/xmake/scripts/platform/android/_android.lua b/xmake/scripts/platform/android/_android.lua
index 910a61b68..d79236a28 100644
--- a/xmake/scripts/platform/android/_android.lua
+++ b/xmake/scripts/platform/android/_android.lua
@@ -36,9 +36,6 @@ function _android.init(configs)
configs.archs = {}
configs.archs.armv5te = {}
configs.archs.armv6 = {}
-
- -- ok
- return true
end
diff --git a/xmake/scripts/platform/ios/_ios.lua b/xmake/scripts/platform/ios/_ios.lua
index 23979b46e..f74d26544 100644
--- a/xmake/scripts/platform/ios/_ios.lua
+++ b/xmake/scripts/platform/ios/_ios.lua
@@ -37,9 +37,6 @@ function _ios.init(configs)
configs.archs.armv7 = {}
configs.archs.armv7s = {}
configs.archs.arm64 = {}
-
- -- ok
- return true
end
diff --git a/xmake/scripts/platform/linux/_linux.lua b/xmake/scripts/platform/linux/_linux.lua
index 0366bbbbe..2bc54e4c1 100644
--- a/xmake/scripts/platform/linux/_linux.lua
+++ b/xmake/scripts/platform/linux/_linux.lua
@@ -36,9 +36,6 @@ function _linux.init(configs)
configs.archs = {}
configs.archs.x86 = {}
configs.archs.x64 = {}
-
- -- ok
- return true
end
diff --git a/xmake/scripts/platform/macosx/_macosx.lua b/xmake/scripts/platform/macosx/_macosx.lua
index 54dd35e85..79fd1c9c5 100644
--- a/xmake/scripts/platform/macosx/_macosx.lua
+++ b/xmake/scripts/platform/macosx/_macosx.lua
@@ -36,9 +36,6 @@ function _macosx.init(configs)
configs.archs = {}
configs.archs.x86 = {}
configs.archs.x64 = {}
-
- -- ok
- return true
end
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index ab3384bed..24d618835 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -29,21 +29,39 @@ local path = require("base/path")
local utils = require("base/utils")
local config = require("base/config")
--- init platform
-function platform.init()
+-- get the configure of the given platform
+function platform._config(plat)
- -- init platform configs
+ -- the configure
platform._CONFIGS = platform._CONFIGS or {}
- local configs = platform._CONFIGS
+ local config = platform._CONFIGS[plat]
+
+ -- return it directly if exists
+ if config then
+ return config
+ end
-- load platform
- local p = require("platform/" .. config.get("plat") .. "/_" .. config.get("plat"))
- if not p then
- return false
+ local p = require("platform/" .. plat .. "/_" .. plat)
+ if p then
+
+ -- make configure
+ platform._CONFIGS[plat]= {}
+ config = platform._CONFIGS[plat]
+
+ -- init configure
+ p.init(config)
end
- -- init platform
- return p.init(configs)
+ -- ok?
+ return config
+end
+
+-- init platform
+function platform.init()
+
+ -- init the current platform
+ return platform._config(config.get("plat"))
end
-- get the given configure
@@ -52,8 +70,12 @@ function platform.get(name)
-- check
assert(platform._CONFIGS)
- -- get it
- return platform._CONFIGS[name]
+ -- get the current platform configure
+ local config = platform._config(config.get("plat"))
+ if config then
+ -- get it
+ return config[name]
+ end
end
-- get the format from the given kind
@@ -74,7 +96,7 @@ function platform.dump()
-- dump
if xmake._OPTIONS.verbose then
- utils.dump(platform._CONFIGS)
+ utils.dump(platform._config(config.get("plat")))
end
end
@@ -110,10 +132,9 @@ function platform.archs(plat)
-- load all platform configs
local archs = {}
- local configs = {}
- local p = require("platform/" .. plat .. "/_" .. plat)
- if p and p.init(configs) and configs.archs then
- for arch, _ in pairs(configs.archs) do
+ local config = platform._config(plat)
+ if config and config.archs then
+ for arch, _ in pairs(config.archs) do
archs[table.getn(archs) + 1] = arch
end
end
diff --git a/xmake/scripts/platform/windows/_windows.lua b/xmake/scripts/platform/windows/_windows.lua
index c810f5024..56304ee51 100644
--- a/xmake/scripts/platform/windows/_windows.lua
+++ b/xmake/scripts/platform/windows/_windows.lua
@@ -37,9 +37,6 @@ function _windows.init(configs)
configs.archs = {}
configs.archs.x86 = {}
configs.archs.x64 = {}
-
- -- ok
- return true
end