diff options
| author | ruki <[email protected]> | 2015-06-15 08:48:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-15 08:48:55 +0800 |
| commit | 31bba0ba7852b0699e41642815455afb62ddc8b7 (patch) | |
| tree | 214944d863b5dfd9b55e7eaba1a755d82c27f5a5 /xmake/scripts/base/compiler.lua | |
| parent | 7693b33a4e39c66fa52af65c57c6f0ddaaf56bca (diff) | |
support multi-languages and fix macro defines
Diffstat (limited to 'xmake/scripts/base/compiler.lua')
| -rw-r--r-- | xmake/scripts/base/compiler.lua | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/xmake/scripts/base/compiler.lua b/xmake/scripts/base/compiler.lua index e8f2508de..0b58533e2 100644 --- a/xmake/scripts/base/compiler.lua +++ b/xmake/scripts/base/compiler.lua @@ -211,19 +211,26 @@ function compiler._addflags_from_target(module, flags, flagnames, target) })) -- add the language flags from the current project - table.join2(flags, compiler._getflags(module, target.language, { ansi = "-ansi" - , c89 = "-std=c89" - , gnu89 = "-std=gnu89" - , c99 = "-std=c99" - , gnu99 = "-std=gnu99" - , cxx98 = "-std=c++98" - , gnuxx98 = "-std=gnu++98" - , cxx11 = "-std=c++11" - , gnuxx11 = "-std=gnu++11" - , cxx14 = "-std=c++14" - , gnuxx14 = "-std=gnu++14" - })) - + local languages = {} + for _, flagname in ipairs(flagnames) do + if flagname == "cflags" or flagname == "mflags" then + table.join2(languages, { ansi = "-ansi" + , c89 = "-std=c89" + , gnu89 = "-std=gnu89" + , c99 = "-std=c99" + , gnu99 = "-std=gnu99" + }) + elseif flagname == "cxxflags" or flagname == "mxxflags" then + table.join2(languages, { cxx98 = "-std=c++98" + , gnuxx98 = "-std=gnu++98" + , cxx11 = "-std=c++11" + , gnuxx11 = "-std=gnu++11" + , cxx14 = "-std=c++14" + , gnuxx14 = "-std=gnu++14" + }) + end + end + table.join2(flags, compiler._getflags(module, target.languages, languages)) -- add the includedirs flags from the current project if module.flag_includedir then |
