xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("blaze")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://bitbucket.org/blaze-lib/blaze/")
  4. set_description("A high performance C++ math library.")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://bitbucket.org/blaze-lib/blaze/downloads/blaze-$(version).tar.gz")
  7. add_versions("3.8", "dfaae1a3a9fea0b3cc92e78c9858dcc6c93301d59f67de5d388a3a41c8a629ae")
  8. add_versions("3.8.1", "a084c6d1acc75e742a1cdcddf93d0cda0d9e3cc4014c246d997a064fa2196d39")
  9. add_patches("3.8.0", path.join(os.scriptdir(), "patches", "3.8", "fix-vm-build.patch"), "d6e98c62279ab4b6a93b297e63312b974551e3fcfcd51f613bfebd05e7421cf1")
  10. add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"none", "mkl", "openblas"}})
  11. add_deps("cmake")
  12. on_load("windows|x64", "linux", "macosx", function (package)
  13. if package:config("blas") == "mkl" then
  14. package:add("deps", "mkl")
  15. elseif package:config("blas") == "openblas" then
  16. package:add("deps", "openblas")
  17. end
  18. end)
  19. on_install("windows|x64", "linux", "macosx", function (package)
  20. io.replace("CMakeLists.txt", "BLAS REQUIRED", "BLAS", {plain = true})
  21. local configs = {}
  22. if package:config("blas") == "none" then
  23. table.insert(configs, "-DUSE_LAPACK=OFF")
  24. table.insert(configs, "-DBLAZE_BLAS_MODE=OFF")
  25. else
  26. table.insert(configs, "-DUSE_LAPACK=OFF")
  27. table.insert(configs, "-DBLAZE_BLAS_MODE=ON")
  28. end
  29. if package:config("blas") == "mkl" then
  30. table.insert(configs, "-DBLAZE_BLAS_INCLUDE_FILE=<mkl_cblas.h>")
  31. end
  32. import("package.tools.cmake").install(package, configs)
  33. end)
  34. on_test(function (package)
  35. assert(package:check_cxxsnippets({test = [[
  36. void test() {
  37. blaze::StaticVector<int,3UL> a{ 4, -2, 5 };
  38. blaze::DynamicVector<int> b( 3UL );
  39. b[2] = -3;
  40. blaze::DynamicVector<int> c = a + b;
  41. }
  42. ]]}, {configs = {languages = "c++14"}, includes = "blaze/Math.h"}))
  43. end)