From 30e420c5b55c4d4318adb17e5a3528057d64cb71 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Thu, 12 Nov 2020 12:45:15 +0800 Subject: [PATCH] add package leveldb and gmm (#128) * add package leveldb * add package gmm --- packages/e/eigen/xmake.lua | 5 ++++- packages/g/gmm/xmake.lua | 28 ++++++++++++++++++++++++++++ packages/l/leveldb/xmake.lua | 31 +++++++++++++++++++++++++++++++ packages/o/openblas/xmake.lua | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 packages/g/gmm/xmake.lua create mode 100644 packages/l/leveldb/xmake.lua diff --git a/packages/e/eigen/xmake.lua b/packages/e/eigen/xmake.lua index 6fc04f35a..f5cebcff0 100644 --- a/packages/e/eigen/xmake.lua +++ b/packages/e/eigen/xmake.lua @@ -12,7 +12,10 @@ package("eigen") add_includedirs("include/eigen3") on_install("macosx", "linux", "windows", function (package) - import("package.tools.cmake").install(package) + local configs = {"-DBUILD_TESTING=OFF"} + 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")) + import("package.tools.cmake").install(package, configs) end) on_test(function (package) diff --git a/packages/g/gmm/xmake.lua b/packages/g/gmm/xmake.lua new file mode 100644 index 000000000..8618197ab --- /dev/null +++ b/packages/g/gmm/xmake.lua @@ -0,0 +1,28 @@ +package("gmm") + + set_homepage("http://getfem.org/gmm/index.html") + set_description("Gmm++ provides some basic types of sparse and dense matrices and vectors.") + + add_urls("http://download-mirror.savannah.gnu.org/releases/getfem/stable/gmm-$(version).tar.gz") + add_versions("5.4", "7163d5080efbe6893d1950e4b331cd3e9160bb3dcf583d206920fba6af7b1e56") + + on_install("macosx", "linux", "windows", "mingw", function (package) + if package:is_plat("windows") then + package:add("defines", "_SCL_SECURE_NO_DEPRECATE") + end + os.cp("include/gmm", package:installdir("include")) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + gmm::dense_matrix M(3, 3), M2(3, 3), M3(3, 3); + gmm::copy(gmm::identity_matrix(), M); + gmm::scale(M, 2.0); + M(1, 2) = 1.0; + gmm::copy(M, M2); + gmm::lu_inverse(M); + gmm::mult(M, M2, M3); + } + ]]}, {configs = {languages = "c++11"}, includes = "gmm/gmm_kernel.h"})) + end) diff --git a/packages/l/leveldb/xmake.lua b/packages/l/leveldb/xmake.lua new file mode 100644 index 000000000..c724df81d --- /dev/null +++ b/packages/l/leveldb/xmake.lua @@ -0,0 +1,31 @@ +package("leveldb") + + set_homepage("https://github.com/google/leveldb") + set_description("LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.") + + add_urls("https://github.com/google/leveldb/archive/$(version).tar.gz", + "https://github.com/google/leveldb.git") + add_versions("1.22", "55423cac9e3306f4a9502c738a001e4a339d1a38ffbee7572d4a07d5d63949b2") + + add_deps("cmake") + if is_plat("linux") then + add_syslinks("pthread") + end + + on_install("macosx", "linux", "windows", "mingw", function (package) + local configs = {"-DLEVELDB_BUILD_TESTS=OFF", "-DLEVELDB_BUILD_BENCHMARKS=OFF"} + 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")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + leveldb::DB* db; + leveldb::Options options; + options.create_if_missing = true; + leveldb::Status status = leveldb::DB::Open(options, "./test", &db); + } + ]]}, {configs = {languages = "c++11"}, includes = "leveldb/db.h"})) + end) diff --git a/packages/o/openblas/xmake.lua b/packages/o/openblas/xmake.lua index bbbd00914..3c24f6ea1 100644 --- a/packages/o/openblas/xmake.lua +++ b/packages/o/openblas/xmake.lua @@ -71,4 +71,4 @@ package("openblas") cblas_dgemm(CblasColMajor,CblasNoTrans,CblasTrans,3,3,2,1,A,3,B,3,2,C,3); } ]]}, {includes = "cblas.h"})) - end) \ No newline at end of file + end)