add armadillo (#650)

pull/651/head
Hoildkv 4 years ago committed by GitHub
parent dc73a574b5
commit 8b7ec197ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 52
      packages/a/armadillo/xmake.lua
  2. 7
      packages/s/superlu/xmake.lua

@ -0,0 +1,52 @@
package("armadillo")
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_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")}})
end)
on_install("windows", "macosx", "linux", function (package)
os.cd("include")
io.gsub("armadillo_bits/config.hpp.cmake", "${.-}/?", "")
io.gsub("armadillo_bits/config.hpp.cmake", "#cmakedefine (.-)\n", "${define %1}\n")
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
target("armadillo")
set_kind("phony")
set_configvar("ARMA_USE_LAPACK", 1)
set_configvar("ARMA_USE_BLAS", 1)
set_configvar("ARMA_USE_SUPERLU", 1)
set_configdir(".")
add_configfiles("(armadillo_bits/config.hpp.cmake)", {filename = "config.hpp"})
on_install(function (target)
os.cp("armadillo", path.join(target:installdir(), "include", "armadillo"))
os.mkdir(path.join(target:installdir(), "include", "armadillo_bits"))
os.cp("armadillo_bits/*.hpp", path.join(target:installdir(), "include", "armadillo_bits"))
end)
]])
import("package.tools.xmake").install(package)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
using mat = arma::Mat<double>;
mat A(5, 5, arma::fill::randu);
double x = A(1,2);
mat B = A + A;
mat C = A * B;
mat D = A % B;
}
]]}, {configs = {languages = "c++14"}, includes = "armadillo"}))
end)

@ -7,11 +7,12 @@ package("superlu")
add_urls("https://github.com/xiaoyeli/superlu/archive/refs/tags/$(version).tar.gz",
"https://github.com/xiaoyeli/superlu.git")
add_versions("v5.2.2", "470334a72ba637578e34057f46948495e601a5988a602604f5576367e606a28c")
add_versions("v5.3.0", "3e464afa77335de200aeb739074a11e96d9bef6d0b519950cfa6684c4be1f350")
add_configs("blas_vendor", {description = "Set BLAS vendor.", default = "mkl", type = "string", values = {"mkl", "openblas"}})
add_configs("blas", {description = "Choose BLAS library to use.", default = "mkl", type = "string", values = {"mkl", "openblas"}})
on_load("windows", "linux", "macosx", function (package)
package:add("deps", package:config("blas_vendor"))
package:add("deps", package:config("blas"))
end)
on_install("windows", "linux", "macosx", function (package)
@ -29,7 +30,7 @@ package("superlu")
add_includedirs(".")
add_headerfiles("*.h")
add_packages("%s")
]], package:config("blas_vendor"), package:config("blas_vendor")))
]], package:config("blas"), package:config("blas")))
local configs = {kind = package:config("shared") and "shared" or "static"}
import("package.tools.xmake").install(package, configs)
end)

Loading…
Cancel
Save