From 9796cf762f2181ed1166b62a7a4253a0f773e6db Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 30 May 2025 01:22:51 +0000 Subject: [PATCH 1/4] Update xtensor to 0.26.0 --- packages/x/xtensor/xmake.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/x/xtensor/xmake.lua b/packages/x/xtensor/xmake.lua index 05367540c83..78b572a488f 100644 --- a/packages/x/xtensor/xmake.lua +++ b/packages/x/xtensor/xmake.lua @@ -7,6 +7,7 @@ package("xtensor") add_urls("https://github.com/xtensor-stack/xtensor/archive/refs/tags/$(version).tar.gz", "https://github.com/xtensor-stack/xtensor.git") + add_versions("0.26.0", "f5f42267d850f781d71097b50567a480a82cd6875a5ec3e6238555e0ef987dc6") add_versions("0.25.0", "32d5d9fd23998c57e746c375a544edf544b74f0a18ad6bc3c38cbba968d5e6c7") add_versions("0.24.7", "0fbbd524dde2199b731b6af99b16063780de6cf1d0d6cb1f3f4d4ceb318f3106") add_versions("0.24.3", "3acde856b9fb8cf4e2a7b66726da541275d40ab9b002e618ad985ab97f08ca4f") From 6b6cdbb79cd4c1b20ee7f3caccc45dd78554866a Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 15 Jul 2025 20:28:10 +0800 Subject: [PATCH 2/4] Update xmake.lua --- packages/x/xtensor/xmake.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/x/xtensor/xmake.lua b/packages/x/xtensor/xmake.lua index 78b572a488f..34a8ca0e27e 100644 --- a/packages/x/xtensor/xmake.lua +++ b/packages/x/xtensor/xmake.lua @@ -18,13 +18,18 @@ package("xtensor") add_configs("simd", {description = "Enable SIMD acceleration ", default = true, type = "boolean"}) add_deps("cmake") - add_deps("xtl ^0.7.0") - on_load("windows", "macosx", "linux", "mingw@windows", function (package) + on_load(function (package) + if package:version() and package:version():ge("0.26.0") then + package:add("deps", "xtl >=0.8.0") + else + package:add("deps", "xtl ^0.7.0") + end if package:config("simd") then package:add("deps", "xsimd ^11.0.0") end end) + on_install("windows", "macosx", "linux", "mingw@windows", function (package) local configs = {"-DXTENSOR_USE_XSIMD=" .. (package:config("simd") and "ON" or "OFF")} import("package.tools.cmake").install(package, configs, {packagedeps = "xsimd"}) From 7f45ff6f8ce4b9c0ef1f2b27291f839645ba8c10 Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 15 Jul 2025 20:46:16 +0800 Subject: [PATCH 3/4] Update xmake.lua --- packages/x/xtensor/xmake.lua | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/x/xtensor/xmake.lua b/packages/x/xtensor/xmake.lua index 34a8ca0e27e..86d288797e5 100644 --- a/packages/x/xtensor/xmake.lua +++ b/packages/x/xtensor/xmake.lua @@ -16,22 +16,38 @@ package("xtensor") add_versions("0.23.10", "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c") add_configs("simd", {description = "Enable SIMD acceleration ", default = true, type = "boolean"}) + add_configs("tbb", {description = "Enable parallelization using intel TBB", default = false, type = "boolean"}) + add_configs("openmp", {description = "Enable parallelization using OpenMP", default = false, type = "boolean"}) add_deps("cmake") - on_load(function (package) - if package:version() and package:version():ge("0.26.0") then + on_load(function (package) + local version = package:version() + if version and version:ge("0.26.0") then package:add("deps", "xtl >=0.8.0") else package:add("deps", "xtl ^0.7.0") end if package:config("simd") then - package:add("deps", "xsimd ^11.0.0") + if version and version:ge("0.26.0") then + package:add("deps", "xsimd >=13.2.0") + else + package:add("deps", "xsimd ^11.0.0") + end + end + if package:config("tbb") then + package:add("deps", "tbb") + end + if package:config("openmp") then + package:add("deps", "openmp") end end) on_install("windows", "macosx", "linux", "mingw@windows", function (package) - local configs = {"-DXTENSOR_USE_XSIMD=" .. (package:config("simd") and "ON" or "OFF")} + local configs = {} + table.insert(configs, "-DXTENSOR_USE_XSIMD=" .. (package:config("simd") and "ON" or "OFF")) + table.insert(configs, "-DXTENSOR_USE_TBB=" .. (package:config("tbb") and "ON" or "OFF")) + table.insert(configs, "-DXTENSOR_USE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF")) import("package.tools.cmake").install(package, configs, {packagedeps = "xsimd"}) end) From cc0821731d707eee93dff254710638ef6056186b Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 15 Jul 2025 22:32:28 +0800 Subject: [PATCH 4/4] fix test --- packages/x/xtensor/xmake.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/x/xtensor/xmake.lua b/packages/x/xtensor/xmake.lua index 86d288797e5..f3bddca5a3f 100644 --- a/packages/x/xtensor/xmake.lua +++ b/packages/x/xtensor/xmake.lua @@ -24,13 +24,13 @@ package("xtensor") on_load(function (package) local version = package:version() if version and version:ge("0.26.0") then - package:add("deps", "xtl >=0.8.0") + package:add("deps", "xtl ^0.8.0") else package:add("deps", "xtl ^0.7.0") end if package:config("simd") then if version and version:ge("0.26.0") then - package:add("deps", "xsimd >=13.2.0") + package:add("deps", "xsimd ^13.2.0") else package:add("deps", "xsimd ^11.0.0") end @@ -52,11 +52,19 @@ package("xtensor") end) on_test(function (package) + local includes, languages + if package:version() and package:version():ge("0.26.0") then + languages = "c++17" + includes = {"xtensor/containers/xarray.hpp", "xtensor/views/xview.hpp"} + else + languages = "c++14" + includes = {"xtensor/xarray.hpp", "xtensor/xview.hpp"} + end assert(package:check_cxxsnippets({test = [[ void test() { xt::xarray arr1{{1.0,2.0,3.0},{2.0,5.0,7.0},{2.0,5.0,7.0}}; xt::xarray arr2{5.0,6.0,7.0}; xt::xarray res = xt::view(arr1, 1) + arr2; } - ]]}, {configs = {languages = "c++14"}, includes = {"xtensor/xarray.hpp", "xtensor/xview.hpp"}})) + ]]}, {configs = {languages = languages}, includes = includes})) end)