Sfoglia il codice sorgente

yojimbo: add package (#7887)

* yojimbo: add package

* yojimbo: adjusted package for windows arm64

* yojimbo: added missing lib defines

* yojimbo: excluded wasm and bsd plateform

* yojimbo: adjusted serialize defines

* yojimbo: fixed typo and defines

* yojimbo: added patch for mingw

* yojimbo: changed to target 1.2.5

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* forced lib to static

* added system link ws2

* added system link iphlpapi

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: Jérôme Leclercq <[email protected]>
Co-authored-by: star9029 <[email protected]>
Corentin Chrisment 3 settimane fa
parent
commit
41312fc452
1 ha cambiato i file con 61 aggiunte e 0 eliminazioni
  1. 61 0
      packages/y/yojimbo/xmake.lua

+ 61 - 0
packages/y/yojimbo/xmake.lua

@@ -0,0 +1,61 @@
+package("yojimbo")
+    set_homepage("https://github.com/mas-bandwidth/yojimbo")
+    set_description("A network library for client/server games")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/mas-bandwidth/yojimbo/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/mas-bandwidth/yojimbo.git")
+
+    add_versions("v1.2.5", "0bbac01643f47f4167c884b88a10ed64b327eb4c6cae920551d7bcd447f1e292")
+
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
+
+    add_deps("libsodium")
+
+    if is_plat("windows") and is_arch("arm64") then
+        add_defines("SERIALIZE_LITTLE_ENDIAN")
+    end
+
+    if is_plat("windows", "mingw") then
+        add_syslinks("ws2_32", "iphlpapi", "qwave")
+    end
+
+    on_install("!wasm and !bsd", function (package)
+        io.writefile("xmake.lua", [[
+        add_rules("mode.release", "mode.debug")
+
+        add_requires("libsodium")
+        add_includedirs(".", "include", "tlsf", "netcode", "reliable", "serialize", {public = true})
+
+        if is_plat("windows") and is_arch("arm64") then
+            add_defines("SERIALIZE_LITTLE_ENDIAN")
+        end
+
+        if is_mode("release") then
+            add_defines("YOJIMBO_RELEASE", "NETCODE_RELEASE", "RELIABLE_RELEASE")
+        elseif is_mode("debug") then
+            add_defines("YOJIMBO_DEBUG", "NETCODE_DEBUG", "RELIABLE_DEBUG")
+        end
+
+        target("yojimbo")
+            set_kind("$(kind)")
+            add_files("source/**.cpp", "netcode/netcode.c", "reliable/reliable.c", "tlsf/tlsf.c")
+            add_headerfiles("include/(**.h)", "serialize/(**.h)")
+            add_packages("libsodium")
+
+            if is_plat("windows", "mingw") then
+                add_syslinks("ws2_32", "iphlpapi", "qwave")
+            end
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                InitializeYojimbo();
+            }
+        ]]}, {includes = "yojimbo.h"}))
+    end)