From b7344cd33b93ba1a1aa96eea057adf4b71f7139a Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 16 May 2015 20:00:45 +0800 Subject: add import for the configure file --- xmake/scripts/base/preprocessor.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'xmake/scripts/base/preprocessor.lua') diff --git a/xmake/scripts/base/preprocessor.lua b/xmake/scripts/base/preprocessor.lua index 7f2cd8c02..235ae8011 100644 --- a/xmake/scripts/base/preprocessor.lua +++ b/xmake/scripts/base/preprocessor.lua @@ -101,7 +101,7 @@ function preprocessor._register(env, names, filter) end -- init configures -function preprocessor._init(root, configures, scopes, filter) +function preprocessor._init(root, configures, scopes, filter, import) -- check assert(root and configures) @@ -115,6 +115,11 @@ function preprocessor._init(root, configures, scopes, filter) -- register all configures preprocessor._register(newenv, configures, filter) + -- configure import + if import then + newenv["import"] = import + end + -- configure scope end newenv["_end"] = function () @@ -198,9 +203,9 @@ end -- -- @code -- local configs, errors = preprocessor.loadfile("xmake.xconf", "config", {"plat", "host", "arch", ...}, {"target"}) --- local configs, errors = preprocessor.loadfile("xmake.xproj", "project", {"links", "files", "ldflags", ...}, {"target", "platforms"}, filter) +-- local configs, errors = preprocessor.loadfile("xmake.xproj", "project", {"links", "files", "ldflags", ...}, {"target", "platforms"}, filter, import) -- @endcode -function preprocessor.loadfile(path, root, configures, scopes, filter) +function preprocessor.loadfile(path, root, configures, scopes, filter, import) -- check assert(path and root and configures) @@ -210,7 +215,7 @@ function preprocessor.loadfile(path, root, configures, scopes, filter) if script then -- init a new envirnoment - local newenv = preprocessor._init(root, configures, scopes, filter) + local newenv = preprocessor._init(root, configures, scopes, filter, import) assert(newenv) -- bind this envirnoment @@ -224,7 +229,7 @@ function preprocessor.loadfile(path, root, configures, scopes, filter) end -- ok? - return newenv._CONFIGS + return newenv else -- error return nil, string.format("load %s failed!", path) -- cgit v1.3.1