xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("icbc")
  2. set_homepage("https://github.com/castano/icbc")
  3. set_description("A High Quality SIMD BC1 Encoder")
  4. set_license("MIT")
  5. add_urls("https://github.com/castano/icbc/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/castano/icbc.git")
  7. add_versions("1.05", "51eba57870c018c8ccd673aab3c58fd5576fadb1c149c22c3fdacf42be197bfd")
  8. add_patches("1.05", path.join(os.scriptdir(), "patches", "1.05", "cleanup.patch"), "4704acc207940ec43c1b3bd7031ee05109fae61c0e044b0a71c899ed4612861d")
  9. on_install("windows", "macosx", "linux", function (package)
  10. io.writefile("icbc.cpp", [[
  11. #define ICBC_IMPLEMENTATION
  12. #include "icbc.h"
  13. #define IC_PFOR_IMPLEMENTATION
  14. #include "ic_pfor.h"
  15. ]])
  16. io.writefile("xmake.lua", [[
  17. add_rules("mode.debug", "mode.release")
  18. target("icbc")
  19. set_kind("static")
  20. set_languages("cxx11")
  21. add_files("icbc.cpp")
  22. add_headerfiles("icbc.h", "ic_pfor.h")
  23. if is_plat("windows") then
  24. add_cxxflags("/arch:AVX512")
  25. else
  26. add_cxxflags("-march=native")
  27. end
  28. ]])
  29. import("package.tools.xmake").install(package)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cxxtypes("icbc::Quality", {configs = {languages = "c++11"}, includes = "icbc.h"}))
  33. end)