forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lightgbm] Add open-source library lightgbm to vcpkg (microsoft#39395)
- Loading branch information
Showing
5 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO microsoft/LightGBM | ||
REF v${VERSION} | ||
SHA512 295ea23ec55164232f1dde6aa46bcfa616e2fe4852eb2e3492e681477a8d7757875d60379c4d463a35a6a9db56b1f4bce86b3a03bed56ea3d36aadb94a3b38eb | ||
PATCHES | ||
vcpkg_lightgbm_use_vcpkg_libs.patch | ||
) | ||
|
||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
FEATURES | ||
gpu USE_GPU | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") | ||
set(BUILD_STATIC_LIB "OFF") | ||
else() | ||
set(BUILD_STATIC_LIB "ON") | ||
endif() | ||
|
||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
OPTIONS | ||
-DBUILD_STATIC_LIB=${BUILD_STATIC_LIB} | ||
${FEATURE_OPTIONS} | ||
) | ||
|
||
vcpkg_cmake_install() | ||
|
||
vcpkg_copy_tools(TOOL_NAMES lightgbm AUTO_CLEAN) | ||
|
||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "lightgbm", | ||
"version": "4.4.0", | ||
"description": [ | ||
"A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms.", | ||
"Designed to be distributed and efficient and comes with faster training speeds, higher efficiency, lower memory usage and support of parallel, distributed, and GPU learning." | ||
], | ||
"homepage": "https://github.com/microsoft/LightGBM", | ||
"license": "Apache-2.0", | ||
"supports": "!android & !osx & !uwp", | ||
"dependencies": [ | ||
"eigen3", | ||
"fast-double-parser", | ||
"fmt", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
], | ||
"features": { | ||
"gpu": { | ||
"description": "GPU support using Boost.Compute", | ||
"dependencies": [ | ||
"boost-compute", | ||
"opencl" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 3492289b..6284b6e0 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -115,18 +115,17 @@ if(USE_SWIG) | ||
endif() | ||
endif() | ||
|
||
-set(EIGEN_DIR "${PROJECT_SOURCE_DIR}/external_libs/eigen") | ||
-include_directories(${EIGEN_DIR}) | ||
+find_package(Eigen3 CONFIG REQUIRED) | ||
|
||
# See https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README | ||
add_definitions(-DEIGEN_MPL2_ONLY) | ||
add_definitions(-DEIGEN_DONT_PARALLELIZE) | ||
|
||
-set(FAST_DOUBLE_PARSER_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external_libs/fast_double_parser/include") | ||
-include_directories(${FAST_DOUBLE_PARSER_INCLUDE_DIR}) | ||
+find_package(fmt CONFIG REQUIRED) | ||
+get_target_property(VCPKG_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES) | ||
+set(FMT_INCLUDE_DIR ${VCPKG_INCLUDE_DIR}/fmt) | ||
|
||
-set(FMT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external_libs/fmt/include") | ||
-include_directories(${FMT_INCLUDE_DIR}) | ||
+find_path(FAST_DOUBLE_PARSER_INCLUDE_DIR fast_double_parser.h) | ||
|
||
if(__BUILD_FOR_R) | ||
find_package(LibR REQUIRED) | ||
@@ -181,15 +180,13 @@ if(USE_OPENMP) | ||
endif() | ||
|
||
if(USE_GPU) | ||
- set(BOOST_COMPUTE_HEADER_DIR ${PROJECT_SOURCE_DIR}/external_libs/compute/include) | ||
- include_directories(${BOOST_COMPUTE_HEADER_DIR}) | ||
find_package(OpenCL REQUIRED) | ||
include_directories(${OpenCL_INCLUDE_DIRS}) | ||
message(STATUS "OpenCL include directory: " ${OpenCL_INCLUDE_DIRS}) | ||
if(WIN32) | ||
set(Boost_USE_STATIC_LIBS ON) | ||
endif() | ||
- find_package(Boost 1.56.0 COMPONENTS filesystem system REQUIRED) | ||
+ find_package(Boost 1.56.0 COMPONENTS filesystem system compute REQUIRED) | ||
if(WIN32) | ||
# disable autolinking in boost | ||
add_definitions(-DBOOST_ALL_NO_LIB) | ||
@@ -458,9 +455,11 @@ endif() | ||
|
||
add_library(lightgbm_objs OBJECT ${SOURCES}) | ||
|
||
+target_link_libraries(lightgbm_objs PUBLIC Eigen3::Eigen fmt::fmt) | ||
+ | ||
if(BUILD_CLI) | ||
add_executable(lightgbm src/main.cpp src/application/application.cpp) | ||
- target_link_libraries(lightgbm PRIVATE lightgbm_objs) | ||
+ target_link_libraries(lightgbm PRIVATE lightgbm_objs Eigen3::Eigen fmt::fmt) | ||
endif() | ||
|
||
set(API_SOURCES "src/c_api.cpp") | ||
@@ -471,6 +470,7 @@ if(__BUILD_FOR_R) | ||
endif() | ||
|
||
add_library(lightgbm_capi_objs OBJECT ${API_SOURCES}) | ||
+target_link_libraries(lightgbm_capi_objs PUBLIC Eigen3::Eigen fmt::fmt) | ||
|
||
if(BUILD_STATIC_LIB) | ||
add_library(_lightgbm STATIC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"versions": [ | ||
{ | ||
"git-tree": "e8a4ff8e712c8794cc650c722dfd9d65581c68bb", | ||
"version": "4.4.0", | ||
"port-version": 0 | ||
} | ||
] | ||
} |