summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/project.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-15 09:31:32 +0800
committerruki <[email protected]>2015-05-15 09:31:32 +0800
commit418ef668596cb107b75dddee0c4562e4502613cc (patch)
tree1686eff5407c095c770d6defa8a3bff589357088 /xmake/scripts/base/project.lua
parentab36dca23f1cd80720e9d0eb2c3ce72d5895ba3e (diff)
replace variable for project
Diffstat (limited to 'xmake/scripts/base/project.lua')
-rw-r--r--xmake/scripts/base/project.lua26
1 files changed, 24 insertions, 2 deletions
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua
index f2cf1a9f0..16ac087c4 100644
--- a/xmake/scripts/base/project.lua
+++ b/xmake/scripts/base/project.lua
@@ -118,6 +118,28 @@ function project(name)
end
+-- preprocess value
+function _preprocess(value)
+
+ -- the value is string?
+ if type(value) == "string" then
+
+ -- replace $(variable)
+ value = value:gsub("%$%((.*)%)", function (v)
+ if v == "buildir" then
+ -- TODO
+ return xmake._CONFIGS.all.output
+ elseif v == "projectdir" then
+ return xmake._OPTIONS.project
+ end
+ return v
+ end)
+ end
+
+ -- ok
+ return value
+end
+
-- register configures
function _register(names)
@@ -144,11 +166,11 @@ function _register(names)
current[name] = nil
elseif table.getn(arg) == 1 then
-- save only one argument
- current[name] = arg[1]
+ current[name] = _preprocess(arg[1])
else
-- save all arguments
for i, v in ipairs(arg) do
- current[name][i] = v
+ current[name][i] = _preprocess(v)
end
end
end