xmake.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("nvtt")
  2. set_homepage("https://developer.nvidia.com/legacy-texture-tools")
  3. set_description("The NVIDIA Texture Tools is a collection of image processing and texture manipulation tools.")
  4. set_license("MIT")
  5. add_urls("https://github.com/castano/nvidia-texture-tools/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/castano/nvidia-texture-tools.git")
  7. add_versions("2.1.2", "0187336b0285038fab4f4a6b7654f51beaebab040b6aad53c147c917c5ab519b")
  8. add_patches("2.1.2", path.join(os.scriptdir(), "patches", "2.1.2", "build.patch"), "ed9b5884d6a644445bd1e3407a6575ca2a72b24a9edb9b01afe5f4f8e7272b8e")
  9. add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
  10. add_deps("cmake")
  11. if is_plat("windows") then
  12. add_syslinks("user32")
  13. elseif is_plat("linux") then
  14. add_syslinks("pthread")
  15. end
  16. add_links("nvtt", "nvimage", "nvthread", "bc6h", "bc7", "nvmath", "nvcore", "nvsquish")
  17. on_load("windows", "macosx", "linux", function (package)
  18. if package:config("cuda") then
  19. package:add("deps", "cuda")
  20. end
  21. if not package:config("shared") or package:is_plat("windows") then
  22. package:add("linkdirs", "lib/static")
  23. end
  24. if package:config("shared") and package:is_plat("windows") then
  25. package:add("defines", "NVTT_SHARED=1")
  26. end
  27. end)
  28. on_install("windows", "macosx", "linux", function (package)
  29. local configs = {}
  30. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  31. table.insert(configs, "-DNVTT_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  32. table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_CUDA=" .. (package:config("cuda") and "OFF" or "ON"))
  33. import("package.tools.cmake").install(package, configs)
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. void test() {
  38. nvtt::CompressionOptions o;
  39. o.setFormat(nvtt::Format_BC7);
  40. }
  41. ]]}, {configs = {languages = "c++11"}, includes = "nvtt/nvtt.h"}))
  42. end)