diff options
| author | ruki <[email protected]> | 2015-05-16 20:00:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-05-16 20:00:45 +0800 |
| commit | b7344cd33b93ba1a1aa96eea057adf4b71f7139a (patch) | |
| tree | 2bf15a9edab8fdce2777ca0b46d7cedf24d4fac6 /xmake/scripts/base/project.lua | |
| parent | 94c489e0b0c07d8187d96ca7659357c5c71d5944 (diff) | |
add import for the configure file
Diffstat (limited to 'xmake/scripts/base/project.lua')
| -rw-r--r-- | xmake/scripts/base/project.lua | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua index 6b93b32fc..1a25b9bda 100644 --- a/xmake/scripts/base/project.lua +++ b/xmake/scripts/base/project.lua @@ -63,11 +63,39 @@ function project.loadxproj(file) return v end + -- init import + local import = function (name) + + -- import configs? + if name == "configs" then + + -- init configs + local configs = {} + + -- get the config for the current target + local target = config.getarget() + if target then + for k, v in pairs(target) do + if k and type(k) == "string" and not k:startswith("_") then + configs[k] = v + end + end + end + + -- init the project directory + configs.projectdir = xmake._OPTIONS.project + + -- import it + return configs + end + + end + -- load and execute the xmake.xproj - local configs, errors = preprocessor.loadfile(file, "project", configures, {"target", "platforms"}, filter) - if configs then + local newenv, errors = preprocessor.loadfile(file, "project", configures, {"target", "platforms"}, filter, import) + if newenv and newenv._CONFIGS then -- ok - project._CONFIGS = configs + project._CONFIGS = newenv._CONFIGS elseif errors then -- error return errors @@ -75,6 +103,7 @@ function project.loadxproj(file) -- error return string.format("load %s failed!", file) end + end -- dump configs |
