-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#18759) lightgbm: migrate to Conan v2, add v4.0.0
* lightgbm: migrate to Conan v2, add v4.0.0 * lightgbm: enable llvm-openmp * lightgbm: bump version * lightgbm: unvendor Eigen fully * lightgbm: bump llvm-openmp, export OpenMP flags correctly * lightgbm: restore patches for the Clang OpenMP support fix * lightgbm: simplify patching * lightgbm: add -fopenmp to linker flags * lightgbm: disable openmp on apple-clang for Conan v1
- Loading branch information
Showing
12 changed files
with
163 additions
and
89 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 |
---|---|---|
@@ -1,7 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(cmake_wrapper LANGUAGES CXX) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup(KEEP_RPATHS) | ||
find_package(Eigen3 REQUIRED CONFIG) | ||
find_package(fast_double_parser REQUIRED CONFIG) | ||
find_package(fmt REQUIRED CONFIG) | ||
|
||
add_subdirectory("source_subfolder") | ||
add_subdirectory(src) | ||
|
||
if(_MAJOR_VERSION GREATER_EQUAL 4) | ||
set(TARGETS lightgbm_objs lightgbm_capi_objs) | ||
set(VISIBILITY PRIVATE) | ||
else() | ||
set(TARGETS lightgbm _lightgbm) | ||
set(VISIBILITY "") | ||
endif() | ||
|
||
foreach(target ${TARGETS}) | ||
target_link_libraries(${target} ${VISIBILITY} Eigen3::Eigen fast_double_parser::fast_double_parser fmt::fmt) | ||
endforeach() |
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
sources: | ||
"3.3.2": | ||
url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v3.3.2.tar.gz" | ||
sha256: "d7c0f842e94165578d5a0c046ca942838d1574149f98c84400ce511239d17b9f" | ||
"4.1.0": | ||
url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v4.1.0.tar.gz" | ||
sha256: "eb896dc21c7afec95d10327777f6e77163b5bcd35f6ce5d152e6feefbe3328a5" | ||
"3.3.5": | ||
url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v3.3.5.tar.gz" | ||
sha256: "16fb9e299ced37be5ac69dd510e7323337e623019c9c578628c43b285f764be7" | ||
patches: | ||
"3.3.2": | ||
- patch_file: "patches/0001-fix-includes.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/0002-fix-openmp-clang.patch" | ||
base_path: "source_subfolder" | ||
url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v3.3.2.tar.gz" | ||
sha256: "d7c0f842e94165578d5a0c046ca942838d1574149f98c84400ce511239d17b9f" | ||
patches: | ||
"4.1.0": | ||
- patch_file: "patches/4.1.0-0001-fix-openmp-clang.patch" | ||
patch_type: "portability" | ||
patch_description: "Fix OpenMP support for Clang" | ||
"3.3.5": | ||
- patch_file: "patches/0001-fix-includes.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/0003-fix-openmp-clang.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/3.3.5-0001-fix-openmp-clang.patch" | ||
patch_type: "portability" | ||
patch_description: "Fix OpenMP support for Clang" | ||
"3.3.2": | ||
- patch_file: "patches/3.3.2-0001-fix-openmp-clang.patch" | ||
patch_type: "portability" | ||
patch_description: "Fix OpenMP support for Clang" |
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 was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
recipes/lightgbm/all/patches/4.1.0-0001-fix-openmp-clang.patch
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,11 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -526,7 +526,7 @@ | ||
endif() | ||
|
||
if(USE_OPENMP) | ||
- if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang|AppleClang") | ||
target_link_libraries(lightgbm_objs PUBLIC OpenMP::OpenMP_CXX) | ||
# c_api headers also includes OpenMP headers, thus compiling | ||
# lightgbm_capi_objs needs include directory for OpenMP. |
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class LightGBMTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
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,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class LightGBMTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
versions: | ||
"3.3.2": | ||
"4.1.0": | ||
folder: all | ||
"3.3.5": | ||
folder: all | ||
"3.3.2": | ||
folder: all |