From 84283fa86228c7e1cd20dc5e5d9a1b3bdfd9d374 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 27 Sep 2023 19:41:59 +0800 Subject: [PATCH] libsigcplusplus: add package (#2654) * libsigcplusplus: add package * improve config name * disable plat * disable plat --- packages/l/libsigcplusplus/xmake.lua | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 packages/l/libsigcplusplus/xmake.lua diff --git a/packages/l/libsigcplusplus/xmake.lua b/packages/l/libsigcplusplus/xmake.lua new file mode 100644 index 000000000..186b10eb9 --- /dev/null +++ b/packages/l/libsigcplusplus/xmake.lua @@ -0,0 +1,44 @@ +package("libsigcplusplus") + set_homepage("https://libsigcplusplus.github.io/libsigcplusplus/") + set_description("libsigc++ implements a typesafe callback system for standard C++. It allows you to define signals and to connect those signals to any callback function, either global or a member function, regardless of whether it is static or virtual.") + set_license("LGPL-3.0") + + add_urls("https://github.com/libsigcplusplus/libsigcplusplus/archive/refs/tags/$(version).tar.gz", + "https://github.com/libsigcplusplus/libsigcplusplus.git") + + add_versions("3.4.0", "445d889079041b41b368ee3b923b7c71ae10a54da03bc746f2d0723e28ba2291") + + add_configs("deprecated_api", {description = "Build deprecated API and include it in the library", default = false, type = "boolean"}) + if is_plat("wasm") then + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + end + + add_deps("meson", "ninja") + add_includedirs("include/sigc++-3.0", "lib/sigc++-3.0/include") + + on_install("windows", "linux", "macosx", "mingw", "msys", "iphoneos", "cross", "wasm", function (package) + local configs = {"-Dvalidation=false", "-Dbuild-examples=false", "-Dbuild-tests=false"} + table.insert(configs, "-Dbuild-deprecated-api=" .. (package:config("deprecated_api") and "true" or "false")) + if package:config("shared") then + table.insert(configs, "-Ddefault_library=shared") + else + table.insert(configs, "-Ddefault_library=static") + if package:is_plat("windows") then + package:add("defines", "SIGC_BUILD") + end + end + import("package.tools.meson").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + void on_print(const std::string& str) {} + void test() { + sigc::signal signal_print; + signal_print.connect(sigc::ptr_fun(&on_print)); + signal_print.emit("hello world\n"); + } + ]]}, {configs = {languages = "c++17"}})) + end)