diff options
| author | ruki <[email protected]> | 2019-06-18 22:39:36 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-06-18 22:39:36 +0800 |
| commit | 96bda12356f3d69edae33a31d384d28b1ef74274 (patch) | |
| tree | fe35918e6ddb0cfdaca7b5333becf9b19c007a38 /xmake/modules/core/tools/clang.lua | |
| parent | b441b29b947c8d94c0642132383b4a7a67c189c9 (diff) | |
| parent | 98d4504577b586ef2398346a0db2743081cf03a8 (diff) | |
Merge pull request #455 from OpportunityLiu/clang-cuda
Support clang as cuda compiler
Diffstat (limited to 'xmake/modules/core/tools/clang.lua')
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index b7291b285..a57dd924f 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -23,15 +23,26 @@ inherit("gcc") -- init it function init(self) - + -- init super _super.init(self) + if not is_plat("windows", "mingw") then + self:add("shared.cuflags", "-fPIC") + end + -- suppress warning self:add("cxflags", "-Qunused-arguments") + self:add("cuflags", "-Qunused-arguments") self:add("mxflags", "-Qunused-arguments") self:add("asflags", "-Qunused-arguments") + local cuda = get_config("cuda") + if cuda then + local cuda_path = "--cuda-path=" .. os.args(path.translate(cuda)) + self:add("cuflags", cuda_path) + end + -- init flags map self:set("mapflags", { @@ -44,6 +55,16 @@ function init(self) -- strip , ["-s"] = "-s" , ["-S"] = "-S" + + -- rdc + , ["-rdc=true"] = "-fcuda-rdc" + , ["-rdc true"] = "-fcuda-rdc" + , ["--relocatable-device-code=true"] = "-fcuda-rdc" + , ["--relocatable-device-code true"] = "-fcuda-rdc" + , ["-rdc=false"] = "" + , ["-rdc false"] = "" + , ["--relocatable-device-code=false"] = "" + , ["--relocatable-device-code false"] = "" }) end |
