xmake.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("rlottie")
  2. set_homepage("https://github.com/Samsung/rlottie")
  3. set_description("A platform independent standalone library that plays Lottie Animation. ")
  4. add_urls("https://github.com/Samsung/rlottie/archive/refs/tags/v$(version).tar.gz",
  5. "https://github.com/Samsung/rlottie.git")
  6. add_versions("0.1", "319d640f094f747e09177df59ca498f0df80c779ba789eeb1fc35da5a1c93414")
  7. add_versions("0.2", "030ccbc270f144b4f3519fb3b86e20dd79fb48d5d55e57f950f12bab9b65216a")
  8. add_patches("0.2", path.join(os.scriptdir(), "patches", "0.2", "limit.diff"), "6dc1c00c6ccad770586ec9d84f24d6c35e35dd624df877a71bb5c7bcc32831e9")
  9. add_configs("module", {description = "Enable LOTTIE MODULE SUPPORT", default = true, type = "boolean"})
  10. add_configs("thread", {description = "Enable LOTTIE THREAD SUPPORT", default = true, type = "boolean"})
  11. add_configs("cache", {description = "Enable LOTTIE CACHE SUPPORT", default = true, type = "boolean"})
  12. add_configs("ccache", {description = "Enable LOTTIE CCACHE SUPPORT", default = false, type = "boolean"})
  13. add_configs("asan", {description = "Compile with asan", default = false, type = "boolean"})
  14. if is_plat("wasm") then
  15. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  16. end
  17. add_deps("cmake")
  18. add_deps("freetype", {configs = {zlib = false}})
  19. add_deps("rapidjson ~1.1.0", "stb 2019.02.07")
  20. add_links("rlottie")
  21. on_install("windows", "linux", "macosx", "android|arm64*", "wasm", function (package)
  22. local configs = {}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DLIB_INSTALL_DIR=" .. package:installdir("lib"))
  26. for name, enabled in pairs(package:configs()) do
  27. if not package:extraconf("configs", name, "builtin") then
  28. table.insert(configs, "-DLOTTIE_" .. name:upper() .. "=" .. (enabled and "ON" or "OFF"))
  29. end
  30. end
  31. if package:is_plat("wasm") then
  32. io.replace("CMakeLists.txt", "-Wl,--no-undefined", "-Wl", {plain = true})
  33. elseif package:is_plat("windows") and not package:config("shared") then
  34. io.replace("inc/rlottie.h", "#define RLOTTIE_API __declspec(dllimport)", "#define RLOTTIE_API", {plain = true})
  35. end
  36. import("package.tools.cmake").install(package, configs)
  37. end)
  38. on_test(function (package)
  39. assert(package:check_cxxsnippets({test = [[
  40. #include "rlottie.h"
  41. using namespace rlottie;
  42. void test() {
  43. rlottie::Surface surface(nullptr, 100, 100, 0);
  44. }
  45. ]]}, {configs = {languages = "c++11"}}))
  46. end)