diff options
| author | ruki <[email protected]> | 2023-02-20 22:54:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-20 22:54:41 +0800 |
| commit | fea53d6126d9685ae5736743d92e6cb3b0470497 (patch) | |
| tree | 465af926fc55abf450f68aba1295184a48e7ebe1 | |
| parent | f3ee66f6c97ec3c4963aaf12b4b87891b27ad972 (diff) | |
implement cuda devlink checker
| -rw-r--r-- | xmake/plugins/check/checkers/cuda/devlink.lua | 26 | ||||
| -rw-r--r-- | xmake/rules/cuda/env/xmake.lua | 5 |
2 files changed, 28 insertions, 3 deletions
diff --git a/xmake/plugins/check/checkers/cuda/devlink.lua b/xmake/plugins/check/checkers/cuda/devlink.lua index a2b29cd3b..fee6bb637 100644 --- a/xmake/plugins/check/checkers/cuda/devlink.lua +++ b/xmake/plugins/check/checkers/cuda/devlink.lua @@ -20,8 +20,32 @@ -- imports import("core.base.option") +import("core.project.project") + +-- https://github.com/xmake-io/xmake/issues/1976#issuecomment-1427378799 +function _check_target(target, opt) + if target:is_binary() then + local sourcebatches = target:sourcebatches() + if sourcebatches and not sourcebatches["cuda.build"] then + for _, dep in ipairs(target:orderdeps()) do + if dep:is_static() then + sourcebatches = dep:sourcebatches() + if sourcebatches and sourcebatches["cuda.build"] and not dep:values("cuda.build.devlink") then + wprint('target(%s)${clear}: cuda device link is not performed! specify set_values("cuda.build.devlink", true) to enable it', dep:name()) + end + end + end + end + end +end function main(opt) - print("devlink") + if opt.target then + _check_target(opt.target, opt) + else + for _, target in pairs(project.targets()) do + _check_target(target, opt) + end + end end diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua index d36482901..559774466 100644 --- a/xmake/rules/cuda/env/xmake.lua +++ b/xmake/rules/cuda/env/xmake.lua @@ -23,16 +23,17 @@ rule("cuda.env") on_load(function (target) import("detect.sdks.find_cuda") - + --[[ local cuda = assert(find_cuda(nil, {verbose = true}), "Cuda SDK not found!") if cuda then target:data_set("cuda", cuda) - end + end]] end) after_load(function (target) import("core.platform.platform") + if true then return end -- get cuda sdk local cuda = assert(target:data("cuda"), "Cuda SDK not found!") |
