xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("basisu")
  2. set_homepage("https://github.com/BinomialLLC/basis_universal")
  3. set_description("Basis Universal GPU Texture Codec")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/BinomialLLC/basis_universal/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/BinomialLLC/basis_universal.git")
  7. add_versions("1.16.4", "e5740fd623a2f8472c9700b9447a8725a6f27d65b0b47c3e3926a60db41b8a64")
  8. add_configs("opencl", {description = "Enable opencl", default = false, type = "boolean"})
  9. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  10. if is_plat("linux", "bsd") then
  11. add_syslinks("m", "pthread")
  12. end
  13. add_deps("zstd")
  14. on_load(function (package)
  15. if package:config("opencl") then
  16. package:add("deps", "opencl")
  17. end
  18. end)
  19. on_install(function (package)
  20. io.replace("encoder/basisu_comp.cpp", "../zstd/zstd.h", "zstd.h", {plain = true})
  21. local configs = {
  22. opencl = package:config("opencl"),
  23. tools = package:config("tools"),
  24. }
  25. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  26. import("package.tools.xmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. void test() {
  31. basist::basisu_transcoder_init();
  32. }
  33. ]]}, {configs = {languages = "c++11"}, includes = "basisu/transcoder/basisu_transcoder.h"}))
  34. end)