Skip to content

Commit

Permalink
[python-package] remove unused Eigen files, compile with EIGEN_MPL2_O…
Browse files Browse the repository at this point in the history
…NLY (fixes #3684) (#3685)

* [python-package] remove unused Eigen files (fixes #3684)

* more changes

* add EIGEN_MPL2_ONLY in VS solution file

* fix VS project

* remove EIGEN_MPL2_ONLY define in linear_tree_learner

Co-authored-by: Nikita Titov <[email protected]>
  • Loading branch information
jameslamb and StrikerRUS authored Dec 29, 2020
1 parent 68a40c7 commit 6cb968a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ endif(USE_SWIG)
SET(EIGEN_DIR "${PROJECT_SOURCE_DIR}/eigen")
include_directories(${EIGEN_DIR})

# See https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README
ADD_DEFINITIONS(-DEIGEN_MPL2_ONLY)

if(__BUILD_FOR_R)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
find_package(LibR REQUIRED)
Expand Down
24 changes: 23 additions & 1 deletion python-package/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@ include compile/compute/CMakeLists.txt
recursive-include compile/compute/cmake *
recursive-include compile/compute/include *
recursive-include compile/compute/meta *
recursive-include compile/eigen *
include compile/eigen/CMakeLists.txt
include compile/eigen/Eigen/CMakeLists.txt
include compile/eigen/Eigen/Cholesky
include compile/eigen/Eigen/Core
include compile/eigen/Eigen/Dense
include compile/eigen/Eigen/Eigenvalues
include compile/eigen/Eigen/Geometry
include compile/eigen/Eigen/Householder
include compile/eigen/Eigen/Jacobi
include compile/eigen/Eigen/LU
include compile/eigen/Eigen/QR
include compile/eigen/Eigen/SVD
recursive-include compile/eigen/Eigen/src/Cholesky *
recursive-include compile/eigen/Eigen/src/Core *
recursive-include compile/eigen/Eigen/src/Eigenvalues *
recursive-include compile/eigen/Eigen/src/Geometry *
recursive-include compile/eigen/Eigen/src/Householder *
recursive-include compile/eigen/Eigen/src/Jacobi *
recursive-include compile/eigen/Eigen/src/LU *
recursive-include compile/eigen/Eigen/src/misc *
recursive-include compile/eigen/Eigen/src/plugins *
recursive-include compile/eigen/Eigen/src/QR *
recursive-include compile/eigen/Eigen/src/SVD *
include compile/external_libs/fast_double_parser/CMakeLists.txt
include compile/external_libs/fast_double_parser/LICENSE
include compile/external_libs/fast_double_parser/LICENSE.BSL
Expand Down
2 changes: 0 additions & 2 deletions src/treelearner/linear_tree_learner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <algorithm>

#ifndef LGB_R_BUILD
// preprocessor definition ensures we use only MPL2-licensed code
#define EIGEN_MPL2_ONLY
#include <Eigen/Dense>
#endif // !LGB_R_BUILD

Expand Down
13 changes: 9 additions & 4 deletions windows/LightGBM.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="Projectconfigurations">
<ProjectConfiguration Include="Debug_DLL|x64">
Expand Down Expand Up @@ -99,9 +99,14 @@
<IncludePath>..\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<TargetName>lib_lightgbm</TargetName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>EIGEN_MPL2_ONLY</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_mpi|x64'">
<ClCompile>
<PreprocessorDefinitions>USE_MPI</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_MPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<OpenMPSupport>true</OpenMPSupport>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
Expand All @@ -124,7 +129,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>USE_SOCKET</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_SOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<OpenMPSupport>true</OpenMPSupport>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
Expand All @@ -144,7 +149,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|x64'">
<ClCompile>
<PreprocessorDefinitions>USE_SOCKET</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_SOCKET;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<OpenMPSupport>true</OpenMPSupport>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
Expand Down
8 changes: 7 additions & 1 deletion windows/LightGBM.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
Expand Down Expand Up @@ -225,6 +225,9 @@
<ClInclude Include="..\src\treelearner\monotone_constraints.hpp">
<Filter>src\treelearner</Filter>
</ClInclude>
<ClInclude Include="..\src\treelearner\linear_tree_learner.h">
<Filter>src\treelearner</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\application\application.cpp">
Expand Down Expand Up @@ -320,5 +323,8 @@
<ClCompile Include="..\src\io\train_share_states.cpp">
<Filter>src\io</Filter>
</ClCompile>
<ClCompile Include="..\src\treelearner\linear_tree_learner.cpp">
<Filter>src\treelearner</Filter>
</ClCompile>
</ItemGroup>
</Project>

0 comments on commit 6cb968a

Please sign in to comment.