mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
WinRT: added NuGet-package creation support to WinRT build script
This commit is contained in:
parent
74de09ad4e
commit
89898d8341
23
VisualC-WinRT/SDL2-WinRT.nuspec
Normal file
23
VisualC-WinRT/SDL2-WinRT.nuspec
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SDL2-WinRT</id>
|
||||
<version>2.0.4-Unofficial</version>
|
||||
<authors>Sam Lantinga</authors>
|
||||
<owners>David Ludwig</owners>
|
||||
<licenseUrl>http://libsdl.org/license.php</licenseUrl>
|
||||
<projectUrl>http://libsdl.org</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Unofficial pre-release of LibSDL2, built for WinRT platforms</description>
|
||||
<copyright>Copyright 2015</copyright>
|
||||
<tags>SDL2 SDL LibSDL OpenGL C C++ nativepackage</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="lib\**\*.dll" target="bin"/>
|
||||
<file src="lib\**\*.lib" target="bin"/>
|
||||
<file src="lib\**\*.pdb" target="bin"/>
|
||||
<file src="..\include\**\*.*" target="include"/>
|
||||
<file src="..\src\**\*.*" target="src"/>
|
||||
<file src="SDL2-WinRT.targets" target="build\native"/>
|
||||
</files>
|
||||
</package>
|
39
VisualC-WinRT/SDL2-WinRT.targets
Normal file
39
VisualC-WinRT/SDL2-WinRT.targets
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' == '8.0'">WinRT80</LibSDL2-DeviceType>
|
||||
<LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows' and '$(TargetPlatformVersion)' == '8.1'">WinRT81</LibSDL2-DeviceType>
|
||||
<LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'Windows Phone' and '$(TargetPlatformVersion)' == '8.0'">WinPhone80</LibSDL2-DeviceType>
|
||||
<LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' and '$(TargetPlatformVersion)' == '8.1'">WinPhone81</LibSDL2-DeviceType>
|
||||
<LibSDL2-DeviceType Condition="'$(TargetPlatformIdentifier)' == 'UAP'">UWP</LibSDL2-DeviceType>
|
||||
|
||||
<LibSDL2-BinPath>$(MSBuildThisFileDirectory)..\..\bin\$(LibSDL2-DeviceType)\$(Platform)</LibSDL2-BinPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="LibSDL2-DeviceType-Check" BeforeTargets="ResolveAssemblyReferences">
|
||||
<Error Condition="'$(LibSDL2-DeviceType)' == ''" Text="Unable to determine which version of Windows is being built-for" />
|
||||
</Target>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(LibSDL2-BinPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<ItemGroup Label="LibSDL2">
|
||||
<PackagingOutputs Include="$(LibSDL2-BinPath)\SDL2.dll">
|
||||
<OutputGroup>LibSDL2Binaries</OutputGroup>
|
||||
<ProjectName>$(ProjectName)</ProjectName>
|
||||
<TargetPath>%(Filename)%(Extension)</TargetPath>
|
||||
</PackagingOutputs>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
VisualC-WinRT/SDL2main-WinRT-CoreWindow.nuspec
Normal file
22
VisualC-WinRT/SDL2main-WinRT-CoreWindow.nuspec
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SDL2main-WinRT-CoreWindow</id>
|
||||
<version>2.0.4-Unofficial</version>
|
||||
<authors>Sam Lantinga</authors>
|
||||
<owners>David Ludwig</owners>
|
||||
<licenseUrl>http://libsdl.org/license.php</licenseUrl>
|
||||
<projectUrl>http://libsdl.org</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>WinMain() function for SDL2 + WinRT + CoreWindow (non-XAML) apps</description>
|
||||
<copyright>Copyright 2015</copyright>
|
||||
<tags>SDL2 SDL LibSDL OpenGL C C++ nativepackage</tags>
|
||||
<dependencies>
|
||||
<dependency id="SDL2-WinRT" version="2.0.4"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\src\main\winrt\SDL_winrt_main_NonXAML.cpp" target="src\main\winrt"/>
|
||||
<file src="SDL2main-WinRT-CoreWindow.targets" target="build\native"/>
|
||||
</files>
|
||||
</package>
|
10
VisualC-WinRT/SDL2main-WinRT-CoreWindow.targets
Normal file
10
VisualC-WinRT/SDL2main-WinRT-CoreWindow.targets
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<ItemGroup Label="LibSDL2">
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -38,6 +38,8 @@
|
||||
# "ARM", or "x64" (for 64-bit x86).
|
||||
#
|
||||
|
||||
# Base version of SDL, used for packaging purposes
|
||||
$SDLVersion = "2.0.4"
|
||||
|
||||
# Gets the .bat file that sets up an MSBuild environment, given one of
|
||||
# Visual Studio's, "PlatformToolset"s.
|
||||
@ -165,7 +167,7 @@ function Build-SDL-WinRT-Variant
|
||||
$VSProjectName = Get-VS-ProjectName $VSProjectPath
|
||||
|
||||
# Where to place output binaries (.dll, .lib, and .pdb files):
|
||||
$OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$PlatformToolset\$Platform"
|
||||
$OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
|
||||
# Where to place intermediate build files:
|
||||
$IntermediateDir = "$PSScriptRoot\..\VisualC-WinRT\obj\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
@ -206,35 +208,87 @@ function Build-SDL-WinRT-Variant
|
||||
#
|
||||
# Build each variant, with corresponding .dll, .lib, and .pdb files:
|
||||
#
|
||||
$DidAnyFail = $false
|
||||
$DidAnyDLLBuildFail = $false
|
||||
$DidAnyNugetBuildFail = $false
|
||||
|
||||
# Build for Windows Phone 8.0, via VC++ 2012:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows Phone 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 10, via VC++ 2015
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64")) { $DidAnyFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build NuGet packages, if possible
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build all variants. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
$NugetPath = (Get-Command -CommandType Application nuget.exe | %{$_.Path}) 2> $null
|
||||
if ("$NugetPath" -eq "") {
|
||||
Write-Warning -Message "Unable to find nuget.exe. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
Write-Host -ForegroundColor Cyan "Building SDL2 NuGet packages..."
|
||||
Write-Host -ForegroundColor Cyan "... via NuGet install: $NugetPath"
|
||||
$NugetOutputDir = "$PSScriptRoot\..\VisualC-WinRT\lib\nuget"
|
||||
Write-Host -ForegroundColor Cyan "... output directory: $NugetOutputDir"
|
||||
$SDLHGRevision = $($(hg log -l 1 | select-string "changeset") -Replace "changeset:\W*(\d+).*",'$1') 2>$null
|
||||
Write-Host -ForegroundColor Cyan "... HG Revision: $SDLHGRevision"
|
||||
|
||||
# Base options to nuget.exe
|
||||
$NugetOptions = @("pack", "PACKAGE_NAME_WILL_GO_HERE", "-Output", "$NugetOutputDir")
|
||||
|
||||
# Try attaching hg revision to NuGet package:
|
||||
$NugetOptions += "-Version"
|
||||
if ("$SDLHGRevision" -eq "") {
|
||||
Write-Warning -Message "Unable to find the Mercurial revision (maybe hg.exe can't be found?). NuGet packages will not have this attached to their name."
|
||||
$NugetOptions += "$SDLVersion-Unofficial"
|
||||
} else {
|
||||
$NugetOptions += "$SDLVersion.$SDLHGRevision-Unofficial"
|
||||
}
|
||||
|
||||
# Create NuGet output dir, if not yet created:
|
||||
if ($(Test-Path "$NugetOutputDir") -eq $false) {
|
||||
New-Item "$NugetOutputDir" -type directory
|
||||
}
|
||||
|
||||
# Package SDL2:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2-WinRT.nuspec"
|
||||
&"$NugetPath" $NugetOptions -Symbols
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
|
||||
# Package SDL2main:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2main-WinRT-CoreWindow.nuspec"
|
||||
&"$NugetPath" $NugetOptions
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Let the script's caller know whether or not any errors occurred.
|
||||
# Exit codes compatible with Buildbot are used (1 for error, 0 for success).
|
||||
if ($DidAnyFail -eq $true) {
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Error -Message "Unable to build all known variants of SDL2 for WinRT"
|
||||
exit 1
|
||||
} elseif ($DidAnyNugetBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build NuGet packages"
|
||||
exit 0 # Should NuGet package build failure lead to a non-failing result code instead?
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user