Browse Source

add fastor (#1499)

* update blaze

* add fastor

* improve versioning

* default to openblas

* require c++14

* restrict platforms

* enable 3.8.1

* improve glad
Hoildkv 2 years ago
parent
commit
d31d100c78
3 changed files with 34 additions and 4 deletions
  1. 3 2
      packages/b/blaze/xmake.lua
  2. 27 0
      packages/f/fastor/xmake.lua
  3. 4 2
      packages/g/glad/xmake.lua

+ 3 - 2
packages/b/blaze/xmake.lua

@@ -6,10 +6,11 @@ package("blaze")
 
     add_urls("https://bitbucket.org/blaze-lib/blaze/downloads/blaze-$(version).tar.gz")
     add_versions("3.8", "dfaae1a3a9fea0b3cc92e78c9858dcc6c93301d59f67de5d388a3a41c8a629ae")
+    add_versions("3.8.1", "a084c6d1acc75e742a1cdcddf93d0cda0d9e3cc4014c246d997a064fa2196d39")
 
-    add_patches("3.8", path.join(os.scriptdir(), "patches", "3.8", "fix-vm-build.patch"), "d6e98c62279ab4b6a93b297e63312b974551e3fcfcd51f613bfebd05e7421cf1")
+    add_patches("3.8.0", path.join(os.scriptdir(), "patches", "3.8", "fix-vm-build.patch"), "d6e98c62279ab4b6a93b297e63312b974551e3fcfcd51f613bfebd05e7421cf1")
 
-    add_configs("blas", {description = "Choose BLAS library to use.", default = "mkl", type = "string", values = {"none", "mkl", "openblas"}})
+    add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"none", "mkl", "openblas"}})
 
     add_deps("cmake")
     on_load("windows|x64", "linux", "macosx", function (package)

+ 27 - 0
packages/f/fastor/xmake.lua

@@ -0,0 +1,27 @@
+package("fastor")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/romeric/Fastor")
+    set_description("A lightweight high performance tensor algebra framework for modern C++")
+    set_license("MIT")
+
+    add_urls("https://github.com/romeric/Fastor/archive/refs/tags/V$(version).tar.gz",
+             "https://github.com/romeric/Fastor.git")
+    add_versions("0.6.3", "6ee13c75bed1221d0cdc0985d996bb79ae09b6d7e05798f1bb84458c2bdb238b")
+
+    on_install("windows", "macosx", "linux", "mingw", function (package)
+        os.cp("Fastor", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            enum {I,J,K,L,M,N};
+            void test() {
+                Fastor::Tensor<double,2,3,5> A;
+                Fastor::Tensor<double,3,5,2,4> B;
+                A.random();
+                B.random();
+                auto C = Fastor::einsum<Fastor::Index<I,J,K>,Fastor::Index<J,L,M,N>>(A,B);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "Fastor/Fastor.h"}))
+    end)

+ 4 - 2
packages/g/glad/xmake.lua

@@ -12,14 +12,16 @@ package("glad")
     if is_plat("linux") then
         add_syslinks("dl")
     end
-    on_load("windows", "linux", "macosx", function (package)
+    on_load("windows", "linux", "macosx", "mingw", function (package)
         if not package.is_built or package:is_built() then
             package:add("deps", "cmake", "python 3.x", {kind = "binary"})
         end
     end)
 
-    on_install("windows", "linux", "macosx", function (package)
+    on_install("windows", "linux", "macosx", "mingw", function (package)
         local configs = {"-DGLAD_INSTALL=ON", "-DGLAD_REPRODUCIBLE=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         if package:is_plat("windows") then
             table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
         end