xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package("yojimbo")
  2. set_homepage("https://github.com/mas-bandwidth/yojimbo")
  3. set_description("A network library for client/server games")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/mas-bandwidth/yojimbo/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mas-bandwidth/yojimbo.git")
  7. add_versions("v1.2.5", "0bbac01643f47f4167c884b88a10ed64b327eb4c6cae920551d7bcd447f1e292")
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. end
  11. add_deps("libsodium")
  12. if is_plat("windows") and is_arch("arm64") then
  13. add_defines("SERIALIZE_LITTLE_ENDIAN")
  14. end
  15. if is_plat("windows", "mingw") then
  16. add_syslinks("ws2_32", "iphlpapi", "qwave")
  17. end
  18. on_install("!wasm and !bsd", function (package)
  19. io.writefile("xmake.lua", [[
  20. add_rules("mode.release", "mode.debug")
  21. add_requires("libsodium")
  22. add_includedirs(".", "include", "tlsf", "netcode", "reliable", "serialize", {public = true})
  23. if is_plat("windows") and is_arch("arm64") then
  24. add_defines("SERIALIZE_LITTLE_ENDIAN")
  25. end
  26. if is_mode("release") then
  27. add_defines("YOJIMBO_RELEASE", "NETCODE_RELEASE", "RELIABLE_RELEASE")
  28. elseif is_mode("debug") then
  29. add_defines("YOJIMBO_DEBUG", "NETCODE_DEBUG", "RELIABLE_DEBUG")
  30. end
  31. target("yojimbo")
  32. set_kind("$(kind)")
  33. add_files("source/**.cpp", "netcode/netcode.c", "reliable/reliable.c", "tlsf/tlsf.c")
  34. add_headerfiles("include/(**.h)", "serialize/(**.h)")
  35. add_packages("libsodium")
  36. if is_plat("windows", "mingw") then
  37. add_syslinks("ws2_32", "iphlpapi", "qwave")
  38. end
  39. ]])
  40. import("package.tools.xmake").install(package)
  41. end)
  42. on_test(function (package)
  43. assert(package:check_cxxsnippets({test = [[
  44. void test() {
  45. InitializeYojimbo();
  46. }
  47. ]]}, {includes = "yojimbo.h"}))
  48. end)