xmake.lua 2.2 KB

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