xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("cuda-samples")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/NVIDIA/cuda-samples")
  4. set_description("CUDA Sample Utility Code")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/NVIDIA/cuda-samples/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/NVIDIA/cuda-samples.git")
  8. add_versions("v11.8", "1bc02c0ca42a323f3c7a05b5682eae703681a91e95b135bfe81f848b2d6a2c51")
  9. add_versions("v12.3", "a40e4d3970185f38477dd8b5bdbd81642b04648d8b812af914333b8f83355efe")
  10. on_fetch(function (package, opt)
  11. if opt.system and package:is_plat("windows") then
  12. import("lib.detect.find_path")
  13. local paths = {
  14. "C:\\ProgramData\\NVIDIA Corporation\\CUDA Samples\\v*\\common"
  15. }
  16. local headerpath = find_path("helper_cuda.h", paths, {suffixes = {"inc"}})
  17. if headerpath then
  18. vprint("CUDA Samples Found: " .. path.directory(headerpath))
  19. return {includedirs = {headerpath}}
  20. end
  21. end
  22. end)
  23. add_includedirs("include/Common")
  24. on_install(function (package)
  25. os.cp("Common", package:installdir("include"))
  26. end)
  27. on_test(function (package)
  28. assert(os.isfile(path.join(package:installdir("include"), "Common", "helper_cuda.h")))
  29. end)