summaryrefslogtreecommitdiff
path: root/xmake/platforms/linux/load.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-03-09 23:17:43 +0800
committerruki <[email protected]>2018-03-09 13:46:22 +0800
commit952efe5c652fae38a3d86ce9a4b0f81c6262726a (patch)
tree0136ee1fbf951a25966dc2af7e9be488bb19e55f /xmake/platforms/linux/load.lua
parenta6f86e9466987f5e14006245bb35cefc5339dfc0 (diff)
add cuda for linux
Diffstat (limited to 'xmake/platforms/linux/load.lua')
-rw-r--r--xmake/platforms/linux/load.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/platforms/linux/load.lua b/xmake/platforms/linux/load.lua
index f821d89de..74ebe5640 100644
--- a/xmake/platforms/linux/load.lua
+++ b/xmake/platforms/linux/load.lua
@@ -75,6 +75,19 @@ function main()
_g["rc-shflags"] = {}
_g["rc-ldflags"] = {}
+ -- init flags for cuda
+ local cu_archs = { i386 = "-m32 -Xcompiler -arch -Xcompiler -m32", x86_64 = "-m64 -Xcompiler -arch -Xcompiler -m64" }
+ _g.cuflags = {cu_archs[arch] or ""}
+ _g["cu-shflags"] = {cu_archs[arch] or ""}
+ _g["cu-ldflags"] = {cu_archs[arch] or ""}
+ local cuda_dir = config.get("cuda_dir")
+ if cuda_dir then
+ table.insert(_g.cuflags, "-I" .. os.args(path.join(cuda_dir, "include")))
+ table.insert(_g["cu-ldflags"], "-L" .. os.args(path.join(cuda_dir, "lib")))
+ table.insert(_g["cu-shflags"], "-L" .. os.args(path.join(cuda_dir, "lib")))
+ table.insert(_g["cu-ldflags"], "-Wl,-rpath=" .. os.args(path.join(cuda_dir, "lib")))
+ end
+
-- ok
return _g
end