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
This commit is contained in:
Nikita Titov 2021-12-16 00:28:26 +03:00 коммит произвёл GitHub
Родитель 9f13a9c897
Коммит 90a71b9403
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 19 добавлений и 4 удалений

7
.github/workflows/r_package.yml поставляемый
Просмотреть файл

@ -98,6 +98,13 @@ jobs:
toolchain: MSVC toolchain: MSVC
r_version: 4.0 r_version: 4.0
build_type: cmake 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 # # CRAN builds #
############### ###############

Просмотреть файл

@ -65,7 +65,8 @@ if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
# try to generate Visual Studio build files # try to generate Visual Studio build files
.generate_vs_makefiles <- function(cmake_args) { .generate_vs_makefiles <- function(cmake_args) {
vs_versions <- c( vs_versions <- c(
"Visual Studio 16 2019" "Visual Studio 17 2022"
, "Visual Studio 16 2019"
, "Visual Studio 15 2017" , "Visual Studio 15 2017"
, "Visual Studio 14 2015" , "Visual Studio 14 2015"
) )

Просмотреть файл

@ -581,7 +581,9 @@ Following procedure is for the **MSVC** (Microsoft Visual C++) build.
Visual Studio 2017 -> ``msvc-14.1-64.exe``, 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: 4. Run the following commands:

Просмотреть файл

@ -165,7 +165,7 @@ def compile_cpp(
lib_path = CURRENT_DIR / "compile" / "windows" / "x64" / "DLL" / "lib_lightgbm.dll" 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)): 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.") 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: for pt in platform_toolsets:
status = silent_call(["MSBuild", status = silent_call(["MSBuild",
str(CURRENT_DIR / "compile" / "windows" / "LightGBM.sln"), str(CURRENT_DIR / "compile" / "windows" / "LightGBM.sln"),
@ -180,7 +180,12 @@ def compile_cpp(
logger.warning("Compilation with MSBuild from existing solution file failed.") logger.warning("Compilation with MSBuild from existing solution file failed.")
if status != 0 or not lib_path.is_file(): if status != 0 or not lib_path.is_file():
arch = "Win32" if bit32 else "x64" 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: for vs in vs_versions:
logger.info(f"Starting to compile with {vs} ({arch}).") logger.info(f"Starting to compile with {vs} ({arch}).")
status = silent_call(cmake_cmd + ["-G", vs, "-A", arch]) status = silent_call(cmake_cmd + ["-G", vs, "-A", arch])