xmake.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("libsigcplusplus")
  2. set_homepage("https://libsigcplusplus.github.io/libsigcplusplus/")
  3. 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.")
  4. set_license("LGPL-3.0")
  5. add_urls("https://github.com/libsigcplusplus/libsigcplusplus/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/libsigcplusplus/libsigcplusplus.git")
  7. add_versions("3.8.0", "fb2356847434c2cef8fc6093b2fd571cf9de9ba795d3b8ffe4ab70d1b8553cd9")
  8. add_versions("3.6.0", "bbe81e4f6d8acb41a9795525a38c0782751dbc4af3d78a9339f4a282e8a16c38")
  9. add_versions("3.4.0", "445d889079041b41b368ee3b923b7c71ae10a54da03bc746f2d0723e28ba2291")
  10. add_configs("deprecated_api", {description = "Build deprecated API and include it in the library", default = false, type = "boolean"})
  11. if is_plat("wasm") then
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. end
  14. add_deps("meson", "ninja")
  15. add_includedirs("include/sigc++-3.0", "lib/sigc++-3.0/include")
  16. on_install("windows", "linux", "macosx", "mingw", "msys", "iphoneos", "cross", "wasm", function (package)
  17. local configs = {"-Dvalidation=false", "-Dbuild-examples=false", "-Dbuild-tests=false"}
  18. table.insert(configs, "-Dbuild-deprecated-api=" .. (package:config("deprecated_api") and "true" or "false"))
  19. local shflags = {}
  20. if package:config("shared") then
  21. table.insert(configs, "-Ddefault_library=shared")
  22. if package:is_plat("linux", "macosx") then
  23. shflags = "-lstdc++"
  24. end
  25. else
  26. table.insert(configs, "-Ddefault_library=static")
  27. if package:is_plat("windows") then
  28. package:add("defines", "SIGC_BUILD")
  29. end
  30. end
  31. import("package.tools.meson").install(package, configs, {shflags = shflags})
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. #include <string>
  36. #include <sigc++/sigc++.h>
  37. void on_print(const std::string& str) {}
  38. void test() {
  39. sigc::signal<void(const std::string&)> signal_print;
  40. signal_print.connect(sigc::ptr_fun(&on_print));
  41. signal_print.emit("hello world\n");
  42. }
  43. ]]}, {configs = {languages = "c++17"}}))
  44. end)