Skip to content

Commit

Permalink
project: Update appveyor to build using latest available windows sdk.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Jul 1, 2017
1 parent 82af5db commit 6e7a695
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions SMP/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ install:
- cmd: choco install gitlink

before_build:
# Backup platform so it is not affected by vcvars
- cmd: SET PLATFORMBACK=%PLATFORM%

# Setup msvc environment for required compiler version (specified by MSVC_VER)
- ps: >-
if ($env:MSVC_VER -eq 15) {
$env:VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
} else {
$env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:MSVC_VER" + "0COMNTOOLS"))
$env:VCVARS="%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat"
}
- cmd: call "%VCVARS%" amd64

# Detect latest available windows sdk version
- ps: >-
if ($env:MSVC_VER -eq 12) {
$env:WindowsSDKVersion=8.1
} else {
$env:WindowsSDKVersion=$env:WindowsSDKVersion.TrimEnd('\')
}
# Reset platform
- cmd: SET PLATFORM=%PLATFORMBACK%

# Create build project to compile all configurations and platforms at once
- ps: >-
$script = @'
Expand All @@ -41,7 +66,7 @@ before_build:
</PropertyGroup>
<ItemGroup>
<ProjectToBuild Include="SMP/APPVEYOR_PROJECT_NAME.sln">
<Properties>Configuration=%(ConfigurationList.Identity);Platform=$(CurrentPlatform);OutDir=$(MSBuildThisFileDirectory)build_out\</Properties>
<Properties>Configuration=%(ConfigurationList.Identity);Platform=$(CurrentPlatform);OutDir=$(MSBuildThisFileDirectory)build_out\;WindowsTargetPlatformVersion=SDK_VER</Properties>
</ProjectToBuild>
</ItemGroup>
</Target>
Expand All @@ -52,7 +77,7 @@ before_build:
<PropertyGroup>
<CurrentPlatform>%(PlatformList.Identity)</CurrentPlatform>
</PropertyGroup>
<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"/>
<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"/>
</Target>
</Project>
Expand All @@ -67,24 +92,9 @@ before_build:
$script = $script -replace "APPVEYOR_MSVC_VER", "$env:MSVC_VER"
$script | Out-File build.vcxproj
# Backup platform so it is not affected by vcvars
- cmd: SET PLATFORMBACK=%PLATFORM%
$script = $script -replace "SDK_VER", "$env:WindowsSDKVersion"
# Setup msvc environment for required compiler version (specified by MSVC_VER)
- ps: >-
if ($env:MSVC_VER -eq 15) {
$env:VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
} else {
$env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:MSVC_VER" + "0COMNTOOLS"))
$env:VCVARS="%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat"
}
- cmd: call "%VCVARS%" amd64

# Reset platform
- cmd: SET PLATFORM=%PLATFORMBACK%
$script | Out-File build.vcxproj
# Set Targets path so that gitlink works correctly
- ps: $env:MSBUILDDIR=((Get-Command msbuild.exe).Path | Split-Path -parent)
Expand Down

0 comments on commit 6e7a695

Please sign in to comment.