diff options
| author | ruki <[email protected]> | 2019-02-03 11:20:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-03 11:20:02 +0800 |
| commit | e35595f73271cb14363c027694183dec3a32e910 (patch) | |
| tree | 32b6efd9c4ec17781eab6a8e746e79e97bddd21c /xmake | |
| parent | e7c2f6900a1aee4c065422ab5a252897f4c90b64 (diff) | |
attach option and configvars
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/actions/config/configfiles.lua | 20 | ||||
| -rw-r--r-- | xmake/core/project/option.lua | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua index 94f3c1bd5..2020670e3 100644 --- a/xmake/actions/config/configfiles.lua +++ b/xmake/actions/config/configfiles.lua @@ -89,11 +89,31 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets) -- get all variables local variables = fileinfo.variables or {} for _, target in ipairs(targets) do + + -- get variables from the target for name, value in pairs(target:get("configvar")) do if variables[name] == nil then variables[name] = table.unwrap(value) end end + + -- get variables from the target.options + for _, opt in ipairs(target:orderopts()) do + for name, value in pairs(opt:get("configvar")) do + if variables[name] == nil then + variables[name] = table.unwrap(value) + end + end + end + + -- get variables from the target.packages + for _, pkg in ipairs(target:orderpkgs()) do + for name, value in pairs(pkg:get("configvar")) do + if variables[name] == nil then + variables[name] = table.unwrap(value) + end + end + end end -- replace all variables diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index 637327389..c6592796c 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -78,6 +78,11 @@ function option.apis() , "option.add_vectorexts" , "option.add_features" } + , keyvalues = + { + -- option.set_xxx + "option.set_configvar" + } , script = { -- option.before_xxx |
