summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/project.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-08 12:16:34 +0800
committerruki <[email protected]>2015-06-08 12:16:34 +0800
commit4d2fbb049f34e5899d962a148bf5e560fe9d978c (patch)
tree84f3dc90a474c7bf19784198628a72d0f34d502f /xmake/scripts/base/project.lua
parentc0a3b7585c3dc8f0b0c9c776ae2785359ae1b651 (diff)
load switch files
Diffstat (limited to 'xmake/scripts/base/project.lua')
-rw-r--r--xmake/scripts/base/project.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua
index 8b8873983..a0e963909 100644
--- a/xmake/scripts/base/project.lua
+++ b/xmake/scripts/base/project.lua
@@ -175,6 +175,27 @@ function project._init_switches(target)
end
end
+ -- load switches from the xxxx.xswf
+ if target.switchfiles then
+ for _, switchfile in ipairs(target.switchfiles) do
+ if not path.is_absolute(switchfile) then
+ switchfile = path.absolute(switchfile, xmake._PROJECT_DIR)
+ end
+ local newenv, errors = preprocessor.loadfile(switchfile, "switches", {"defines"})
+ if newenv and newenv._CONFIGS then
+ if newenv._CONFIGS.defines then
+ for _, switch in ipairs(newenv._CONFIGS.defines) do
+ target._SWITCHES[switch] = true
+ end
+ end
+ else
+ -- error
+ utils.error(errors)
+ assert(false)
+ end
+ end
+ end
+
-- attempt to get it from the switches
setmetatable(target,
{
@@ -293,6 +314,7 @@ function project.loadxproj(file)
, "shflags"
, "defines"
, "switches"
+ , "switchfiles"
, "strip"
, "symbols"
, "warnings"