diff options
| author | ruki <[email protected]> | 2017-06-19 14:02:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-19 14:02:51 +0800 |
| commit | f2620eea847263299cae03a36726140152530291 (patch) | |
| tree | 69de40fd8bad6d6cd5e249e3beaaabbdb545ef97 | |
| parent | bab3c46dbb5e6443ddf52c58099266e236450312 (diff) | |
link stdc++ for gcc and clang
| -rw-r--r-- | xmake/tools/clang.lua | 8 | ||||
| -rw-r--r-- | xmake/tools/gcc.lua | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/xmake/tools/clang.lua b/xmake/tools/clang.lua index eb7c4b058..7e3ce7d97 100644 --- a/xmake/tools/clang.lua +++ b/xmake/tools/clang.lua @@ -34,6 +34,13 @@ function init(shellname, kind) -- init shflags _super._g.shflags = { "-dynamiclib", "-fPIC" } + -- link stdc++ for clang + _super._g.ldflags = {} + if _super._g.shellname:find("clang", 1, true) then + table.insert(_super._g.ldflags, "-lstdc++") + table.insert(_super._g.shflags, "-lstdc++") + end + -- suppress warning _super._g.cxflags = {"-Qunused-arguments"} _super._g.mxflags = {"-Qunused-arguments"} @@ -42,7 +49,6 @@ function init(shellname, kind) -- init flags map _super._g.mapflags["-s"] = "-Wl,-S" _super._g.mapflags["-S"] = "-Wl,-S" - end -- make the strip flag diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua index 94bc201ed..17cc31072 100644 --- a/xmake/tools/gcc.lua +++ b/xmake/tools/gcc.lua @@ -49,9 +49,16 @@ function init(shellname, kind) -- init shflags _g.shflags = { "-shared", "-fPIC" } + -- link stdc++ for gcc + _g.ldflags = {} + if _g.shellname:find("gcc", 1, true) then + table.insert(_g.ldflags, "-lstdc++") + table.insert(_g.shflags, "-lstdc++") + end + -- init cxflags for the kind: shared - _g.shared = {} - _g.shared.cxflags = {"-fPIC"} + _g.shared = {} + _g.shared.cxflags = {"-fPIC"} -- init flags map _g.mapflags = |
