diff options
| author | ruki <[email protected]> | 2023-02-20 22:56:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-20 22:56:50 +0800 |
| commit | 5678e3f25fdeb5dc94b0ac6ad8db1fee0385daf6 (patch) | |
| tree | 0e260e64457945041d882cf98adadd848785fc8b | |
| parent | fea53d6126d9685ae5736743d92e6cb3b0470497 (diff) | |
use devlink policy
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/check/checkers/cuda/devlink.lua | 7 | ||||
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/cuda/devlink/xmake.lua | 2 |
5 files changed, 10 insertions, 5 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 52f13c9b7..56fbc2219 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -60,6 +60,8 @@ function policy.policies() ["build.c++.msvc.fallbackscanner"] = {description = "Force msvc fallback module dependency scanner.", default = false, type = "boolean"}, -- force C++ modules fallback dependency scanner for gcc ["build.c++.gcc.fallbackscanner"] = {description = "Force gcc fallback module dependency scanner.", default = false, type = "boolean"}, + -- enable cuda device link + ["build.cuda.devlink"] = {description = "Enable Cuda devlink.", type = "boolean"}, -- preprocessor configuration for ccache/distcc, we can disable linemarkers to speed up preprocess ["preprocessor.linemarkers"] = {description = "Enable linemarkers for preprocessor.", default = true, type = "boolean"}, -- preprocessor configuration for ccache/distcc, we can disable it to avoid cache object file with __DATE__, __TIME__ diff --git a/xmake/plugins/check/checkers/cuda/devlink.lua b/xmake/plugins/check/checkers/cuda/devlink.lua index fee6bb637..4281b5a8d 100644 --- a/xmake/plugins/check/checkers/cuda/devlink.lua +++ b/xmake/plugins/check/checkers/cuda/devlink.lua @@ -30,8 +30,11 @@ function _check_target(target, opt) 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()) + if sourcebatches and sourcebatches["cuda.build"] then + local devlink = dep:policy("build.cuda.devlink") or dep:values("cuda.build.devlink") + if not devlink then + wprint('target(%s)${clear}: cuda device link is not performed! specify set_policy("build.cuda.devlink", true) to enable it', dep:name()) + end end end end diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 945b280bd..b3d614985 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -345,7 +345,7 @@ function _add_target_sources(cmakelists, target, outputdir) cmakelists:print(")") if has_cuda then cmakelists:print("set_target_properties(%s PROPERTIES CUDA_SEPARABLE_COMPILATION ON)", target:name()) - local devlink = target:values("cuda.build.devlink") + local devlink = target:policy("build.cuda.devlink") or target:values("cuda.build.devlink") if devlink ~= nil then cmakelists:print("set_target_properties(%s PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS %s)", target:name(), devlink and "ON" or "OFF") end diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 3ba257720..4811a0f74 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -316,7 +316,7 @@ function _make_targetinfo(mode, arch, target, vcxprojdir) targetinfo.culinkflags = linkinst:linkflags({target = target}) -- save cuda devlink status - targetinfo.cudevlink = target:values("cuda.build.devlink") + targetinfo.cudevlink = target:policy("build.cuda.devlink") or target:values("cuda.build.devlink") end -- save execution dir (when executed from VS) diff --git a/xmake/rules/cuda/devlink/xmake.lua b/xmake/rules/cuda/devlink/xmake.lua index da3bf8aef..b04acc883 100644 --- a/xmake/rules/cuda/devlink/xmake.lua +++ b/xmake/rules/cuda/devlink/xmake.lua @@ -37,7 +37,7 @@ rule("cuda.build.devlink") import("utils.progress") -- disable devlink? - local devlink = target:values("cuda.build.devlink") + local devlink = target:policy("build.cuda.devlink") or target:values("cuda.build.devlink") if devlink == false then return end |
