diff options
| author | ruki <[email protected]> | 2015-06-11 16:19:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-11 16:19:30 +0800 |
| commit | 76fd1ccaf43262df8fae3d9d3bfba1c2f0e04ca5 (patch) | |
| tree | dff91d1b1692ab1153f46c7626134de0fa3fceb9 /xmake/scripts/tools/gcc.lua | |
| parent | ef4fe60273da742248fe9111e9141df51185c204 (diff) | |
merge clang to gcc
Diffstat (limited to 'xmake/scripts/tools/gcc.lua')
| -rw-r--r-- | xmake/scripts/tools/gcc.lua | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/xmake/scripts/tools/gcc.lua b/xmake/scripts/tools/gcc.lua index f814944e1..2cf61a0a2 100644 --- a/xmake/scripts/tools/gcc.lua +++ b/xmake/scripts/tools/gcc.lua @@ -25,6 +25,7 @@ local utils = require("base/utils") local table = require("base/table") local string = require("base/string") local config = require("base/config") +local platform = require("platform/platform") -- define module: gcc local gcc = gcc or {} @@ -54,7 +55,7 @@ end function gcc.init(name) -- save name - gcc.name = name or "gcc" + gcc.name = name -- the architecture local arch = config.get("arch") @@ -86,7 +87,29 @@ function gcc.init(name) gcc.ldflags = { flags_arch } -- init shflags - gcc.shflags = { flags_arch, "-shared -Wl,-soname" } + if name:find("clang") then + gcc.shflags = { flags_arch, "-dynamiclib" } + else + gcc.shflags = { flags_arch, "-shared -Wl,-soname" } + end + + -- append the xcode sdk directory if exists + local plat = config.get("plat") + if plat and (plat == "macosx" or plat == "iphoneos" or plat == "iphonesimulator") then + local xcode_sdkdir = platform.get("xcode_sdkdir") + if xcode_sdkdir then + table.join2(gcc.cxflags, "-isysroot " .. xcode_sdkdir) + table.join2(gcc.mxflags, "-isysroot " .. xcode_sdkdir) + table.join2(gcc.ldflags, "-isysroot " .. xcode_sdkdir) + table.join2(gcc.shflags, "-isysroot " .. xcode_sdkdir) + end + end + + -- suppress warning for the ccache bug + if name:find("clang") and config.get("ccache") then + table.join2(gcc.cxflags, "-Qunused-arguments") + table.join2(gcc.mxflags, "-Qunused-arguments") + end -- init flags map gcc.mapflags = |
