xmake.lua 2.5 KB

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