plutosvg: add package (#5704)
parent
85f3fb81ac
commit
8f4880d4a4
2 changed files with 46 additions and 1 deletions
@ -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) |
Loading…
Reference in new issue