@@ -24,6 +24,31 @@ install:
2424- cmd : choco install gitlink
2525
2626before_build :
27+ # Backup platform so it is not affected by vcvars
28+ - cmd : SET PLATFORMBACK=%PLATFORM%
29+
30+ # Setup msvc environment for required compiler version (specified by MSVC_VER)
31+ - ps : >-
32+ if ($env:MSVC_VER -eq 15) {
33+ $env:VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
34+ } else {
35+ $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:MSVC_VER" + "0COMNTOOLS"))
36+ $env:VCVARS="%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat"
37+ }
38+
39+ - cmd : call "%VCVARS%" amd64
40+
41+ # Detect latest available windows sdk version
42+ - ps : >-
43+ if ($env:MSVC_VER -eq 12) {
44+ $env:WindowsSDKVersion=8.1
45+ } else {
46+ $env:WindowsSDKVersion=$env:WindowsSDKVersion.TrimEnd('\')
47+ }
48+
49+ # Reset platform
50+ - cmd : SET PLATFORM=%PLATFORMBACK%
51+
2752# Create build project to compile all configurations and platforms at once
2853- ps : >-
2954 $script = @'
@@ -41,7 +66,7 @@ before_build:
4166 </PropertyGroup>
4267 <ItemGroup>
4368 <ProjectToBuild Include="SMP/APPVEYOR_PROJECT_NAME.sln">
44- <Properties>Configuration=%(ConfigurationList.Identity);Platform=$(CurrentPlatform);OutDir=$(MSBuildThisFileDirectory)build_out\</Properties>
69+ <Properties>Configuration=%(ConfigurationList.Identity);Platform=$(CurrentPlatform);OutDir=$(MSBuildThisFileDirectory)build_out\;WindowsTargetPlatformVersion=SDK_VER </Properties>
4570 </ProjectToBuild>
4671 </ItemGroup>
4772 </Target>
@@ -52,7 +77,7 @@ before_build:
5277 <PropertyGroup>
5378 <CurrentPlatform>%(PlatformList.Identity)</CurrentPlatform>
5479 </PropertyGroup>
55- <Exec Command="GitLink . -f SMP/APPVEYOR_PROJECT_NAME.sln -c %(ConfigurationList.Identity) -p $(CurrentPlatform) -d $(MSBuildThisFileDirectory)build_out\lib\$(CurrentPlatform) -u https://github.com/APPVEYOR_REPO_NAME.git -s APPVEYOR_REPO_COMMIT"/>
80+ <Exec Command="GitLink . -f SMP/APPVEYOR_PROJECT_NAME.sln -c %(ConfigurationList.Identity) -p $(CurrentPlatform) -d $(MSBuildThisFileDirectory)build_out\lib\$(CurrentPlatform) -u https://github.com/APPVEYOR_REPO_NAME.git -s APPVEYOR_REPO_COMMIT -errorsaswarnings "/>
5681 </Target>
5782 </Project>
5883
@@ -67,24 +92,9 @@ before_build:
6792
6893 $script = $script -replace "APPVEYOR_MSVC_VER", "$env:MSVC_VER"
6994
70- $script | Out-File build.vcxproj
71-
72- # Backup platform so it is not affected by vcvars
73- - cmd : SET PLATFORMBACK=%PLATFORM%
95+ $script = $script -replace "SDK_VER", "$env:WindowsSDKVersion"
7496
75- # Setup msvc environment for required compiler version (specified by MSVC_VER)
76- - ps : >-
77- if ($env:MSVC_VER -eq 15) {
78- $env:VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
79- } else {
80- $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:MSVC_VER" + "0COMNTOOLS"))
81- $env:VCVARS="%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat"
82- }
83-
84- - cmd : call "%VCVARS%" amd64
85-
86- # Reset platform
87- - cmd : SET PLATFORM=%PLATFORMBACK%
97+ $script | Out-File build.vcxproj
8898
8999# Set Targets path so that gitlink works correctly
90100- ps : $env:MSBUILDDIR=((Get-Command msbuild.exe).Path | Split-Path -parent)
0 commit comments