xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("lightgbm")
  2. set_homepage("https://github.com/microsoft/LightGBM")
  3. set_description("LightGBM is a gradient boosting framework that uses tree based learning algorithms.")
  4. set_license("MIT")
  5. add_urls("https://github.com/microsoft/LightGBM/releases/download/v$(version)/lightgbm-$(version).tar.gz")
  6. add_versions("3.2.1", "bd98e3b501b4c24dc127f4ad93e467f42923fe3eefa99e143b5b93158f024395")
  7. add_configs("gpu", {description = "Enable GPU-accelerated training.", default = false, type = "boolean"})
  8. add_deps("cmake")
  9. on_load("windows|x64", "linux", function (package)
  10. if package:config("gpu") then
  11. package:add("deps", "opencl")
  12. package:add("deps", "boost", {configs = {filesystem = true, system = true}})
  13. end
  14. end)
  15. on_install("windows|x64", "linux", function (package)
  16. os.cd("compile")
  17. local configs = {"-DBoost_USE_STATIC_LIBS=ON"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
  20. if package:is_plat("windows") then
  21. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  22. end
  23. import("package.tools.cmake").install(package, configs)
  24. package:addenv("PATH", "bin")
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cxxtypes("LightGBM::ChunkedArray<int>", {includes = "LightGBM/utils/chunked_array.hpp"}))
  28. end)