From 29999d386170d368b0474571f628106de5d33926 Mon Sep 17 00:00:00 2001 From: star9029 Date: Thu, 6 Jun 2024 21:55:45 +0800 Subject: [PATCH] blend2d: update to 0.11.1 (#4256) * blend2d: update to 0.11.1 * fix windows arm * add on_check --- packages/b/blend2d/xmake.lua | 45 ++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/packages/b/blend2d/xmake.lua b/packages/b/blend2d/xmake.lua index 7f7711c4e..243081e2a 100644 --- a/packages/b/blend2d/xmake.lua +++ b/packages/b/blend2d/xmake.lua @@ -3,29 +3,54 @@ package("blend2d") set_description("2D Vector Graphics Engine Powered by a JIT Compiler") set_license("zlib") - add_urls("https://github.com/blend2d/blend2d.git") - add_versions("2022.05.12", "84987c5f76c1b8f271e8556a4b87bcab78094c70") + set_urls("https://blend2d.com/download/blend2d-$(version).tar.gz", + "https://github.com/blend2d/blend2d.git") + + add_versions("0.11.1", "f46d61b6aa477fea1a353a41f5906d4e861817ae059ed22fc6ecdd50ff859dd2") + + add_configs("jit", {description = "Enable JIT compiler support", default = true, type = "boolean"}) add_deps("cmake") - add_deps("asmjit") - if is_plat("linux") then + if is_plat("linux", "bsd") then add_syslinks("pthread") end + on_check("windows", function (package) + import("core.tool.toolchain") + + local msvc = toolchain.load("msvc", {plat = package:plat(), arch = package:arch()}) + if msvc and package:is_arch("arm.*") then + local vs = msvc:config("vs") + assert(vs and tonumber(vs) >= 2022, "package(blend2d/arm): need vs >= 2022") + end + end) + on_load(function (package) - package:add("deps", "asmjit", {configs = {shared = package:config("shared")}}) + if package:config("jit") then + package:add("deps", "asmjit") + end if not package:config("shared") then package:add("defines", "BL_STATIC") end end) - on_install("windows", "macosx", "linux", function (package) - local configs = {"-DBLEND2D_TEST=OFF", "-DBLEND2D_NO_STDCXX=0"} - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + on_install("!iphoneos", function (package) + local configs = {} + if package:config("jit") then + table.insert(configs, "-DBLEND2D_EXTERNAL_ASMJIT=TRUE") + table.insert(configs, "-DBLEND2D_NO_JIT=OFF") + else + table.insert(configs, "-DBLEND2D_NO_JIT=ON") + end + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBLEND2D_STATIC=" .. (package:config("shared") and "FALSE" or "TRUE")) - io.replace("CMakeLists.txt", 'include("${ASMJIT_DIR}/CMakeLists.txt")', "", {plain = true}) - import("package.tools.cmake").install(package, configs, {packagedeps = "asmjit"}) + + local cxflags + if package:is_plat("windows") and package:is_arch("arm.*") then + cxflags = "-D__ARM_NEON" + end + import("package.tools.cmake").install(package, configs, {cxflags = cxflags}) end) on_test(function (package)