2
0

xmake.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("qt6network")
  2. set_base("qt6lib")
  3. set_kind("library")
  4. on_load(function (package)
  5. package:add("deps", "qt6core", {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 package:is_plat("windows") then
  23. cxflags = {"/Zc:__cplusplus", "/permissive-"}
  24. else
  25. cxflags = "-fPIC"
  26. end
  27. assert(package:check_cxxsnippets({test = [[
  28. int test(int argc, char** argv) {
  29. QCoreApplication app(argc, argv);
  30. QByteArray datagram = "Hello from xmake!";
  31. QUdpSocket udpSocket;
  32. udpSocket.writeDatagram(datagram, QHostAddress::Broadcast, 45454);
  33. return app.exec();
  34. }
  35. ]]}, {configs = {languages = "c++17", cxflags = cxflags}, includes = {"QCoreApplication", "QByteArray", "QUdpSocket"}}))
  36. end)