Add support for VS2015/VS2017 in old gradle.

This commit is contained in:
s1lent 2017-05-07 01:19:06 +07:00
parent 299ee99120
commit e71deb8976
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 37 additions and 1 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

@ -114,5 +114,22 @@ 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
}