xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. package:set("kind", "library")
  20. end)
  21. on_test(function (package)
  22. local cxflags
  23. if not package:is_plat("windows") then
  24. cxflags = "-fPIC"
  25. end
  26. assert(package:check_cxxsnippets({test = [[
  27. int test(int argc, char** argv) {
  28. QCoreApplication app(argc, argv);
  29. QByteArray datagram = "Hello from xmake!";
  30. QUdpSocket udpSocket;
  31. udpSocket.writeDatagram(datagram, QHostAddress::Broadcast, 45454);
  32. return app.exec();
  33. }
  34. ]]}, {configs = {languages = "c++14", cxflags = cxflags}, includes = {"QCoreApplication", "QByteArray", "QUdpSocket"}}))
  35. end)