Browse Source

add hwloc, xtl, xsimd and xtensor (#535)

* add hwloc

* add xtl

* add xsimd

* add xtensor
Hoildkv 4 years ago
parent
commit
03ea2ff8ec
4 changed files with 122 additions and 0 deletions
  1. 40 0
      packages/h/hwloc/xmake.lua
  2. 32 0
      packages/x/xsimd/xmake.lua
  3. 25 0
      packages/x/xtensor/xmake.lua
  4. 25 0
      packages/x/xtl/xmake.lua

+ 40 - 0
packages/h/hwloc/xmake.lua

@@ -0,0 +1,40 @@
+package("hwloc")
+
+    set_homepage("https://www.open-mpi.org/software/hwloc/")
+    set_description("Portable Hardware Locality (hwloc)")
+    set_license("BSD-3-Clause")
+
+    if is_plat("windows") then
+        if is_arch("x86") then
+            add_urls("https://download.open-mpi.org/release/hwloc/v$(version).zip", {version = function (version)
+                return format("%d.%d/hwloc-win32-build-%s", version:major(), version:minor(), version)
+            end})
+            add_versions("2.5.0", "0ff33ef99b727a96fcca8fd510e41f73444c5e9ea2b6c475a64a2d9a294f2973")
+        elseif is_arch("x64") then
+            add_urls("https://download.open-mpi.org/release/hwloc/v$(version).zip", {version = function (version)
+                return format("%d.%d/hwloc-win64-build-%s", version:major(), version:minor(), version)
+            end})
+            add_versions("2.5.0", "b64f5ebe534d1ad57cdd4b18ab4035389b68802a97464c1295005043075309ea")
+        end
+    else
+        add_urls("https://download.open-mpi.org/release/hwloc/v$(version).tar.gz", {version = function (version)
+            return format("%d.%d/hwloc-%s", version:major(), version:minor(), version)
+        end})
+        add_versions("2.5.0", "38aa8102faec302791f6b4f0d23960a3ffa25af3af6af006c64dbecac23f852c")
+    end
+
+    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
+
+    on_install("windows", function (package)
+        os.cp("bin", package:installdir())
+        os.cp("include", package:installdir())
+        os.cp("lib/*|*.a", package:installdir("lib"))
+    end)
+
+    on_install("macosx", "linux", function (package)
+        import("package.tools.autoconf").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("hwloc_get_api_version", {includes = "hwloc.h"}))
+    end)

+ 32 - 0
packages/x/xsimd/xmake.lua

@@ -0,0 +1,32 @@
+package("xsimd")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/xtensor-stack/xsimd/")
+    set_description("C++ wrappers for SIMD intrinsics")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/xtensor-stack/xsimd/archive/refs/tags/$(version).tar.gz")
+    add_versions("7.6.0", "eaf47f1a316ef6c3287b266161eeafc5aa61226ce5ac6c13502546435b790252")
+
+    if is_plat("windows") then
+        add_cxxflags("/arch:AVX")
+    else
+        add_cxxflags("-march=native")
+    end
+
+    add_deps("cmake")
+    on_install("windows", "macosx", "linux", "mingw@windows", function (package)
+        import("package.tools.cmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <iostream>
+            void test() {
+                xsimd::batch<double, 4> a(1.5, 2.5, 3.5, 4.5);
+                xsimd::batch<double, 4> b(2.5, 3.5, 4.5, 5.5);
+                auto mean = (a + b) / 2;
+                std::cout << mean << std::endl;
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "xsimd/xsimd.hpp"}))
+    end)

+ 25 - 0
packages/x/xtensor/xmake.lua

@@ -0,0 +1,25 @@
+package("xtensor")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/xtensor-stack/xtensor/")
+    set_description("Multi-dimensional arrays with broadcasting and lazy computing")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/xtensor-stack/xtensor/archive/refs/tags/$(version).tar.gz")
+    add_versions("0.23.10", "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c")
+
+    add_deps("cmake")
+    add_deps("xtl", "xsimd")
+    on_install("windows", "macosx", "linux", "mingw@windows", function (package)
+        import("package.tools.cmake").install(package, {"-DXTENSOR_USE_XSIMD=ON"})
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                xt::xarray<double> arr1{{1.0,2.0,3.0},{2.0,5.0,7.0},{2.0,5.0,7.0}};
+                xt::xarray<double> arr2{5.0,6.0,7.0};
+                xt::xarray<double> res = xt::view(arr1, 1) + arr2;
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = {"xtensor/xarray.hpp", "xtensor/xview.hpp"}}))
+    end)

+ 25 - 0
packages/x/xtl/xmake.lua

@@ -0,0 +1,25 @@
+package("xtl")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/xtensor-stack/xtl/")
+    set_description("Basic tools (containers, algorithms) used by other quantstack packages")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/xtensor-stack/xtl/archive/refs/tags/$(version).tar.gz")
+    add_versions("0.7.2", "95c221bdc6eaba592878090916383e5b9390a076828552256693d5d97f78357c")
+
+    add_deps("cmake")
+    add_deps("nlohmann_json")
+    on_install("windows", "macosx", "linux", "mingw@windows", function (package)
+        import("package.tools.cmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                xtl::xcomplex<double> c0;
+                xtl::xcomplex<double> c1(1.);
+                xtl::xcomplex<double> c2(1., 2.);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "xtl/xcomplex.hpp"}))
+    end)