Browse Source

add emsmallen (#697)

* add emsmallen

* update armadillo

* update hypre

* add libdc1394
Hoildkv 3 years ago
parent
commit
8e37d66eb6

+ 2 - 3
packages/a/armadillo/xmake.lua

@@ -1,16 +1,15 @@
 package("armadillo")
 
+    set_kind("library", {headeronly = true})
     set_homepage("http://arma.sourceforge.net/")
     set_description("C++ library for linear algebra & scientific computing")
     set_license("Apache-2.0")
 
     add_urls("http://sourceforge.net/projects/arma/files/armadillo-$(version).tar.xz")
     add_versions("10.7.0", "9bf60db6fd237721908747a0e56797b97b7ceae3603f2cca0b012a3b88265d3f")
+    add_versions("10.7.3", "aac930d5fbc23dca9453ff3647d03f7d90d9584a4556719ad7bc7adab7db6ff5")
 
     add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
-    if is_plat("windows") then
-        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
-    end
 
     on_load("windows", "macosx", "linux", function (package)
         package:add("deps", "superlu", {configs = {blas = package:config("blas")}})

+ 24 - 0
packages/e/ensmallen/xmake.lua

@@ -0,0 +1,24 @@
+package("ensmallen")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://ensmallen.org/")
+    set_description("flexible C++ library for efficient numerical optimization")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://ensmallen.org/files/ensmallen-$(version).tar.gz")
+    add_versions("2.18.0", "62f7db71105305c0754a5f2a02fb8d05a5294bafa82584172b50609aabf7ea44")
+
+    add_deps("cmake", "armadillo")
+    on_install("windows", "macosx", "linux", function (package)
+        io.replace("CMakeLists.txt", "add_subdirectory(tests)", "", {plain = true})
+        import("package.tools.cmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                ens::L_BFGS opt;
+                opt.MaxIterations() = 10;
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "ensmallen.hpp"}))
+    end)

+ 12 - 2
packages/h/hypre/xmake.lua

@@ -7,12 +7,22 @@ package("hypre")
     add_urls("https://github.com/hypre-space/hypre/archive/refs/tags/$(version).tar.gz",
              "https://github.com/hypre-space/hypre.git")
     add_versions("v2.20.0", "5be77b28ddf945c92cde4b52a272d16fb5e9a7dc05e714fc5765948cba802c01")
+    add_versions("v2.23.0", "8a9f9fb6f65531b77e4c319bf35bfc9d34bf529c36afe08837f56b635ac052e2")
+
+    add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
 
     add_deps("cmake")
+    on_load("windows", "macosx", "linux", function (package)
+        package:add("deps", package:config("blas"))
+    end)
+
     on_install("windows", "linux", "macosx", function (package)
         os.cd("src")
-        local configs = {"-DHYPRE_WITH_MPI=OFF"}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        local configs = {"-DHYPRE_WITH_MPI=OFF", "-DHYPRE_BUILD_EXAMPLES=OFF", "-DHYPRE_BUILD_TESTS=OFF", "-DHYPRE_USING_HYPRE_BLAS=OFF", "-DHYPRE_USING_HYPRE_LAPACK=OFF"}
+        table.insert(configs, "-DHYPRE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DHYPRE_ENABLE_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
     end)

+ 46 - 0
packages/l/libdc1394/xmake.lua

@@ -0,0 +1,46 @@
+package("libdc1394")
+
+    set_homepage("https://sourceforge.net/projects/libdc1394/")
+    set_description("IIDC Camera Control Library")
+    set_license("LGPL-2.1")
+
+    add_urls("https://sourceforge.net/projects/libdc1394/files/libdc1394-2/$(version)/libdc1394-$(version).tar.gz")
+    add_versions("2.2.6", "2b905fc9aa4eec6bdcf6a2ae5f5ba021232739f5be047dec8fe8dd6049c10fed")
+
+    if is_plat("linux") then
+        add_extsources("apt::libdc1394-22-dev")
+    end
+
+    add_deps("libusb")
+    if is_plat("macosx") then
+        add_frameworks("CoreFoundation", "CoreServices", "IOKit")
+    end
+    on_install("macosx", "linux", function (package)
+        local configs = {"--disable-dependency-tracking"}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+        if package:config("pic") then
+            table.insert(configs, "--with-pic")
+        end
+        local cppflags = {}
+        local ldflags = {}
+        for _, dep in ipairs(package:orderdeps()) do
+            local fetchinfo = dep:fetch()
+            if fetchinfo then
+                for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
+                    table.insert(cppflags, "-I" .. includedir)
+                end
+                for _, linkdir in ipairs(fetchinfo.linkdirs) do
+                    table.insert(ldflags, "-L" .. linkdir)
+                end
+                for _, link in ipairs(fetchinfo.links) do
+                    table.insert(ldflags, "-l" .. link)
+                end
+            end
+        end
+        import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("dc1394_new", {includes = "dc1394/dc1394.h"}))
+    end)