From d49fecf437fb5aed7bd8ae1943adc6235cf640f8 Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Sat, 30 Dec 2023 15:35:15 +0000 Subject: [PATCH] mlpack: add package (#3011) * mlpack: add package * mlpack: remove empty lines * mlpack: add license * mlpack: add limits * mlpack: add stb * mlpack: add limits for windows * mlpack: remove unneeded cxx flags * mlpack: fix license * mlpack: add openmp config * mlpack: add_options * mlpack: add openmp llvm for windows * mlpack: set option openmp to default true * mlpack: remove port and copy files --- packages/m/mlpack/xmake.lua | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/m/mlpack/xmake.lua diff --git a/packages/m/mlpack/xmake.lua b/packages/m/mlpack/xmake.lua new file mode 100644 index 00000000000..a693f9cdb7c --- /dev/null +++ b/packages/m/mlpack/xmake.lua @@ -0,0 +1,48 @@ +package("mlpack") + set_kind("library", {headeronly = true}) + set_homepage("https://www.mlpack.org/") + set_description("mlpack: a fast, header-only C++ machine learning library") + set_license("BSD-3-Clause") + + add_urls("https://github.com/mlpack/mlpack/archive/refs/tags/$(version).tar.gz", + "https://github.com/mlpack/mlpack.git") + + add_versions("4.3.0", "08cd54f711fde66fc3b6c9db89dc26776f9abf1a6256c77cfa3556e2a56f1a3d") + + if is_plat("linux") then + add_syslinks("m", "pthread") + end + + add_configs("openmp", {description = "Enable OpenMP", default = true, type = "boolean"}) + + add_deps("armadillo", "cereal", "ensmallen", "stb") + + on_load(function(package) + if package:config("openmp") then + if is_plat("windows") then + package:add("deps", "openmp", {configs = { feature = "llvm" }}) + else + package:add("deps", "openmp") + end + end + end) + + on_install("windows|x64", "windows|x86", "macosx", "linux", function (package) + os.cp("src/mlpack/methods", package:installdir("include/mlpack")) + os.cp("src/mlpack/core", package:installdir("include/mlpack")) + os.cp("src/mlpack/*.hpp", package:installdir("include/mlpack")) + os.cp("src/mlpack.hpp", package:installdir("include")) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + using namespace mlpack; + void test() { + arma::mat data; + arma::rowvec responses; + LinearRegression lr(data, responses); + arma::vec parameters = lr.Parameters(); + } + ]]}, {configs = {languages = "cxx17"}})) + end)