2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-27 14:08:23 +03:00

Add support for VS2015/VS2017 in old gradle.

This commit is contained in:
s1lent 2017-07-31 19:41:53 +07:00
parent 25c9ee1bd7
commit 95f636a4dd
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 35 additions and 0 deletions

19
getucrtinfo.bat Normal file
View File

@ -0,0 +1,19 @@
@echo off
if defined VS150COMNTOOLS (
if not exist "%VS150COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS
call "%VS150COMNTOOLS%vcvarsqueryregistry.bat"
goto :run
) else if defined VS140COMNTOOLS (
if not exist "%VS140COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS
call "%VS140COMNTOOLS%vcvarsqueryregistry.bat"
goto :run
)
:NoVS
echo Error: Visual Studio 2015 or 2017 required.
exit /b 1
:run
echo %UniversalCRTSdkDir%
echo %UCRTVersion%

View File

@ -121,5 +121,21 @@ rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind ->
}
}
// Detect and setup UCRT paths
def ucrtInfo = "getucrtinfo.bat".execute().text
def m = ucrtInfo =~ /^(.*)\r\n(.*)?$/
if (!m.find()) {
return cfg
}
def kitPath = m.group(1)
def ucrtVersion = m.group(2)
def ucrtCheckFile = new File("${kitPath}Include/${ucrtVersion}/ucrt/stdio.h");
if (!ucrtCheckFile.exists()) {
return cfg
}
cfg.compilerOptions.args "/FS", "/I${kitPath}Include/${ucrtVersion}/ucrt";
cfg.linkerOptions.args("/LIBPATH:${kitPath}Lib/${ucrtVersion}/ucrt/x86");
return cfg
}