"docs/zh_cn/api.rst" did not exist on "fdfe3c4f8ba935ae428a8a496ce57755d5b2ea98"
Unverified Commit 047e7d5a authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[R-package] small cleanup after R 3.x drop (#7043)

parent ee30b8aa
...@@ -128,6 +128,14 @@ If you want to force `LightGBM` to use MSYS2 (for any R version), pass `--use-ms ...@@ -128,6 +128,14 @@ If you want to force `LightGBM` to use MSYS2 (for any R version), pass `--use-ms
Rscript build_r.R --use-msys2 Rscript build_r.R --use-msys2
``` ```
**MinGW**
If you want to force `LightGBM` to use [MinGW](https://www.mingw-w64.org/) (for any R version), pass `--use-mingw` to the installation script.
```shell
Rscript build_r.R --use-mingw
```
#### Mac OS Preparation #### Mac OS Preparation
You can perform installation either with **Apple Clang** or **gcc**. In case you prefer **Apple Clang**, you should install **OpenMP** (details for installation can be found in [Installation Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#apple-clang)) first. In case you prefer **gcc**, you need to install it (details for installation can be found in [Installation Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#gcc)) and set some environment variables to tell R to use `gcc` and `g++`. If you install these from Homebrew, your versions of `g++` and `gcc` are most likely in `/usr/local/bin`, as shown below. You can perform installation either with **Apple Clang** or **gcc**. In case you prefer **Apple Clang**, you should install **OpenMP** (details for installation can be found in [Installation Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#apple-clang)) first. In case you prefer **gcc**, you need to install it (details for installation can be found in [Installation Guide](https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#gcc)) and set some environment variables to tell R to use `gcc` and `g++`. If you install these from Homebrew, your versions of `g++` and `gcc` are most likely in `/usr/local/bin`, as shown below.
......
...@@ -11,7 +11,6 @@ CXX17=`"${R_EXE}" CMD config CXX17` ...@@ -11,7 +11,6 @@ CXX17=`"${R_EXE}" CMD config CXX17`
CXX17STD=`"${R_EXE}" CMD config CXX17STD` CXX17STD=`"${R_EXE}" CMD config CXX17STD`
CXX="${CXX17} ${CXX17STD}" CXX="${CXX17} ${CXX17STD}"
CXXFLAGS=`"${R_EXE}" CMD config CXX17FLAGS` CXXFLAGS=`"${R_EXE}" CMD config CXX17FLAGS`
CXX_STD="CXX17"
CPPFLAGS=`"${R_EXE}" CMD config CPPFLAGS` CPPFLAGS=`"${R_EXE}" CMD config CPPFLAGS`
# LightGBM-specific flags # LightGBM-specific flags
...@@ -98,9 +97,6 @@ then ...@@ -98,9 +97,6 @@ then
fi fi
# Generate Makevars.win from Makevars.win.in # Generate Makevars.win from Makevars.win.in
sed -e \
"s/@CXX_STD@/$CXX_STD/" \
< src/Makevars.win.in > src/Makevars.win
sed -e \ sed -e \
"s/@LGB_CPPFLAGS@/$LGB_CPPFLAGS/" \ "s/@LGB_CPPFLAGS@/$LGB_CPPFLAGS/" \
< src/Makevars.win.in > src/Makevars.win < src/Makevars.win.in > src/Makevars.win
CXX_STD = @CXX_STD@ CXX_STD = CXX17
PKGROOT=. PKGROOT=.
......
...@@ -15,8 +15,6 @@ if (.Machine$sizeof.pointer != 8L) { ...@@ -15,8 +15,6 @@ if (.Machine$sizeof.pointer != 8L) {
stop("LightGBM only supports 64-bit R, please check the version of R and Rtools.") stop("LightGBM only supports 64-bit R, please check the version of R and Rtools.")
} }
R_ver <- as.double(R.Version()$major) + as.double(R.Version()$minor) / 10.0
# Get some paths # Get some paths
source_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/") source_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/")
build_dir <- file.path(source_dir, "build", fsep = "/") build_dir <- file.path(source_dir, "build", fsep = "/")
...@@ -162,11 +160,7 @@ if (use_mingw) { ...@@ -162,11 +160,7 @@ if (use_mingw) {
# Rtools 4.0 moved from MinGW to MSYS toolchain. If user tries # Rtools 4.0 moved from MinGW to MSYS toolchain. If user tries
# Visual Studio install but that fails, fall back to the toolchain # Visual Studio install but that fails, fall back to the toolchain
# supported in Rtools # supported in Rtools
if (R_ver >= 4.0) {
windows_toolchain <- "MSYS2" windows_toolchain <- "MSYS2"
} else {
windows_toolchain <- "MinGW"
}
} }
windows_build_tool <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["build_tool"]] windows_build_tool <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["build_tool"]]
windows_makefile_generator <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["makefile_generator"]] windows_makefile_generator <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["makefile_generator"]]
......
...@@ -39,7 +39,7 @@ data.table::setDTthreads(1L) ...@@ -39,7 +39,7 @@ data.table::setDTthreads(1L)
# [description] # [description]
# test that every element of 'x' is in 'y' # test that every element of 'x' is in 'y'
# #
# testthat::expect_in() was added in {testthat} v3.1.19 # testthat::expect_in() was added in {testthat} v3.1.19.
# This is here to support a similar interface on older {testthat} versions. # This is here to support a similar interface on older {testthat} versions.
.expect_in <- function(x, y) { .expect_in <- function(x, y) {
if (exists("expect_in")) { if (exists("expect_in")) {
......
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