xmake.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package("rmlui")
  2. set_homepage("https://mikke89.github.io/RmlUiDoc/")
  3. set_description("RmlUi is the C++ user interface library based on the HTML and CSS standards.")
  4. set_license("MIT")
  5. add_urls("https://github.com/mikke89/RmlUi/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mikke89/RmlUi.git")
  7. add_versions("5.0", "1f6eac0e140c35275df32088579fc3a0087fa523082c21c28d5066bd6d18882a")
  8. add_configs("freetype", {description = "Building with the default FreeType font engine.", default = true, type = "boolean"})
  9. add_configs("lua", {description = "Build Lua bindings.", default = false, type = "boolean"})
  10. add_configs("rtti", {description = "Build with rtti and exceptions enabled.", default = true, type = "boolean"})
  11. add_configs("svg", {description = "Build with SVG plugin enabled.", default = false, type = "boolean"})
  12. add_configs("lottie", {description = "Build with Lottie plugin enabled.", default = false, type = "boolean"})
  13. add_deps("cmake")
  14. if is_plat("windows") then
  15. add_syslinks("shlwapi", "imm32")
  16. elseif is_plat("macosx") then
  17. add_frameworks("Cocoa")
  18. end
  19. on_load("windows", "macosx", "linux", function (package)
  20. if not package:config("shared") then
  21. package:add("defines", "RMLUI_STATIC_LIB")
  22. end
  23. if package:config("freetype") then
  24. package:add("deps", "freetype", "zlib")
  25. end
  26. if package:config("lua") then
  27. package:add("deps", "lua")
  28. end
  29. if package:config("svg") then
  30. package:add("deps", "lunasvg")
  31. end
  32. if package:config("lottie") then
  33. package:add("deps", "rlottie")
  34. end
  35. end)
  36. on_install("windows", "macosx", "linux", function (package)
  37. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_SAMPLES=OFF"}
  38. if package:is_plat("macosx") and package:is_arch("arm64") then
  39. table.insert(configs, "-DCMAKE_OSX_ARCHITECTURES=arm64")
  40. end
  41. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  42. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  43. table.insert(configs, "-DNO_FONT_INTERFACE_DEFAULT=" .. (package:config("freetype") and "OFF" or "ON"))
  44. table.insert(configs, "-DBUILD_LUA_BINDINGS=" .. (package:config("lua") and "ON" or "OFF"))
  45. table.insert(configs, "-DENABLE_SVG_PLUGIN=" .. (package:config("svg") and "ON" or "OFF"))
  46. table.insert(configs, "-DENABLE_LOTTIE_PLUGIN=" .. (package:config("lottie") and "ON" or "OFF"))
  47. table.insert(configs, "-DDISABLE_RTTI_AND_EXCEPTIONS=" .. (package:config("rtti") and "OFF" or "ON"))
  48. if package:config("freetype") then
  49. import("package.tools.cmake").install(package, configs, {packagedeps = {"zlib"}})
  50. else
  51. import("package.tools.cmake").install(package, configs)
  52. end
  53. end)
  54. on_test(function (package)
  55. assert(package:check_cxxsnippets({test = [[
  56. #include <RmlUi/Core.h>
  57. void test() {
  58. Rml::Context* context = Rml::CreateContext("default", Rml::Vector2i(640, 480));
  59. }
  60. ]]}, {configs = {languages = "c++14"}}))
  61. end)