add lunasvg and rmlui (#1798)

* add lunasvg

* add rmlui

* fix rmlui
pull/1799/head
Hoildkv 2 years ago committed by GitHub
parent 3a08ad0456
commit a5795536cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      packages/l/lunasvg/xmake.lua
  2. 54
      packages/r/rmlui/xmake.lua

@ -0,0 +1,33 @@
package("lunasvg")
set_homepage("https://github.com/sammycage/lunasvg")
set_description("LunaSVG - SVG rendering library in C++")
set_license("MIT")
add_urls("https://github.com/sammycage/lunasvg/archive/refs/tags/$(version).tar.gz",
"https://github.com/sammycage/lunasvg.git")
add_versions("v2.3.5", "350ff56aa1acdedefe2ad8a4241a9fb8f9b232868adc7bd36dfb3dbdd57e2e93")
add_deps("cmake")
on_load("windows", function (package)
if package:config("shared") then
package:add("defines", "LUNASVG_SHARED")
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <lunasvg.h>
void test() {
auto document = lunasvg::Document::loadFromFile("tiger.svg");
auto bitmap = document->renderToBitmap();
}
]]}, {configs = {languages = "c++11"}}))
end)

@ -0,0 +1,54 @@
package("rmlui")
set_homepage("https://mikke89.github.io/RmlUiDoc/")
set_description("RmlUi is the C++ user interface library based on the HTML and CSS standards.")
set_license("MIT")
add_urls("https://github.com/mikke89/RmlUi/archive/refs/tags/$(version).tar.gz",
"https://github.com/mikke89/RmlUi.git")
add_versions("5.0", "1f6eac0e140c35275df32088579fc3a0087fa523082c21c28d5066bd6d18882a")
add_configs("freetype", {description = "Building with the default FreeType font engine.", default = true, type = "boolean"})
add_configs("lua", {description = "Build Lua bindings.", default = false, type = "boolean"})
add_configs("rtti", {description = "Build with rtti and exceptions enabled.", default = true, type = "boolean"})
add_deps("cmake")
if is_plat("windows") then
add_syslinks("shlwapi", "imm32")
elseif is_plat("macosx") then
add_frameworks("Cocoa")
end
on_load("windows", "macosx", "linux", function (package)
if not package:config("shared") then
package:add("defines", "RMLUI_STATIC_LIB")
end
if package:config("freetype") then
package:add("deps", "freetype", "zlib")
end
if package:config("lua") then
package:add("deps", "lua")
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_SAMPLES=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DNO_FONT_INTERFACE_DEFAULT=" .. (package:config("freetype") and "OFF" or "ON"))
table.insert(configs, "-DBUILD_LUA_BINDINGS=" .. (package:config("lua") and "ON" or "OFF"))
table.insert(configs, "-DDISABLE_RTTI_AND_EXCEPTIONS=" .. (package:config("rtti") and "OFF" or "ON"))
if package:config("freetype") then
import("package.tools.cmake").install(package, configs, {packagedeps = {"zlib"}})
else
import("package.tools.cmake").install(package, configs)
end
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <RmlUi/Core.h>
void test() {
Rml::Context* context = Rml::CreateContext("default", Rml::Vector2i(640, 480));
}
]]}, {configs = {languages = "c++14"}}))
end)
Loading…
Cancel
Save