Skip to content

Commit

Permalink
[R-package] Remove CLI-only objects (#3566)
Browse files Browse the repository at this point in the history
* [R-package] Remove CLI-only objects

* more guards

* more guards

* variable not string

* simplify fix

* revert build_r.R changes

* move define of global_timer

Co-authored-by: Nikita Titov <[email protected]>
  • Loading branch information
jameslamb and StrikerRUS authored Nov 21, 2020
1 parent b07afa4 commit 1c5930b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ if(USE_MPI)
endif(USE_MPI)

file(GLOB SOURCES
src/application/*.cpp
src/boosting/*.cpp
src/io/*.cpp
src/metric/*.cpp
Expand All @@ -330,7 +329,7 @@ if(USE_CUDA)
endif(USE_CUDA)
)

add_executable(lightgbm src/main.cpp ${SOURCES})
add_executable(lightgbm src/main.cpp src/application/application.cpp ${SOURCES})
list(APPEND SOURCES "src/c_api.cpp")

# Only build the R part of the library if building for
Expand Down
1 change: 0 additions & 1 deletion R-package/src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ PKG_LIBS = \
-pthread

OBJECTS = \
application/application.o \
boosting/boosting.o \
boosting/gbdt.o \
boosting/gbdt_model_text.o \
Expand Down
1 change: 0 additions & 1 deletion R-package/src/Makevars.win.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ PKG_LIBS = \
-lIphlpapi

OBJECTS = \
application/application.o \
boosting/boosting.o \
boosting/gbdt.o \
boosting/gbdt_model_text.o \
Expand Down
6 changes: 4 additions & 2 deletions build-cran-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ cd ${TEMP_R_DIR}
rm AUTOCONF_UBUNTU_VERSION
rm recreate-configure.sh

# main.cpp is used to make the lightgbm CLI, unnecessary
# for the R package
# files only used by the lightgbm CLI aren't needed for
# the R package
rm src/application/application.cpp
rm src/include/LightGBM/application.h
rm src/main.cpp

# configure.ac and DESCRIPTION have placeholders for version
Expand Down
2 changes: 0 additions & 2 deletions src/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

namespace LightGBM {

Common::Timer global_timer;

Application::Application(int argc, char** argv) {
LoadParameters(argc, argv);
// set number of threads for openmp
Expand Down
2 changes: 2 additions & 0 deletions src/boosting/gbdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace LightGBM {

Common::Timer global_timer;

int LGBM_config_::current_device = lgbm_device_cpu;
int LGBM_config_::current_learner = use_cpu_learner;

Expand Down

0 comments on commit 1c5930b

Please sign in to comment.