-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from brycehutchings/bryceh_nuget_gen_script
Script to build NuGet package from OpenXR-SDK Release
- Loading branch information
Showing
6 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>OpenXR.Loader</id> | ||
<version></version> | ||
<authors>Khronos Group</authors> | ||
<owners>Khronos Group</owners> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<license type="expression">Apache-2.0</license> | ||
<licenseUrl>https://licenses.nuget.org/Apache-2.0</licenseUrl> | ||
<projectUrl>https://github.com/KhronosGroup/OpenXR-SDK</projectUrl> | ||
<description>Khronos OpenXR loader and headers required to build a Win32 or UWP OpenXR application</description> | ||
<tags>native khronos openxr loader</tags> | ||
</metadata> | ||
</package> |
5 changes: 5 additions & 0 deletions
5
.azure-pipelines/nuget/NugetTemplate/build/native/OpenXR.Loader.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<OpenXRPackageRoot>$(MSBuildThisFileDirectory)..\..\</OpenXRPackageRoot> | ||
</PropertyGroup> | ||
</Project> |
38 changes: 38 additions & 0 deletions
38
.azure-pipelines/nuget/NugetTemplate/build/native/OpenXR.Loader.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Choose> | ||
<When Condition="'$(ApplicationType)|$(ApplicationTypeRevision)' == 'Windows Store|10.0'"> | ||
<PropertyGroup> | ||
<OpenXRLoaderBinaryRoot>$(OpenXRPackageRoot)native\$(Platform)_uwp\release</OpenXRLoaderBinaryRoot> | ||
</PropertyGroup> | ||
</When> | ||
<Otherwise> | ||
<PropertyGroup> | ||
<OpenXRLoaderBinaryRoot>$(OpenXRPackageRoot)native\$(Platform)\release</OpenXRLoaderBinaryRoot> | ||
</PropertyGroup> | ||
</Otherwise> | ||
</Choose> | ||
|
||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(OpenXRPackageRoot)include</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalDependencies>%(AdditionalDependencies);$(OpenXRLoaderBinaryRoot)\lib\openxr_loader.lib</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- Copy the OpenXR loader DLL to the output directory and include in packaging --> | ||
<ItemGroup Condition="'$(OpenXRSkipLoaderCopy)'!='true'"> | ||
<None Include="$(OpenXRLoaderBinaryRoot)\bin\openxr_loader.dll"> | ||
<Link>%(Filename)%(Extension)</Link> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<DeploymentContent>true</DeploymentContent> | ||
</None> | ||
</ItemGroup> | ||
|
||
<Target Name="EnsurePropsImported" BeforeTargets="PrepareForBuild"> | ||
<Error Condition="'$(OpenXRPackageRoot)'==''" Text="OpenXRPackageRoot property missing. Project is malformed. Try removing and re-adding the NuGet reference." /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
param( | ||
[Parameter(Mandatory=$true, HelpMessage="Path to unzipped openxr_loader_windows OpenXR-SDK release asset")] | ||
$SDKRelease, | ||
[Parameter(Mandatory=$true, HelpMessage="Path to specification Makefile. Needed to extract the version")] | ||
$SpecMakefile, | ||
[Parameter(Mandatory=$true, HelpMessage="Path create staged nuget directory layout")] | ||
$NugetStaging) | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
if (-Not (Test-Path $SDKRelease)) { | ||
Throw "SDK Release folder not found: $SDKRelease" | ||
} | ||
if (-Not (Test-Path $SpecMakefile)) { | ||
Throw "Specification makefile not found: $SpecMakefile" | ||
} | ||
|
||
$NugetTemplate = Join-Path $PSScriptRoot "NugetTemplate" | ||
|
||
if (Test-Path $NugetStaging) { | ||
Remove-Item $NugetStaging -Recurse | ||
} | ||
|
||
# | ||
# Extract version from Specification makefile | ||
# | ||
$VersionMatch = Select-String -Path $SpecMakefile -Pattern "^SPECREVISION\s*=\s*(.+)" | ||
$SDKVersion = $VersionMatch.Matches[0].Groups[1] | ||
|
||
# | ||
# Start off using the NuGet template. | ||
# | ||
echo "Copy-Item $NugetTemplate $NugetStaging -Recurse" | ||
Copy-Item $NugetTemplate $NugetStaging -Recurse | ||
|
||
# | ||
# Update the NuSpec | ||
# | ||
$NuSpecPath = Resolve-Path (Join-Path $NugetStaging "OpenXR.Loader.nuspec") | ||
$xml = [xml](Get-Content $NuSpecPath) | ||
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable) | ||
$nsm.AddNamespace("ng", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd") | ||
$xml.SelectSingleNode("/ng:package/ng:metadata/ng:version", $nsm).InnerText = $SDKVersion | ||
$xml.Save($NuSpecPath) | ||
|
||
# | ||
# Copy in the headers from the SDK release. | ||
# | ||
Copy-Item (Join-Path $SDKRelease "include") (Join-Path $NugetStaging "include") -Recurse | ||
|
||
# | ||
# Copy in the binaries from the SDK release. | ||
# | ||
function CopyLoader($Platform) | ||
{ | ||
$PlatformSDKPath = Join-Path $SDKRelease "$Platform" | ||
$NuGetPlatformPath = Join-Path $NugetStaging "native/$Platform/release" | ||
|
||
$NugetLibPath = Join-Path $NuGetPlatformPath "lib" | ||
New-Item $NugetLibPath -ItemType "directory" -Force | ||
Copy-Item (Join-Path $PlatformSDKPath "lib/openxr_loader.lib") $NugetLibPath | ||
|
||
$NugetBinPath = Join-Path $NuGetPlatformPath "bin" | ||
New-Item $NugetBinPath -ItemType "directory" -Force | ||
Copy-Item (Join-Path $PlatformSDKPath "bin/openxr_loader.dll") $NugetBinPath | ||
} | ||
|
||
# Currently there are no non-UWP ARM/ARM64 binaries available from the SDK release. | ||
CopyLoader "x64" | ||
CopyLoader "Win32" | ||
CopyLoader "x64_uwp" | ||
CopyLoader "Win32_uwp" | ||
CopyLoader "arm64_uwp" | ||
CopyLoader "arm_uwp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Modifications to Azure DevOps build pipeline to automatically generate a NuGet package. |