plutosvg: add package (#5704)

pull/5658/head
star9029 3 months ago committed by GitHub
parent 85f3fb81ac
commit 8f4880d4a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 38
      packages/p/plutosvg/xmake.lua
  2. 9
      packages/p/plutovg/xmake.lua

@ -0,0 +1,38 @@
package("plutosvg")
set_homepage("https://github.com/sammycage/plutosvg")
set_description("Tiny SVG rendering library in C")
set_license("MIT")
add_urls("https://github.com/sammycage/plutosvg/archive/refs/tags/$(version).tar.gz",
"https://github.com/sammycage/plutosvg.git")
add_versions("v0.0.2", "92f9e74d5b50f485c73192791e3f755023d1573e3e009adf8c7f837e4b318e82")
add_deps("cmake")
add_deps("plutovg")
add_includedirs("include", "include/plutosvg")
on_load(function (package)
if not package:config("shared") then
package:add("defines", "PLUTOSVG_BUILD_STATIC")
end
end)
on_install(function (package)
io.replace("CMakeLists.txt", "FetchContent_MakeAvailable(plutovg)", "find_package(plutovg)", {plain = true})
local configs = {"-DPLUTOSVG_BUILD_EXAMPLES=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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)
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.trycp(path.join(package:buildir(), "plutosvg.pdb"), dir)
end
end)
on_test(function (package)
assert(package:has_cfuncs("plutosvg_document_load_from_file", {includes = "plutosvg/plutosvg.h"}))
end)

@ -14,7 +14,9 @@ package("plutovg")
add_deps("cmake")
on_load("windows", "mingw", function (package)
add_includedirs("include", "include/plutovg")
on_load(function (package)
if not package:config("shared") then
package:add("defines", "PLUTOVG_BUILD_STATIC")
end
@ -25,6 +27,11 @@ package("plutovg")
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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)
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.trycp(path.join(package:buildir(), "plutovg.pdb"), dir)
end
end)
on_test(function (package)

Loading…
Cancel
Save