diff options
| author | ruki <[email protected]> | 2015-06-02 10:50:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-02 10:50:54 +0800 |
| commit | 4b85064e874d050de835f4a4a0b2158f1405a6aa (patch) | |
| tree | c3f0ccec578302d4ad215198014d7f6331975546 /xmake/scripts/compiler/compiler.lua | |
| parent | bf6315e4e63270175eb27d9ab73dc98f3408cea8 (diff) | |
reimpl unique for flags
Diffstat (limited to 'xmake/scripts/compiler/compiler.lua')
| -rw-r--r-- | xmake/scripts/compiler/compiler.lua | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/xmake/scripts/compiler/compiler.lua b/xmake/scripts/compiler/compiler.lua index a4c5c59b7..ac25f176a 100644 --- a/xmake/scripts/compiler/compiler.lua +++ b/xmake/scripts/compiler/compiler.lua @@ -91,24 +91,34 @@ function compiler._make(self, target, filetype, srcfile, objfile) for _, flag_name in ipairs(flag_names) do -- get flags - local flags = target[flag_name] - if flags then - flags = table.concat(compiler._mapflags(self, utils.wrap(flags)), " ") - end + local flags = table.concat(compiler._mapflags(self, utils.wrap(target[flag_name])), " ") -- append flags flags_target = string.format("%s %s", flags_target, flags or "") end + -- get the includedirs flags from the current project + if self._make_includedir then + local includedirs = utils.wrap(target.includedirs) + for _, includedir in ipairs(includedirs) do + flags_target = string.format("%s %s", flags_target, self._make_includedir(configs, includedir)) + end + end + + -- get the defines flags from the current project + if self._make_define then + local defines = utils.wrap(target.defines) + for _, define in ipairs(defines) do + flags_target = string.format("%s %s", flags_target, self._make_define(configs, define)) + end + end + -- get the config flags local flags_config = "" for _, flag_name in ipairs(flag_names) do -- get flags - local flags = config.get(flag_name) - if flags then - flags = table.concat(compiler._mapflags(self, utils.wrap(flags)), " ") - end + local flags = table.concat(compiler._mapflags(self, utils.wrap(config.get(flag_name))), " ") -- append flags flags_config = string.format("%s %s", flags_config, flags or "") |
