Skip to content

Commit

Permalink
[cmake] [c++] require CMake 3.18+ (#6260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Jan 9, 2024
1 parent 03ee995 commit ec97d36
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
14 changes: 1 addition & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,7 @@ if(APPLE)
option(APPLE_OUTPUT_DYLIB "Output dylib shared library" OFF)
endif()

if(__INTEGRATE_OPENCL)
cmake_minimum_required(VERSION 3.11)
elseif(USE_SWIG)
cmake_minimum_required(VERSION 3.8)
elseif(USE_GPU OR APPLE)
cmake_minimum_required(VERSION 3.2)
elseif(USE_CUDA)
cmake_minimum_required(VERSION 3.16)
else()
cmake_minimum_required(VERSION 3.0)
endif()
cmake_minimum_required(VERSION 3.18)

project(lightgbm LANGUAGES C CXX)

Expand Down Expand Up @@ -85,15 +75,13 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.1.0")
message(FATAL_ERROR "Insufficient AppleClang version")
endif()
cmake_minimum_required(VERSION 3.16)
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."
)
endif()
cmake_minimum_required(VERSION 3.8)
endif()

if(USE_SWIG)
Expand Down
2 changes: 1 addition & 1 deletion docs/GPU-Windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Installing CMake requires one download first and then a lot of configuration for
:target: ./_static/images/screenshot-downloading-cmake.png
:alt: A screenshot of the binary distributions of C Make for downloading on 64 bit Windows.

- Download `CMake`_ (3.8 or higher)
- Download `CMake`_

- Install CMake

Expand Down
36 changes: 18 additions & 18 deletions docs/Installation-Guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The ``.exe`` file will be in ``LightGBM-master/windows/x64/Release`` folder.
From Command Line
*****************

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).
1. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

2. Run the following commands:

Expand Down Expand Up @@ -167,7 +167,7 @@ Install Using ``Homebrew``
Build from GitHub
*****************

1. Install `CMake`_ (3.16 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand All @@ -193,7 +193,7 @@ Build from GitHub
gcc
^^^

1. Install `CMake`_ (3.2 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down Expand Up @@ -266,7 +266,7 @@ The ``.exe`` file will be in ``LightGBM-master/windows/x64/Release`` folder.
From Command Line
-----------------

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).
1. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

2. Run the following commands:

Expand Down Expand Up @@ -331,7 +331,7 @@ Apple Clang

Only **Apple Clang** version 8.1 or higher is supported.

1. Install `CMake`_ (3.16 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand All @@ -351,7 +351,7 @@ Only **Apple Clang** version 8.1 or higher is supported.
gcc
***

1. Install `CMake`_ (3.2 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down Expand Up @@ -414,7 +414,7 @@ From Command Line

1. You need to install `MS MPI`_ first. Both ``msmpisdk.msi`` and ``msmpisetup.exe`` are needed.

2. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).
2. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

3. Run the following commands:

Expand Down Expand Up @@ -465,7 +465,7 @@ Apple Clang

Only **Apple Clang** version 8.1 or higher is supported.

1. Install `CMake`_ (3.16 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down Expand Up @@ -497,7 +497,7 @@ Only **Apple Clang** version 8.1 or higher is supported.
gcc
***

1. Install `CMake`_ (3.2 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down Expand Up @@ -547,7 +547,7 @@ The following dependencies should be installed before compilation:

The following Debian packages should provide necessary Boost libraries: ``libboost-dev``, ``libboost-system-dev``, ``libboost-filesystem-dev``.

- **CMake** 3.2 or later.
- **CMake**

To build LightGBM GPU version, run the following commands:

Expand Down Expand Up @@ -575,7 +575,7 @@ If you use **MinGW**, the build procedure is similar to the build on Linux. Refe

Following procedure is for the **MSVC** (Microsoft Visual C++) build.

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is installed).
1. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is installed).

2. Install **OpenCL** for Windows. The installation depends on the brand (NVIDIA, AMD, Intel) of your GPU card.

Expand Down Expand Up @@ -637,7 +637,7 @@ The following dependencies should be installed before compilation:

- **CUDA** 11.0 or later libraries. Please refer to `this detailed guide`_. Pay great attention to the minimum required versions of host compilers listed in the table from that guide and use only recommended versions of compilers.

- **CMake** 3.16 or later.
- **CMake**

To build LightGBM CUDA version, run the following commands:

Expand Down Expand Up @@ -700,7 +700,7 @@ On Windows a Java wrapper of LightGBM can be built using **Java**, **SWIG**, **C
VS Build Tools
**************

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).
1. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

2. Install `SWIG`_ and **Java** (also make sure that ``JAVA_HOME`` is set properly).

Expand Down Expand Up @@ -779,7 +779,7 @@ Apple Clang

Only **Apple Clang** version 8.1 or higher is supported.

1. Install `CMake`_ (3.16 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand All @@ -805,7 +805,7 @@ Only **Apple Clang** version 8.1 or higher is supported.
gcc
***

1. Install `CMake`_ (3.2 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down Expand Up @@ -839,7 +839,7 @@ Windows

On Windows, C++ unit tests of LightGBM can be built using **CMake** and **VS Build Tools**.

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).
1. Install `Git for Windows`_, `CMake`_ and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

2. Run the following commands:

Expand Down Expand Up @@ -884,7 +884,7 @@ Apple Clang

Only **Apple Clang** version 8.1 or higher is supported.

1. Install `CMake`_ (3.16 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand All @@ -904,7 +904,7 @@ Only **Apple Clang** version 8.1 or higher is supported.
gcc
***

1. Install `CMake`_ (3.2 or higher):
1. Install `CMake`_ :

.. code:: sh
Expand Down
2 changes: 1 addition & 1 deletion python-package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ build-backend = "scikit_build_core.build"
# based on https://github.com/scikit-build/scikit-build-core#configuration
[tool.scikit-build]

cmake.minimum-version = "3.15"
cmake.minimum-version = "3.18"
ninja.minimum-version = "1.11"
ninja.make-fallback = true
cmake.args = [
Expand Down

0 comments on commit ec97d36

Please sign in to comment.