Skip to content
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: cpplint
args:
- --recursive
- --filter=-build/c++11,-build/include_subdir,-build/include_what_you_use,-build/header_guard,-whitespace/indent_namespace,-whitespace/line_length
- --filter=-build/include_subdir,-build/include_what_you_use,-build/header_guard,-whitespace/indent_namespace,-whitespace/line_length
- repo: local
hooks:
- id: check-omp-pragmas
Expand Down
19 changes: 5 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ endif()

project(lightgbm LANGUAGES C CXX)

if(USE_CUDA)
set(CMAKE_CXX_STANDARD 17)
elseif(BUILD_CPP_TEST)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
Expand Down Expand Up @@ -72,22 +66,19 @@ endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.2")
message(FATAL_ERROR "Insufficient gcc version")
message(FATAL_ERROR "Insufficient gcc version (${CMAKE_CXX_COMPILER_VERSION})")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.8")
message(FATAL_ERROR "Insufficient Clang version")
message(FATAL_ERROR "Insufficient Clang version (${CMAKE_CXX_COMPILER_VERSION})")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.1.0")
message(FATAL_ERROR "Insufficient AppleClang version")
message(FATAL_ERROR "Insufficient AppleClang version (${CMAKE_CXX_COMPILER_VERSION})")
endif()
elseif(MSVC)
if(MSVC_VERSION LESS 1900)
message(
FATAL_ERROR
"The compiler ${CMAKE_CXX_COMPILER} doesn't support required C++11 features. Please use a newer MSVC."
)
message(FATAL_ERROR "Insufficient MSVC version (${MSVC_VERSION})")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The previous message was probably technically still true, but this rewording is a bit simpler and is consistent with the other enforce-a-minimum-compiler-version errors.

It's enough for users to be told that the version of a compiler they're using is older than what LightGBM supports... saying for MSVC that that's because of "C++11 features" doesn't add much information.

endif()
endif()

Expand Down
15 changes: 11 additions & 4 deletions R-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,20 @@ The steps above should work on most systems, but users with highly-customized en

To change the compiler used when installing the CRAN package, you can create a file `~/.R/Makevars` which overrides `CC` (`C` compiler) and `CXX` (`C++` compiler).

For example, to use `gcc` instead of `clang` on Mac, you could use something like the following:
For example, to use `gcc-14` instead of `clang` on macOS, you could use something like the following:

```make
# ~/.R/Makevars
CC=gcc-8
CXX=g++-8
CXX11=g++-8
CC=gcc-14
CC17=gcc-14
CXX=g++-14
CXX17=g++-14
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested all of this on a Mac with R 4.4.2 tonight, confirmed it worked as expected.


To check the values R is using, run the following:

```shell
R CMD config --all
```

### Installing from Source with CMake <a id="install"></a>
Expand Down
Loading