From 9f823d0186538b847cf47df28728a17aec5392e2 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 17 Jun 2024 02:21:08 +0800 Subject: [PATCH] LightGBM: update to 4.4.0 --- math/LightGBM/Portfile | 14 +-- .../files/0001-Fix-CMakeLists.txt.patch | 116 +++++++++++++++++- .../files/0002-common.h-fix-includes.patch | 33 ----- 3 files changed, 120 insertions(+), 43 deletions(-) delete mode 100644 math/LightGBM/files/0002-common.h-fix-includes.patch diff --git a/math/LightGBM/Portfile b/math/LightGBM/Portfile index 02cbdd518dd8b..11a1cfcf726b7 100644 --- a/math/LightGBM/Portfile +++ b/math/LightGBM/Portfile @@ -5,7 +5,7 @@ PortGroup cmake 1.1 PortGroup compiler_blacklist_versions 1.0 PortGroup github 1.0 -github.setup microsoft LightGBM 4.3.0 v +github.setup microsoft LightGBM 4.4.0 v revision 0 categories math license MIT @@ -16,13 +16,12 @@ long_description {*}${description}, based on decision tree algorithms, \ used for ranking, classification and many other \ machine learning tasks. homepage https://lightgbm.readthedocs.io -checksums rmd160 6e713e9b99a624d35ea063219afcf2c638af1a0a \ - sha256 9e5a88bc231addfe4a0e57aa5ceb157f045103cd69ad8c2f393ef941ef52a9ac \ - size 7070807 +checksums rmd160 9ef56d2fc66be5a85fbac7805290dbd3d23e5d7c \ + sha256 2633afd64f4f28c5563cb64e96adf8aa6fae58af11b13345166392fb05e56215 \ + size 7088819 github.tarball_from archive -patchfiles-append 0001-Fix-CMakeLists.txt.patch \ - 0002-common.h-fix-includes.patch +patchfiles-append 0001-Fix-CMakeLists.txt.patch set libfmt_ver 10 @@ -49,7 +48,8 @@ configure.args-append \ -DUSE_HDFS=OFF \ -DUSE_MPI=OFF \ -DUSE_OPENMP=ON \ - -DUSE_SANITIZER=OFF + -DUSE_SANITIZER=OFF \ + -DUSE_SWIG=OFF platform darwin { configure.args-append \ diff --git a/math/LightGBM/files/0001-Fix-CMakeLists.txt.patch b/math/LightGBM/files/0001-Fix-CMakeLists.txt.patch index a6c596dabdaae..49888c4c772d1 100644 --- a/math/LightGBM/files/0001-Fix-CMakeLists.txt.patch +++ b/math/LightGBM/files/0001-Fix-CMakeLists.txt.patch @@ -11,7 +11,7 @@ diff --git CMakeLists.txt CMakeLists.txt index 1ff289b9..43f6bcea 100644 --- CMakeLists.txt +++ CMakeLists.txt -@@ -31,11 +31,7 @@ cmake_minimum_required(VERSION 3.18) +@@ -35,11 +35,7 @@ project(lightgbm LANGUAGES C CXX) @@ -24,7 +24,7 @@ index 1ff289b9..43f6bcea 100644 set(CMAKE_CXX_STANDARD_REQUIRED ON) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") -@@ -111,7 +107,10 @@ if(USE_SWIG) +@@ -115,19 +111,16 @@ endif() endif() @@ -36,7 +36,19 @@ index 1ff289b9..43f6bcea 100644 include_directories(${EIGEN_DIR}) # See https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README -@@ -149,24 +148,7 @@ if(USE_CUDA) + 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}) +- +-set(FMT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external_libs/fmt/include") +-include_directories(${FMT_INCLUDE_DIR}) +- + if(__BUILD_FOR_R) + find_package(LibR REQUIRED) + message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}") +@@ -159,24 +152,7 @@ endif() if(USE_OPENMP) @@ -62,3 +74,101 @@ index 1ff289b9..43f6bcea 100644 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() +@@ -707,83 +683,6 @@ + set(CMAKE_INSTALL_PREFIX "lightgbm") + endif() + +-# The macOS linker puts an absolute path to linked libraries in lib_lightgb.dylib. +-# This block overrides that information for LightGBM's OpenMP dependency, to allow +-# finding that library in more places. +-# +-# This reduces the risk of runtime issues resulting from multiple libomp.dylib being loaded. +-# +-if(APPLE AND USE_OPENMP) +- # store path to libomp found at build time in a variable +- get_target_property( +- OpenMP_LIBRARY_LOCATION +- OpenMP::OpenMP_CXX +- INTERFACE_LINK_LIBRARIES +- ) +- # get just the filename of that path +- # (to deal with the possibility that it might be 'libomp.dylib' or 'libgomp.dylib' or 'libiomp.dylib') +- get_filename_component( +- OpenMP_LIBRARY_NAME +- ${OpenMP_LIBRARY_LOCATION} +- NAME +- ) +- # get directory of that path +- get_filename_component( +- OpenMP_LIBRARY_DIR +- ${OpenMP_LIBRARY_LOCATION} +- DIRECTORY +- ) +- # get exact name of the library in a variable +- get_target_property( +- __LIB_LIGHTGBM_OUTPUT_NAME +- _lightgbm +- OUTPUT_NAME +- ) +- if(NOT __LIB_LIGHTGBM_OUTPUT_NAME) +- set(__LIB_LIGHTGBM_OUTPUT_NAME "lib_lightgbm") +- endif() +- +- if(CMAKE_SHARED_LIBRARY_SUFFIX_CXX) +- set( +- __LIB_LIGHTGBM_FILENAME "${__LIB_LIGHTGBM_OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_CXX}" +- CACHE INTERNAL "lightgbm shared library filename" +- ) +- else() +- set( +- __LIB_LIGHTGBM_FILENAME "${__LIB_LIGHTGBM_OUTPUT_NAME}.dylib" +- CACHE INTERNAL "lightgbm shared library filename" +- ) +- endif() +- +- # Override the absolute path to OpenMP with a relative one using @rpath. +- # +- # This also ensures that if a libomp.dylib has already been loaded, it'll just use that. +- add_custom_command( +- TARGET _lightgbm +- POST_BUILD +- COMMAND +- install_name_tool +- -change +- ${OpenMP_LIBRARY_LOCATION} +- "@rpath/${OpenMP_LIBRARY_NAME}" +- "${__LIB_LIGHTGBM_FILENAME}" +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +- COMMENT "Replacing hard-coded OpenMP install_name with '@rpath/${OpenMP_LIBRARY_NAME}'..." +- ) +- # add RPATH entries to ensure the loader looks in the following, in the following order: +- # +- # - /opt/homebrew/opt/libomp/lib (where 'brew install' / 'brew link' puts libomp.dylib) +- # - ${OpenMP_LIBRARY_DIR} (wherever find_package(OpenMP) found OpenMP at build time) +- # +- set_target_properties( +- _lightgbm +- PROPERTIES +- BUILD_WITH_INSTALL_RPATH TRUE +- INSTALL_RPATH "/opt/homebrew/opt/libomp/lib;${OpenMP_LIBRARY_DIR}" +- INSTALL_RPATH_USE_LINK_PATH FALSE +- ) +-endif() +- + install( + TARGETS _lightgbm + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin +@@ -796,13 +695,4 @@ + DIRECTORY ${LightGBM_HEADER_DIR}/LightGBM + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + ) +- install( +- FILES ${FAST_DOUBLE_PARSER_INCLUDE_DIR}/fast_double_parser.h +- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/LightGBM/utils +- ) +- install( +- DIRECTORY ${FMT_INCLUDE_DIR}/ +- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/LightGBM/utils +- FILES_MATCHING PATTERN "*.h" +- ) + endif() diff --git a/math/LightGBM/files/0002-common.h-fix-includes.patch b/math/LightGBM/files/0002-common.h-fix-includes.patch deleted file mode 100644 index 126c2662e47c4..0000000000000 --- a/math/LightGBM/files/0002-common.h-fix-includes.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 70f920a27ddfc20d13c57a6c65ab87417476859c Mon Sep 17 00:00:00 2001 -From: Sergey Fedorov -Date: Sun, 10 Mar 2024 02:14:21 +0700 -Subject: [PATCH] common.h: fix includes - ---- - include/LightGBM/utils/common.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git include/LightGBM/utils/common.h include/LightGBM/utils/common.h -index f1b5a10b..6c3ebf5d 100644 ---- include/LightGBM/utils/common.h -+++ include/LightGBM/utils/common.h -@@ -30,8 +30,8 @@ - #include - - #define FMT_HEADER_ONLY --#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h" --#include "../../../external_libs/fmt/include/fmt/format.h" -+#include "fast_double_parser.h" -+#include "fmt/format.h" - - #ifdef _MSC_VER - #include -@@ -1232,7 +1232,7 @@ struct __TToStringHelper { - * Converts an array to a string with with values separated by the space character. - * This method replaces Common's ``ArrayToString`` and ``ArrayToStringFast`` functionality - * and is locale-independent. --* -+* - * \note If ``high_precision_output`` is set to true, - * floating point values are output with more digits of precision. - */