Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
e8d427f3
Commit
e8d427f3
authored
Jul 09, 2025
by
YdrMaster
Browse files
issue/291/fix: 动态加载 cuda 路径,避免依赖环境变量
Signed-off-by:
YdrMaster
<
ydrml@hotmail.com
>
parent
f72b8653
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
xmake/cuda.lua
xmake/cuda.lua
+8
-5
No files found.
xmake/cuda.lua
View file @
e8d427f3
local
CUDA_ROOT
=
os.getenv
(
"CUDA_ROOT"
)
or
os.getenv
(
"CUDA_HOME"
)
or
os.getenv
(
"CUDA_PATH"
)
local
CUDNN_ROOT
=
os.getenv
(
"CUDNN_ROOT"
)
or
os.getenv
(
"CUDNN_HOME"
)
or
os.getenv
(
"CUDNN_PATH"
)
local
CUDNN_ROOT
=
os.getenv
(
"CUDNN_ROOT"
)
or
os.getenv
(
"CUDNN_HOME"
)
or
os.getenv
(
"CUDNN_PATH"
)
if
CUDA_ROOT
~=
nil
then
add_includedirs
(
CUDA_ROOT
..
"/include"
)
end
if
CUDNN_ROOT
~=
nil
then
if
CUDNN_ROOT
~=
nil
then
add_includedirs
(
CUDNN_ROOT
..
"/include"
)
add_includedirs
(
CUDNN_ROOT
..
"/include"
)
end
end
...
@@ -21,6 +16,14 @@ target("infiniop-cuda")
...
@@ -21,6 +16,14 @@ target("infiniop-cuda")
end
end
add_cugencodes
(
"native"
)
add_cugencodes
(
"native"
)
on_load
(
function
(
target
)
import
(
"lib.detect.find_tool"
)
local
nvcc
=
find_tool
(
"nvcc"
)
if
nvcc
~=
nil
then
target
:
add
(
"linkdirs"
,
path
.
directory
(
path
.
directory
(
nvcc
.
program
))
..
"/lib64/stubs"
)
end
end
)
if
is_plat
(
"windows"
)
then
if
is_plat
(
"windows"
)
then
add_cuflags
(
"-Xcompiler=/utf-8"
,
"--expt-relaxed-constexpr"
,
"--allow-unsupported-compiler"
)
add_cuflags
(
"-Xcompiler=/utf-8"
,
"--expt-relaxed-constexpr"
,
"--allow-unsupported-compiler"
)
add_cuflags
(
"-Xcompiler=/W3"
,
"-Xcompiler=/WX"
)
add_cuflags
(
"-Xcompiler=/W3"
,
"-Xcompiler=/WX"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment