xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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 = "Enable OpenMP build.", default = false, type = "boolean"})
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. end
  11. add_deps("cmake")
  12. on_install("windows", "macosx", "linux", function (package)
  13. local configs = {}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. table.insert(configs, "-DBUILD_SQUISH_WITH_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
  17. import("package.tools.cmake").install(package, configs)
  18. end)
  19. on_test(function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. void test() {
  22. using namespace squish;
  23. u8 input[4*16];
  24. u8 output[4*16];
  25. u8 block[16];
  26. Compress( input, block, kDxt1 );
  27. Decompress( output, block, kDxt1 );
  28. }
  29. ]]}, {configs = {languages = "c++11"}, includes = "squish.h"}))
  30. end)