xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package("thorvg")
  2. set_homepage("https://www.thorvg.org")
  3. set_description("Thor Vector Graphics is a lightweight portable library used for drawing vector-based scenes and animations including SVG and Lottie. It can be freely utilized across various software platforms and applications to visualize graphical contents.")
  4. set_license("MIT")
  5. add_urls("https://github.com/thorvg/thorvg/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/thorvg/thorvg.git")
  7. add_versions("v0.13.2", "03b5dbb4c73ff221a4bd7243cc0ad377aecff4c3077f5a57ee2902e4122d3218")
  8. add_configs("c_api", {description = "Enable API bindings", default = false, type = "boolean"})
  9. if is_plat("wasm") then
  10. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  11. end
  12. if is_plat("linux", "bsd") then
  13. add_syslinks("pthread", "m")
  14. end
  15. add_deps("meson", "ninja")
  16. on_install("!android", function (package)
  17. if package:is_plat("mingw") then
  18. io.replace("src/loaders/svg/tvgSvgLoader.cpp", "float_t", "float", {plain = true})
  19. end
  20. local configs = {}
  21. if package:config("shared") then
  22. table.insert(configs, "-Ddefault_library=shared")
  23. else
  24. table.insert(configs, "-Ddefault_library=static")
  25. package:add("defines", "TVG_STATIC")
  26. end
  27. if package:config("c_api") then
  28. table.insert(configs, "-Dbindings=capi")
  29. end
  30. import("package.tools.meson").install(package, configs)
  31. end)
  32. on_test(function (package)
  33. assert(package:check_cxxsnippets({test = [[
  34. #include <thorvg.h>
  35. void test() {
  36. tvg::Initializer::init(tvg::CanvasEngine::Sw, 0);
  37. }
  38. ]]}, {configs = {languages = "c++14"}}))
  39. if package:config("c_api") then
  40. assert(package:has_cxxfuncs("tvg_engine_init", {includes = "thorvg_capi.h"}))
  41. end
  42. end)