summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/rules/cuda/device_link/xmake.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/xmake/rules/cuda/device_link/xmake.lua b/xmake/rules/cuda/device_link/xmake.lua
index 0f390f0d9..6921253a3 100644
--- a/xmake/rules/cuda/device_link/xmake.lua
+++ b/xmake/rules/cuda/device_link/xmake.lua
@@ -51,6 +51,12 @@ rule("cuda.device_link")
-- init culdflags
local culdflags = {"-dlink"}
+ if targetkind == "shared" then
+ table.insert(culdflags, "-shared")
+ if not is_plat("windows") then
+ table.insert(culdflags, "-Xcompiler -fPIC")
+ end
+ end
-- get link flags
local linkflags = linkinst:linkflags({target = target, configs = {force = {culdflags = culdflags}}})