Skip to content
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

[R-package] Remove CLI-only objects #3566

Merged
merged 9 commits into from
Nov 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify fix
jameslamb committed Nov 17, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 36173712c413c54ffe324a2cbe4ca0ede6f1e154
41 changes: 12 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
@@ -330,9 +329,7 @@ if(USE_CUDA)
endif(USE_CUDA)
)

if (NOT __BUILD_FOR_R)
add_executable(lightgbm src/main.cpp ${SOURCES})
endif()
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
@@ -389,25 +386,19 @@ if(USE_SWIG)
endif(USE_SWIG)

if(USE_MPI)
if(NOT __BUILD_FOR_R)
TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES})
endif()
TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm ${MPI_CXX_LIBRARIES})
endif(USE_MPI)

if(USE_OPENMP)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(NOT __BUILD_FOR_R)
TARGET_LINK_LIBRARIES(lightgbm OpenMP::OpenMP_CXX)
endif()
TARGET_LINK_LIBRARIES(lightgbm OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(_lightgbm OpenMP::OpenMP_CXX)
endif()
endif(USE_OPENMP)

if(USE_GPU)
if(NOT __BUILD_FOR_R)
TARGET_LINK_LIBRARIES(lightgbm ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
endif()
TARGET_LINK_LIBRARIES(lightgbm ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(_lightgbm ${OpenCL_LIBRARY} ${Boost_LIBRARIES})
endif(USE_GPU)

@@ -425,13 +416,11 @@ if(__INTEGRATE_OPENCL)
endif()

if(USE_CUDA)
if(NOT __BUILD_FOR_R)
set_target_properties(lightgbm PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
TARGET_LINK_LIBRARIES(
lightgbm
${histograms}
)
endif()
set_target_properties(lightgbm PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
TARGET_LINK_LIBRARIES(
lightgbm
${histograms}
)
set_target_properties(_lightgbm PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
TARGET_LINK_LIBRARIES(
_lightgbm
@@ -446,28 +435,22 @@ endif(USE_HDFS)

if(WIN32)
if(MINGW OR CYGWIN)
if(NOT __BUILD_FOR_R)
TARGET_LINK_LIBRARIES(lightgbm Ws2_32)
TARGET_LINK_LIBRARIES(lightgbm IPHLPAPI)
endif()
TARGET_LINK_LIBRARIES(lightgbm Ws2_32)
TARGET_LINK_LIBRARIES(_lightgbm Ws2_32)
TARGET_LINK_LIBRARIES(lightgbm IPHLPAPI)
TARGET_LINK_LIBRARIES(_lightgbm IPHLPAPI)
endif(MINGW OR CYGWIN)
endif(WIN32)

set(LGB_TARGETS lightgbm _lightgbm)

# CLI is not necessary for the R package
if(__BUILD_FOR_R)
set(LGB_TARGETS _lightgbm)
if(MSVC)
TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_MSVC_CORE_LIBRARY})
else()
TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_CORE_LIBRARY})
endif(MSVC)
endif(__BUILD_FOR_R)

install(TARGETS ${LGB_TARGETS}
install(TARGETS lightgbm _lightgbm
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)