summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/platform.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-04 12:01:02 +0800
committerruki <[email protected]>2015-06-04 12:01:02 +0800
commit9f1d3468c22adabab1ad06cdb0014c4f6ef2caa6 (patch)
tree38aa06eba8a633d91646e6cefbd7f942350bb0ce /xmake/scripts/platform/platform.lua
parent5bb9c509ed7d76918eb54d8500d6f981747d7e0e (diff)
find the given tool from name
Diffstat (limited to 'xmake/scripts/platform/platform.lua')
-rw-r--r--xmake/scripts/platform/platform.lua35
1 files changed, 26 insertions, 9 deletions
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index 120a03f84..718587c84 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -36,11 +36,11 @@ local compiler = require("compiler/compiler")
function platform._load_prober(root)
-- the platform file path
- local file = string.format("%s/prober.lua", root)
- if os.isfile(file) then
+ local filepath = string.format("%s/prober.lua", root)
+ if os.isfile(filepath) then
-- load script
- local script = loadfile(file)
+ local script = loadfile(filepath)
if script then
-- load prober
@@ -58,11 +58,11 @@ end
function platform._load_from(root, plat)
-- the platform file path
- local file = string.format("%s/platform/%s/%s.lua", root, plat, plat)
- if os.isfile(file) then
+ local filepath = string.format("%s/platform/%s/%s.lua", root, plat, plat)
+ if os.isfile(filepath) then
-- load script
- local script = loadfile(file)
+ local script = loadfile(filepath)
if script then
-- load module
@@ -70,7 +70,7 @@ function platform._load_from(root, plat)
if module then
-- save directory
- module._DIRECTORY = path.directory(file)
+ module._DIRECTORY = path.directory(filepath)
assert(module._DIRECTORY)
-- attempt to load prober
@@ -139,6 +139,23 @@ function platform._configs(plat)
return configs
end
+-- get the current platform module
+function platform.module()
+
+ -- load it
+ return platform._load(config.get("plat"))
+end
+
+-- get the current platform module directory
+function platform.directory()
+
+ -- load it
+ local module = platform.module()
+ if module then
+ return module._DIRECTORY
+ end
+end
+
-- make the current platform configure
function platform.make()
@@ -374,7 +391,7 @@ function platform.probe(configs, is_global)
-- probe config
else
-- probe it
- local module = platform._load(config.get("plat"))
+ local module = platform.module()
if module and module._PROBER and module._PROBER.done then
module._PROBER.done(configs, is_global)
end
@@ -385,7 +402,7 @@ end
function platform.build(mkfile, target)
-- attempt to done the platform special make first
- local module = platform._load(config.get("plat"))
+ local module = platform.module()
if module and module._MAKER and module._MAKER.done then
return module._MAKER.done(mkfile, target)
end