From 90a71b9403e7facf52e2973ccdd6403a8071c898 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 16 Dec 2021 00:28:26 +0300 Subject: [PATCH] Add support for Visual Studio 2022 (#4889) * Update .vsts-ci.yml * Update .vsts-ci.yml * Update Installation-Guide.rst * Update install.libs.R * Update setup.py * Update r_package.yml * Update install.libs.R --- .github/workflows/r_package.yml | 7 +++++++ R-package/src/install.libs.R | 3 ++- docs/Installation-Guide.rst | 4 +++- python-package/setup.py | 9 +++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index bff33548ce1d..4f2243735cda 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 f292b43e318c..b9019755b4fa 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 876002268aaa..6d6456ea71e0 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 3cdcb7e12b86..53e84b03bf63 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])