xmake.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("udt")
  2. set_homepage("https://github.com/dorkbox/UDT")
  3. set_description("UDP-based Data Transfer Protocol")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/dorkbox/UDT/archive/8272c251deb8bfd7289646b7604f1079b59194d0.tar.gz",
  6. "https://github.com/dorkbox/UDT.git")
  7. add_versions("2017.12.03", "af743ffdb2e40225d7375df1a3d6320127b903322af4021460681f1052b7461e")
  8. if is_plat("windows", "mingw") then
  9. add_defines("WINDOWS")
  10. add_syslinks("Ws2_32")
  11. elseif is_plat("linux", "bsd") then
  12. add_syslinks("pthread", "m")
  13. end
  14. on_install("!windows or windows|!x86", function (package)
  15. io.writefile("xmake.lua", [[
  16. add_rules("mode.debug", "mode.release")
  17. target("udt")
  18. set_kind("$(kind)")
  19. if is_mode("debug") then
  20. add_defines("_DEBUG")
  21. end
  22. if is_plat("windows") and is_kind("shared") then
  23. add_rules("utils.symbols.export_all", {export_classes = true})
  24. end
  25. set_languages("cxx11")
  26. if is_plat("windows", "mingw") then
  27. add_defines("WINDOWS")
  28. add_syslinks("Ws2_32")
  29. elseif is_plat("linux", "bsd") then
  30. add_syslinks("pthread", "m")
  31. end
  32. add_files("src/*.cpp")
  33. add_headerfiles("src/udt.h")
  34. ]])
  35. import("package.tools.xmake").install(package)
  36. end)
  37. on_test(function (package)
  38. assert(package:check_cxxsnippets({test = [[
  39. void test() {
  40. UDT::startup();
  41. }
  42. ]]}, {configs = {languages = "c++11"}, includes = "udt.h"}))
  43. end)