parent
51a1598458
commit
5137242adb
6 changed files with 105 additions and 1 deletions
@ -0,0 +1,20 @@ |
|||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index e5ab1f460..a23c6dbf5 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -145,12 +145,13 @@ if (${BLAZE_CACHE_SIZE_AUTO})
|
||||||
|
endif (flag EQUAL 0)
|
||||||
|
endif (APPLE)
|
||||||
|
|
||||||
|
- if (flag)
|
||||||
|
+ string(REGEX MATCH "([0-9][0-9]+)" tmp ${tmp}) # Get a number containing at least 2 digits in the string tmp
|
||||||
|
+
|
||||||
|
+ if (flag OR NOT tmp)
|
||||||
|
message("Cache size not found automatically. Using default value as cache size.")
|
||||||
|
set(tmp ${BLAZE_CACHE_SIZE_DEFAULT})
|
||||||
|
endif (flag)
|
||||||
|
|
||||||
|
- string(REGEX MATCH "([0-9][0-9]+)" tmp ${tmp}) # Get a number containing at least 2 digits in the string tmp
|
||||||
|
math(EXPR BLAZE_CACHE_SIZE ${tmp}*1024) # Convert to bytes (assuming that the value is given in kibibytes)
|
||||||
|
|
||||||
|
endif (${BLAZE_CACHE_SIZE_AUTO})
|
@ -0,0 +1,50 @@ |
|||||||
|
package("blaze") |
||||||
|
|
||||||
|
set_homepage("https://bitbucket.org/blaze-lib/blaze/") |
||||||
|
set_description("A high performance C++ math library.") |
||||||
|
set_license("BSD-3-Clause") |
||||||
|
|
||||||
|
add_urls("https://bitbucket.org/blaze-lib/blaze/downloads/blaze-$(version).tar.gz") |
||||||
|
add_versions("3.8", "dfaae1a3a9fea0b3cc92e78c9858dcc6c93301d59f67de5d388a3a41c8a629ae") |
||||||
|
|
||||||
|
add_patches("3.8", 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_deps("cmake") |
||||||
|
on_load("windows|x64", "linux", "macosx", function (package) |
||||||
|
if package:config("blas") == "mkl" then |
||||||
|
package:add("deps", "mkl") |
||||||
|
elseif package:config("blas") == "openblas" then |
||||||
|
package:add("deps", "openblas") |
||||||
|
end |
||||||
|
end) |
||||||
|
|
||||||
|
on_install("windows|x64", "linux", "macosx", function (package) |
||||||
|
io.replace("CMakeLists.txt", "BLAS REQUIRED", "BLAS", {plain = true}) |
||||||
|
local configs = {} |
||||||
|
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:config("blas") == "none" then |
||||||
|
table.insert(configs, "-DUSE_LAPACK=OFF") |
||||||
|
table.insert(configs, "-DBLAZE_BLAS_MODE=OFF") |
||||||
|
else |
||||||
|
table.insert(configs, "-DUSE_LAPACK=OFF") |
||||||
|
table.insert(configs, "-DBLAZE_BLAS_MODE=ON") |
||||||
|
end |
||||||
|
if package:config("blas") == "mkl" then |
||||||
|
table.insert(configs, "-DBLAZE_BLAS_INCLUDE_FILE=<mkl_cblas.h>") |
||||||
|
end |
||||||
|
import("package.tools.cmake").install(package, configs) |
||||||
|
end) |
||||||
|
|
||||||
|
on_test(function (package) |
||||||
|
assert(package:check_cxxsnippets({test = [[ |
||||||
|
void test() { |
||||||
|
blaze::StaticVector<int,3UL> a{ 4, -2, 5 }; |
||||||
|
blaze::DynamicVector<int> b( 3UL ); |
||||||
|
b[2] = -3; |
||||||
|
blaze::DynamicVector<int> c = a + b; |
||||||
|
} |
||||||
|
]]}, {configs = {languages = "c++14"}, includes = "blaze/Math.h"})) |
||||||
|
end) |
@ -0,0 +1,27 @@ |
|||||||
|
package("viennacl") |
||||||
|
|
||||||
|
set_homepage("http://viennacl.sourceforge.net/") |
||||||
|
set_description("ViennaCL is a free open-source linear algebra library for computations on many-core architectures (GPUs, MIC) and multi-core CPUs.") |
||||||
|
set_license("MIT") |
||||||
|
|
||||||
|
add_urls("https://sourceforge.net/projects/viennacl/files/$(version).zip", {version = function (version) |
||||||
|
return format("%s.%s.x/ViennaCL-%s", version:major(), version:minor(), version) |
||||||
|
end}) |
||||||
|
add_versions("1.7.1", "1e9ffaa9d1dd22202cbd10ec8a8450184bceb41bbd90ebe2effd50be2015a7f6") |
||||||
|
|
||||||
|
add_deps("cmake") |
||||||
|
on_install("windows", "macosx", "linux", function (package) |
||||||
|
io.replace("CMakeLists.txt", "add_subdirectory", "#", {plain = true}) |
||||||
|
import("package.tools.cmake").install(package) |
||||||
|
end) |
||||||
|
|
||||||
|
on_test(function (package) |
||||||
|
assert(package:check_cxxsnippets({test = [[ |
||||||
|
void test() { |
||||||
|
viennacl::vector<float> vec1(4); |
||||||
|
viennacl::vector<float> vec2(4); |
||||||
|
float res = viennacl::linalg::inner_prod(vec1, vec2); |
||||||
|
} |
||||||
|
]]}, {configs = {languages = "c++11"}, |
||||||
|
includes = {"viennacl/vector.hpp", "viennacl/linalg/inner_prod.hpp"}})) |
||||||
|
end) |
Loading…
Reference in new issue