summaryrefslogtreecommitdiff
path: root/xmake/platforms/windows/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-03-09 23:15:48 +0800
committerruki <[email protected]>2018-03-09 13:34:53 +0800
commita6f86e9466987f5e14006245bb35cefc5339dfc0 (patch)
treeedea0be538ee40cb15bf42679f751c96799d5151 /xmake/platforms/windows/xmake.lua
parentaf7fafb3c03680052207039cae975628192d3109 (diff)
support cuda for windows
Diffstat (limited to 'xmake/platforms/windows/xmake.lua')
-rw-r--r--xmake/platforms/windows/xmake.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index f7353f442..dbcc42b80 100644
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -43,6 +43,12 @@ platform("windows")
-- on load
on_load(function ()
+ -- imports
+ import("core.project.config")
+
+ -- init flags for architecture
+ local arch = config.get("arch")
+
-- init the file formats
_g.formats = {}
_g.formats.static = {"", ".lib"}
@@ -57,6 +63,18 @@ platform("windows")
_g["dc-shflags"] = { dc_archs[arch] }
_g["dc-ldflags"] = { dc_archs[arch] }
+ -- init flags for cuda
+ local cu_archs = { x86 = "-m32 -Xcompiler -m32", x64 = "-m64 -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")))
+ end
+
-- ok
return _g
end)