-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lightgbm] Add open-source library lightgbm to vcpkg #39395
Merged
BillyONeal
merged 16 commits into
microsoft:master
from
dsmith111:smithdavi/newport-lightgbm
Jun 21, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4d1b018
Add LightGBM Port
dsmith111 d96fd57
Version database
dsmith111 c23bb0b
Handle deprecated function.
dsmith111 ce175cb
Handle static compilation
dsmith111 b9cb2f1
List no support for android, uwp or osx
dsmith111 7675f70
Update version database
dsmith111 02af35a
Condense description; remove cmake config dependency
dsmith111 f2fff0c
Update git-tree version
dsmith111 e22f9b8
remove .hpp addition
dsmith111 cab5581
update git tree
dsmith111 004391f
Devendor fast double parser
dsmith111 5af2d43
Version database
dsmith111 6201898
CI
dsmith111 6871af2
Merge branch 'master' of https://github.com/microsoft/vcpkg into smit…
dsmith111 9157ca2
Remove redundand patch
dsmith111 0221611
Version database
dsmith111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
} | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the split review :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this change? Why would we want to remove the minimum version the original CMakeLists was asking for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we don't want version constraints in the build system, since we consider version under the control of the ultimate downstream customer. But given that build passed it's not worth resetting over this.