diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index bff33548c..4f2243735 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -98,6 +98,13 @@ jobs: toolchain: MSVC r_version: 4.0 build_type: cmake + # Visual Studio 2022 + - os: windows-2022 + task: r-package + compiler: MSVC + toolchain: MSVC + r_version: 4.0 + build_type: cmake ############### # CRAN builds # ############### diff --git a/R-package/src/install.libs.R b/R-package/src/install.libs.R index f292b43e3..b9019755b 100644 --- a/R-package/src/install.libs.R +++ b/R-package/src/install.libs.R @@ -65,7 +65,8 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262" # try to generate Visual Studio build files .generate_vs_makefiles <- function(cmake_args) { vs_versions <- c( - "Visual Studio 16 2019" + "Visual Studio 17 2022" + , "Visual Studio 16 2019" , "Visual Studio 15 2017" , "Visual Studio 14 2015" ) diff --git a/docs/Installation-Guide.rst b/docs/Installation-Guide.rst index 876002268..6d6456ea7 100644 --- a/docs/Installation-Guide.rst +++ b/docs/Installation-Guide.rst @@ -581,7 +581,9 @@ Following procedure is for the **MSVC** (Microsoft Visual C++) build. Visual Studio 2017 -> ``msvc-14.1-64.exe``, - Visual Studio 2019 -> ``msvc-14.2-64.exe``. + Visual Studio 2019 -> ``msvc-14.2-64.exe``, + + Visual Studio 2022 -> ``msvc-14.3-64.exe``. 4. Run the following commands: diff --git a/python-package/setup.py b/python-package/setup.py index 3cdcb7e12..53e84b03b 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -165,7 +165,7 @@ def compile_cpp( lib_path = CURRENT_DIR / "compile" / "windows" / "x64" / "DLL" / "lib_lightgbm.dll" if not any((use_gpu, use_cuda, use_mpi, use_hdfs, nomp, bit32, integrated_opencl)): logger.info("Starting to compile with MSBuild from existing solution file.") - platform_toolsets = ("v142", "v141", "v140") + platform_toolsets = ("v143", "v142", "v141", "v140") for pt in platform_toolsets: status = silent_call(["MSBuild", str(CURRENT_DIR / "compile" / "windows" / "LightGBM.sln"), @@ -180,7 +180,12 @@ def compile_cpp( logger.warning("Compilation with MSBuild from existing solution file failed.") if status != 0 or not lib_path.is_file(): arch = "Win32" if bit32 else "x64" - vs_versions = ("Visual Studio 16 2019", "Visual Studio 15 2017", "Visual Studio 14 2015") + vs_versions = ( + "Visual Studio 17 2022", + "Visual Studio 16 2019", + "Visual Studio 15 2017", + "Visual Studio 14 2015" + ) for vs in vs_versions: logger.info(f"Starting to compile with {vs} ({arch}).") status = silent_call(cmake_cmd + ["-G", vs, "-A", arch])