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

store all CMake files in one place #4087

Merged
merged 1 commit into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ include_directories(${EIGEN_DIR})
ADD_DEFINITIONS(-DEIGEN_MPL2_ONLY)

if(__BUILD_FOR_R)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done at line 35

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")

find_package(LibR REQUIRED)
message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}")
message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}")
Expand Down Expand Up @@ -157,7 +156,7 @@ endif(USE_GPU)

if(__INTEGRATE_OPENCL)
if(WIN32)
include(CMakeIntegratedOpenCL.cmake)
include(cmake/IntegratedOpenCL.cmake)
ADD_DEFINITIONS(-DUSE_GPU)
else()
message(FATAL_ERROR "Integrated OpenCL build is available only for Windows")
Expand Down Expand Up @@ -418,10 +417,10 @@ if(USE_GPU)
endif(USE_GPU)

if(__INTEGRATE_OPENCL)
# targets OpenCL and Boost are added in CMakeIntegratedOpenCL.cmake
# targets OpenCL and Boost are added in IntegratedOpenCL.cmake
add_dependencies(lightgbm OpenCL Boost)
add_dependencies(_lightgbm OpenCL Boost)
# variables INTEGRATED_OPENCL_* are set in CMakeIntegratedOpenCL.cmake
# variables INTEGRATED_OPENCL_* are set in IntegratedOpenCL.cmake
target_include_directories(lightgbm PRIVATE ${INTEGRATED_OPENCL_INCLUDES})
target_include_directories(_lightgbm PRIVATE ${INTEGRATED_OPENCL_INCLUDES})
target_compile_definitions(lightgbm PRIVATE ${INTEGRATED_OPENCL_DEFINITIONS})
Expand Down
1 change: 0 additions & 1 deletion build-cran-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ cd ${TEMP_R_DIR}
# Remove files not needed for CRAN
echo "Removing files not needed for CRAN"
rm src/install.libs.R
rm -r src/cmake/
rm -r inst/
rm -r pkgdown/
rm cran-comments.md
Expand Down
8 changes: 8 additions & 0 deletions build_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ for (submodule in list.dirs(
}

# copy files into the place CMake expects
CMAKE_MODULES_R_DIR <- file.path(TEMP_SOURCE_DIR, "cmake", "modules")
dir.create(CMAKE_MODULES_R_DIR, recursive = TRUE)
result <- file.copy(
from = file.path("cmake", "modules", "FindLibR.cmake")
, to = sprintf("%s/", CMAKE_MODULES_R_DIR)
, overwrite = TRUE
)
.handle_result(result)
for (src_file in c("lightgbm_R.cpp", "lightgbm_R.h", "R_object_helper.h")) {
result <- file.copy(
from = file.path(TEMP_SOURCE_DIR, src_file)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion python-package/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include LICENSE
include *.rst *.txt
recursive-include lightgbm VERSION.txt *.py *.so
include compile/CMakeLists.txt
include compile/CMakeIntegratedOpenCL.cmake
include compile/cmake/IntegratedOpenCL.cmake
recursive-include compile *.so
recursive-include compile/Release *.dll
include compile/external_libs/compute/CMakeLists.txt
Expand Down
6 changes: 4 additions & 2 deletions python-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ def copy_files_helper(folder_name):
os.path.join(CURRENT_DIR, "compile", "CMakeLists.txt"),
verbose=0)
if integrated_opencl:
copy_file(os.path.join(CURRENT_DIR, os.path.pardir, "CMakeIntegratedOpenCL.cmake"),
os.path.join(CURRENT_DIR, "compile", "CMakeIntegratedOpenCL.cmake"),
if not os.path.exists(os.path.join(CURRENT_DIR, "compile", "cmake")):
os.makedirs(os.path.join(CURRENT_DIR, "compile", "cmake"))
copy_file(os.path.join(CURRENT_DIR, os.path.pardir, "cmake", "IntegratedOpenCL.cmake"),
os.path.join(CURRENT_DIR, "compile", "cmake", "IntegratedOpenCL.cmake"),
verbose=0)


Expand Down