xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("libsquish")
  2. set_homepage("https://sourceforge.net/projects/libsquish/")
  3. set_description("The libSquish library compresses images with the DXT standard (also known as S3TC).")
  4. set_license("MIT")
  5. add_urls("https://sourceforge.net/projects/libsquish/files/libsquish-$(version).tgz")
  6. add_versions("1.15", "628796eeba608866183a61d080d46967c9dda6723bc0a3ec52324c85d2147269")
  7. add_configs("openmp", {description = "Build with OpenMP.", default = false, type = "boolean"})
  8. add_configs("sse2", {description = "Build with SSE2.", default = false, type = "boolean"})
  9. on_load(function (package)
  10. if package:config("openmp") then
  11. package:add("deps", "openmp")
  12. package:add("defines", "SQUISH_USE_OPENMP")
  13. end
  14. if package:config("sse2") then
  15. package:add("defines", "SQUISH_USE_SSE=2")
  16. end
  17. end)
  18. on_install(function (package)
  19. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  20. import("package.tools.xmake").install(package, {
  21. openmp = package:config("openmp"),
  22. sse2 = package:config("sse2")
  23. })
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. void test() {
  28. using namespace squish;
  29. u8 input[4*16];
  30. u8 output[4*16];
  31. u8 block[16];
  32. Compress( input, block, kDxt1 );
  33. Decompress( output, block, kDxt1 );
  34. }
  35. ]]}, {configs = {languages = "c++11"}, includes = "squish.h"}))
  36. end)