yalantinglibs: improve package (#4508)

* yalantinglibs: improve package

* limit plat
pull/3939/merge
star9029 5 months ago committed by GitHub
parent 9be01cdcee
commit ebb8514533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 52
      packages/y/yalantinglibs/xmake.lua

@ -4,22 +4,58 @@ package("yalantinglibs")
set_description("A collection of modern C++ libraries") set_description("A collection of modern C++ libraries")
set_license("Apache-2.0") set_license("Apache-2.0")
set_urls("https://github.com/alibaba/yalantinglibs/archive/refs/tags/$(version).zip", set_urls("https://github.com/alibaba/yalantinglibs/archive/refs/tags/$(version).tar.gz",
"https://github.com/alibaba/yalantinglibs.git") "https://github.com/alibaba/yalantinglibs.git")
add_versions("0.3.4", "88ba1ae2aa828383e51af95dbd029f90d16d5428d868739c8c91de3f31bed70b") add_versions("0.3.4", "dd5edd3f43f23cd4b0614896e6587b61bb38c981dc21c85a54bcc54800d0dfe8")
add_configs("ssl", {description = "Enable SSL", default = false, type = "boolean"})
add_deps("asio", "async_simple") add_configs("ssl", {description = "Enable ssl support", default = false, type = "boolean"})
add_configs("pmr", {description = "Enable pmr support", default = false, type = "boolean"})
add_configs("io_uring", {description = "Enable io_uring", default = false, type = "boolean"})
add_configs("file_io_uring", {description = "Enable file io_uring", default = false, type = "boolean"})
add_configs("struct_pack_unportable_type", {description = "enable struct_pack unportable type(like wchar_t)", default = false, type = "boolean"})
add_configs("struct_pack_unportable_optimize", {description = "enable struct_pack optimize(but cost more compile time)", default = false, type = "boolean"})
add_deps("cinatra", "iguana")
on_load(function (package) on_load(function (package)
if package:config("ssl")then if package:config("ssl") then
package:add("deps", "openssl3") package:add("deps", "openssl")
package:add("defines", "YLT_ENABLE_SSL")
end
if package:config("pmr") then
package:add("defines", "YLT_ENABLE_PMR")
end
if package:config("io_uring") then
package:add("deps", "liburing")
package:add("defines", "ASIO_HAS_IO_URING", "ASIO_DISABLE_EPOLL", "ASIO_HAS_FILE", "YLT_ENABLE_FILE_IO_URING")
end
if package:config("file_io_uring") then
package:add("deps", "liburing")
package:add("defines", "ASIO_HAS_IO_URING", "ASIO_HAS_FILE", "YLT_ENABLE_FILE_IO_URING")
end
if package:config("struct_pack_unportable_type") then
package:add("defines", "STRUCT_PACK_ENABLE_UNPORTABLE_TYPE")
end
if package:config("struct_pack_unportable_optimize") then
package:add("defines", "YLT_ENABLE_STRUCT_PACK_OPTIMIZE")
end end
end) end)
on_install("linux", "macos", "windows", function (package) on_install("windows", "linux", "macosx", function (package)
os.cp("include", package:installdir()) local configs = {
"-DINSTALL_THIRDPARTY=OFF",
"-DINSTALL_STANDALONE=OFF",
"-DINSTALL_INDEPENDENT_THIRDPARTY=OFF",
"-DINSTALL_INDEPENDENT_STANDALONE=OFF",
"-DCMAKE_PROJECT_NAME=xmake",
}
for name, enabled in table.orderpairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
table.insert(configs, "-DYLT_ENABLE_" .. name:upper() .. "=" .. (enabled and "ON" or "OFF"))
end
end
import("package.tools.cmake").install(package, configs)
end) end)
on_test(function (package) on_test(function (package)

Loading…
Cancel
Save