Procházet zdrojové kódy

add lightgbm and fast_double_parser (#549)

* add lightgbm

* add fast_double_parser
Hoildkv před 4 roky
rodič
revize
66f89e829d

+ 24 - 0
packages/f/fast_double_parser/xmake.lua

@@ -0,0 +1,24 @@
+package("fast_double_parser")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/lemire/fast_double_parser")
+    set_description("Fast function to parse strings containing decimal numbers into double-precision (binary64) floating-point values.")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/lemire/fast_double_parser/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/lemire/fast_double_parser.git")
+    add_versions("v0.5.0", "afbd2d42facd037bf3859856a8fe4112e4d7ded942255f6c0e6c17689d41f645")
+
+    on_install("windows|x64", "macosx", "linux", "mingw", "android", function (package)
+        os.cp("include", package:installdir())
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                double x;
+                char str[] = "0.11";
+                const char *endptr = fast_double_parser::parse_number(str, &x);
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "fast_double_parser.h"}))
+    end)

+ 34 - 0
packages/l/lightgbm/xmake.lua

@@ -0,0 +1,34 @@
+package("lightgbm")
+
+    set_homepage("https://github.com/microsoft/LightGBM")
+    set_description("LightGBM is a gradient boosting framework that uses tree based learning algorithms.")
+    set_license("MIT")
+
+    add_urls("https://github.com/microsoft/LightGBM/releases/download/v$(version)/lightgbm-$(version).tar.gz")
+    add_versions("3.2.1", "bd98e3b501b4c24dc127f4ad93e467f42923fe3eefa99e143b5b93158f024395")
+
+    add_configs("gpu", {description = "Enable GPU-accelerated training.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    on_load("windows|x64", "linux", function (package)
+        if package:config("gpu") then
+            package:add("deps", "opencl")
+            package:add("deps", "boost", {configs = {filesystem = true, system = true}})
+        end
+    end)
+
+    on_install("windows|x64", "linux", function (package)
+        os.cd("compile")
+        local configs = {"-DBoost_USE_STATIC_LIBS=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
+        import("package.tools.cmake").install(package, configs)
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("LightGBM::ChunkedArray<int>", {includes = "LightGBM/utils/chunked_array.hpp"}))
+    end)