Unverified Commit a9d9b119 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

store all CMake files in one place (#4087)

parent 4ded1342
...@@ -100,7 +100,6 @@ include_directories(${EIGEN_DIR}) ...@@ -100,7 +100,6 @@ include_directories(${EIGEN_DIR})
ADD_DEFINITIONS(-DEIGEN_MPL2_ONLY) ADD_DEFINITIONS(-DEIGEN_MPL2_ONLY)
if(__BUILD_FOR_R) if(__BUILD_FOR_R)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
find_package(LibR REQUIRED) find_package(LibR REQUIRED)
message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}") message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}")
message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}") message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}")
...@@ -157,7 +156,7 @@ endif(USE_GPU) ...@@ -157,7 +156,7 @@ endif(USE_GPU)
if(__INTEGRATE_OPENCL) if(__INTEGRATE_OPENCL)
if(WIN32) if(WIN32)
include(CMakeIntegratedOpenCL.cmake) include(cmake/IntegratedOpenCL.cmake)
ADD_DEFINITIONS(-DUSE_GPU) ADD_DEFINITIONS(-DUSE_GPU)
else() else()
message(FATAL_ERROR "Integrated OpenCL build is available only for Windows") message(FATAL_ERROR "Integrated OpenCL build is available only for Windows")
...@@ -418,10 +417,10 @@ if(USE_GPU) ...@@ -418,10 +417,10 @@ if(USE_GPU)
endif(USE_GPU) endif(USE_GPU)
if(__INTEGRATE_OPENCL) 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)
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_include_directories(_lightgbm PRIVATE ${INTEGRATED_OPENCL_INCLUDES}) target_include_directories(_lightgbm PRIVATE ${INTEGRATED_OPENCL_INCLUDES})
target_compile_definitions(lightgbm PRIVATE ${INTEGRATED_OPENCL_DEFINITIONS}) target_compile_definitions(lightgbm PRIVATE ${INTEGRATED_OPENCL_DEFINITIONS})
......
...@@ -63,7 +63,6 @@ cd ${TEMP_R_DIR} ...@@ -63,7 +63,6 @@ cd ${TEMP_R_DIR}
# Remove files not needed for CRAN # Remove files not needed for CRAN
echo "Removing files not needed for CRAN" echo "Removing files not needed for CRAN"
rm src/install.libs.R rm src/install.libs.R
rm -r src/cmake/
rm -r inst/ rm -r inst/
rm -r pkgdown/ rm -r pkgdown/
rm cran-comments.md rm cran-comments.md
......
...@@ -316,6 +316,14 @@ for (submodule in list.dirs( ...@@ -316,6 +316,14 @@ for (submodule in list.dirs(
} }
# copy files into the place CMake expects # 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")) { for (src_file in c("lightgbm_R.cpp", "lightgbm_R.h", "R_object_helper.h")) {
result <- file.copy( result <- file.copy(
from = file.path(TEMP_SOURCE_DIR, src_file) from = file.path(TEMP_SOURCE_DIR, src_file)
......
...@@ -3,7 +3,7 @@ include LICENSE ...@@ -3,7 +3,7 @@ include LICENSE
include *.rst *.txt include *.rst *.txt
recursive-include lightgbm VERSION.txt *.py *.so recursive-include lightgbm VERSION.txt *.py *.so
include compile/CMakeLists.txt include compile/CMakeLists.txt
include compile/CMakeIntegratedOpenCL.cmake include compile/cmake/IntegratedOpenCL.cmake
recursive-include compile *.so recursive-include compile *.so
recursive-include compile/Release *.dll recursive-include compile/Release *.dll
include compile/external_libs/compute/CMakeLists.txt include compile/external_libs/compute/CMakeLists.txt
......
...@@ -83,8 +83,10 @@ def copy_files(integrated_opencl=False, use_gpu=False): ...@@ -83,8 +83,10 @@ def copy_files(integrated_opencl=False, use_gpu=False):
os.path.join(CURRENT_DIR, "compile", "CMakeLists.txt"), os.path.join(CURRENT_DIR, "compile", "CMakeLists.txt"),
verbose=0) verbose=0)
if integrated_opencl: if integrated_opencl:
copy_file(os.path.join(CURRENT_DIR, os.path.pardir, "CMakeIntegratedOpenCL.cmake"), if not os.path.exists(os.path.join(CURRENT_DIR, "compile", "cmake")):
os.path.join(CURRENT_DIR, "compile", "CMakeIntegratedOpenCL.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) verbose=0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment