xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("qt5network")
  2. set_base("qt5lib")
  3. set_kind("library")
  4. on_load(function (package)
  5. package:add("deps", "qt5core", {debug = package:is_debug(), version = package:version_str()})
  6. package:data_set("libname", "Network")
  7. if package:is_plat("linux") then
  8. -- we need system openssl with evp-kdf
  9. -- @see https://github.com/xmake-io/xmake-repo/pull/1057#issuecomment-1069006866
  10. if linuxos.name() == "fedora" then
  11. package:add("deps", "openssl", {system = true})
  12. else
  13. package:add("deps", "openssl")
  14. end
  15. elseif package:is_plat("iphoneos") then
  16. package:data_set("frameworks", {"GSS", "IOKit", "Security", "SystemConfiguration"})
  17. end
  18. package:base():script("load")(package)
  19. end)
  20. on_test(function (package)
  21. local cxflags
  22. if not package:is_plat("windows") then
  23. cxflags = "-fPIC"
  24. end
  25. assert(package:check_cxxsnippets({test = [[
  26. int test(int argc, char** argv) {
  27. QCoreApplication app(argc, argv);
  28. QByteArray datagram = "Hello from xmake!";
  29. QUdpSocket udpSocket;
  30. udpSocket.writeDatagram(datagram, QHostAddress::Broadcast, 45454);
  31. return app.exec();
  32. }
  33. ]]}, {configs = {languages = "c++14", cxflags = cxflags}, includes = {"QCoreApplication", "QByteArray", "QUdpSocket"}}))
  34. end)