Browse Source

zydis: disable test (#6930)

* zydis: disable test

* fix build type
star9029 5 months ago
parent
commit
53d0642bcf
1 changed files with 30 additions and 19 deletions
  1. 30 19
      packages/z/zydis/xmake.lua

+ 30 - 19
packages/z/zydis/xmake.lua

@@ -4,7 +4,7 @@ package("zydis")
     set_license("MIT")
 
     add_urls("https://github.com/zyantific/zydis/archive/refs/tags/$(version).tar.gz",
-             "https://github.com/zyantific/zydis.git")
+             "https://github.com/zyantific/zydis.git", {submodules = false})
 
     add_versions("v4.1.0", "31f23de8abb4cc2efa0fd0e827bbabcaa0f3d00fcaed8598e05295ba7b3806ad")
     add_versions("v4.0.0", "14e991fd97b021e15c77a4726a0ae8a4196d6521ab505acb5c51fc2f9be9530a")
@@ -28,7 +28,11 @@ package("zydis")
             ["v4.0.0"] = "v1.4.0",
             ["v4.1.0"] = "v1.5.0",
         }
-        package:add("deps", "zycore-c " .. zycore_c_vers[package:version_str()])
+        if package:version() then
+            package:add("deps", "zycore-c " .. zycore_c_vers[package:version_str()])
+        else
+            package:add("deps", "zycore-c")
+        end
 
         if package:is_plat("android") then
             package:add("patches", "4.0.0", "patches/v4.0.0/cmake.patch", "061b2286e8e96178294f8b25e0c570bf65f8739848ea1de57dd36be710001da4")
@@ -37,27 +41,34 @@ package("zydis")
     end)
 
     on_install("!wasm and !iphoneos", function (package)
-        if package:is_plat("mingw") and package:version():ge("3.2.1") then
-            local rc_str = io.readfile("resources/VersionInfo.rc", {encoding = "utf16le"})
-            io.writefile("resources/VersionInfo.rc", rc_str, {encoding = "utf8"})
-        elseif package:is_plat("macosx") then
-            if package:version():eq("3.2.1") then
-                io.replace("include/Zydis/ShortString.h", "#pragma pack(push, 1)","", {plain = true})
-                io.replace("include/Zydis/ShortString.h", "#pragma pack(pop)","", {plain = true})
-            elseif package:version():eq("4.0.0") then
-                io.replace("include/Zydis/ShortString.h", "#   pragma pack(push, 1)","", {plain = true})
-                io.replace("include/Zydis/ShortString.h", "#   pragma pack(pop)","", {plain = true})
+        local version = package:version()
+        if version then
+            if package:is_plat("mingw") and version:ge("3.2.1") then
+                local rc_str = io.readfile("resources/VersionInfo.rc", {encoding = "utf16le"})
+                io.writefile("resources/VersionInfo.rc", rc_str, {encoding = "utf8"})
+            elseif package:is_plat("macosx") then
+                if version:eq("3.2.1") then
+                    io.replace("include/Zydis/ShortString.h", "#pragma pack(push, 1)","", {plain = true})
+                    io.replace("include/Zydis/ShortString.h", "#pragma pack(pop)","", {plain = true})
+                elseif version:eq("4.0.0") then
+                    io.replace("include/Zydis/ShortString.h", "#   pragma pack(push, 1)","", {plain = true})
+                    io.replace("include/Zydis/ShortString.h", "#   pragma pack(pop)","", {plain = true})
+                end
+            elseif package:is_plat("windows") and version:ge("4.0.0") and (not package:config("shared")) then
+                package:add("defines", "ZYDIS_STATIC_BUILD")
             end
-        elseif package:is_plat("windows") and package:version():ge("4.0.0") and (not package:config("shared")) then
-            package:add("defines", "ZYDIS_STATIC_BUILD")
-        end
 
-        if package:version():ge("4.1.0") then
-            io.replace("CMakeLists.txt", "set(ZYDIS_ROOT_PROJECT ON)", "", {plain = true})
+            if version:ge("4.1.0") then
+                io.replace("CMakeLists.txt", "set(ZYDIS_ROOT_PROJECT ON)", "", {plain = true})
+            end
         end
 
-        local configs = {"-DZYAN_SYSTEM_ZYCORE=ON"}
-        table.insert(configs, "-DZYDIS_BUILD_EXAMPLES=OFF")
+        local configs = {
+            "-DZYDIS_BUILD_EXAMPLES=OFF",
+            "-DZYDIS_BUILD_TESTS=OFF",
+            "-DZYAN_SYSTEM_ZYCORE=ON",
+        }
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DZYDIS_BUILD_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DZYDIS_BUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))