Unverified Commit 2792923d authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] Add version floor of R 3.5 (fixes #3212) (#3216)

parent 7b935430
...@@ -11,7 +11,6 @@ OPTION(USE_OPENMP "Enable OpenMP" ON) ...@@ -11,7 +11,6 @@ OPTION(USE_OPENMP "Enable OpenMP" ON)
OPTION(USE_GPU "Enable GPU-accelerated training" OFF) OPTION(USE_GPU "Enable GPU-accelerated training" OFF)
OPTION(USE_SWIG "Enable SWIG to generate Java API" OFF) OPTION(USE_SWIG "Enable SWIG to generate Java API" OFF)
OPTION(USE_HDFS "Enable HDFS support (EXPERIMENTAL)" OFF) OPTION(USE_HDFS "Enable HDFS support (EXPERIMENTAL)" OFF)
OPTION(USE_R35 "Set to ON if your R version is not earlier than 3.5" OFF)
OPTION(USE_TIMETAG "Set to ON to output time costs" OFF) OPTION(USE_TIMETAG "Set to ON to output time costs" OFF)
OPTION(USE_DEBUG "Set to ON for Debug mode" OFF) OPTION(USE_DEBUG "Set to ON for Debug mode" OFF)
OPTION(BUILD_STATIC_LIB "Build static library" OFF) OPTION(BUILD_STATIC_LIB "Build static library" OFF)
...@@ -68,10 +67,6 @@ if(USE_SWIG) ...@@ -68,10 +67,6 @@ if(USE_SWIG)
endif() endif()
endif(USE_SWIG) endif(USE_SWIG)
if(USE_R35)
ADD_DEFINITIONS(-DR_VER_ABOVE_35)
endif(USE_R35)
if(BUILD_FOR_R) if(BUILD_FOR_R)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
find_package(LibR REQUIRED) find_package(LibR REQUIRED)
......
...@@ -29,7 +29,7 @@ Suggests: ...@@ -29,7 +29,7 @@ Suggests:
processx, processx,
testthat testthat
Depends: Depends:
R (>= 3.4), R (>= 3.5),
R6 (>= 2.0) R6 (>= 2.0)
Imports: Imports:
data.table (>= 1.9.6), data.table (>= 1.9.6),
......
...@@ -94,7 +94,7 @@ Windows users may need to run with administrator rights (either R or the command ...@@ -94,7 +94,7 @@ Windows users may need to run with administrator rights (either R or the command
Set `use_gpu` to `TRUE` in `R-package/src/install.libs.R` to enable the build with GPU support. You will need to install Boost and OpenCL first: details for installation can be found in [Installation-Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#build-gpu-version). Set `use_gpu` to `TRUE` in `R-package/src/install.libs.R` to enable the build with GPU support. You will need to install Boost and OpenCL first: details for installation can be found in [Installation-Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#build-gpu-version).
If you are using a precompiled dll/lib locally, you can move the dll/lib into LightGBM root folder, modify `LightGBM/R-package/src/install.libs.R`'s 2nd line (change `use_precompile <- FALSE` to `use_precompile <- TRUE`), and install R-package as usual. **NOTE: If your R version is not smaller than 3.5.0, you should set `DUSE_R35=ON` in cmake options when build precompiled dll/lib**. If you are using a precompiled dll/lib locally, you can move the dll/lib into LightGBM root folder, modify `LightGBM/R-package/src/install.libs.R`'s 2nd line (change `use_precompile <- FALSE` to `use_precompile <- TRUE`), and install R-package as usual.
When your package installation is done, you can check quickly if your LightGBM R-package is working by running the following: When your package installation is done, you can check quickly if your LightGBM R-package is working by running the following:
......
...@@ -18,47 +18,29 @@ ...@@ -18,47 +18,29 @@
// use .Internal(internalsID()) to uuid // use .Internal(internalsID()) to uuid
#define R_INTERNALS_UUID "2fdf6c18-697a-4ba7-b8ef-11c0d92f1327" #define R_INTERNALS_UUID "2fdf6c18-697a-4ba7-b8ef-11c0d92f1327"
#ifdef R_VER_ABOVE_35 #define NAMED_BITS 16
#define NAMED_BITS 16 struct lgbm_sxpinfo {
struct lgbm_sxpinfo { unsigned int type : 5;
unsigned int type : 5; unsigned int scalar : 1;
unsigned int scalar : 1; unsigned int obj : 1;
unsigned int obj : 1; unsigned int alt : 1;
unsigned int alt : 1; unsigned int gp : 16;
unsigned int gp : 16; unsigned int mark : 1;
unsigned int mark : 1; unsigned int debug : 1;
unsigned int debug : 1; unsigned int trace : 1;
unsigned int trace : 1; unsigned int spare : 1;
unsigned int spare : 1; unsigned int gcgen : 1;
unsigned int gcgen : 1; unsigned int gccls : 3;
unsigned int gccls : 3; unsigned int named : NAMED_BITS;
unsigned int named : NAMED_BITS; unsigned int extra : 32 - NAMED_BITS;
unsigned int extra : 32 - NAMED_BITS; };
};
// 64bit pointer
#if INTPTR_MAX == INT64_MAX
typedef int64_t xlen_t;
#else
typedef int xlen_t;
#endif
// 64bit pointer
#if INTPTR_MAX == INT64_MAX
typedef int64_t xlen_t;
#else #else
struct lgbm_sxpinfo {
unsigned int type : 5;
unsigned int obj : 1;
unsigned int named : 2;
unsigned int gp : 16;
unsigned int mark : 1;
unsigned int debug : 1;
unsigned int trace : 1;
unsigned int spare : 1;
unsigned int gcgen : 1;
unsigned int gccls : 3;
};
typedef int xlen_t; typedef int xlen_t;
#endif // R_VER_ABOVE_35 #endif
struct lgbm_primsxp { struct lgbm_primsxp {
int offset; int offset;
......
...@@ -170,9 +170,6 @@ if (!use_precompile) { ...@@ -170,9 +170,6 @@ if (!use_precompile) {
if (use_gpu) { if (use_gpu) {
cmake_args <- c(cmake_args, "-DUSE_GPU=ON") cmake_args <- c(cmake_args, "-DUSE_GPU=ON")
} }
if (R_ver >= 3.5) {
cmake_args <- c(cmake_args, "-DUSE_R35=ON")
}
cmake_args <- c(cmake_args, "-DBUILD_FOR_R=ON") cmake_args <- c(cmake_args, "-DBUILD_FOR_R=ON")
# Pass in R version, used to help find R executable for linking # Pass in R version, used to help find R executable for linking
......
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