feat: Enhance Windows build and release workflows with packaging and validation for CUDA runtime libraries
Some checks failed
Build Windows Avalonia / build (push) Failing after 2m26s

This commit is contained in:
Maddo 2026-12-03 20:06:06 +01:00
commit a883daf068
4 changed files with 107 additions and 20 deletions

View file

@ -174,4 +174,59 @@
<Copy SourceFiles="@(LocalCudaInferenceLibraryForPublish)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="true" Condition="'@(LocalCudaInferenceLibraryForPublish)' != ''" />
</Target>
<Target Name="AssemblePackageCudaInferenceLibrariesToPublish" AfterTargets="Publish" Condition="'$(RuntimeIdentifier)' == 'win-x64' and '$(UseLocalAIFotoONLUS)' != 'true' and '$(PublishDir)' != ''">
<PropertyGroup>
<_CublasLtFragment0>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)ntvlibs.cuda11.cublaslt64_11.runtime.win-x64.f00/11.8.0/fragments/win-x64/native/cublasLt64_11.dll.f00'))</_CublasLtFragment0>
<_CublasLtFragment1>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)ntvlibs.cuda11.cublaslt64_11.runtime.win-x64.f01/11.8.0/fragments/win-x64/native/cublasLt64_11.dll.f01'))</_CublasLtFragment1>
<_CudnnCnnInferFragment0>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)ntvlibs.cudnn.cuda11.cudnn_cnn_infer64_8.runtime.win-x64.f00/8.9.7.29/fragments/win-x64/native/cudnn_cnn_infer64_8.dll.f00'))</_CudnnCnnInferFragment0>
<_CudnnCnnInferFragment1>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)ntvlibs.cudnn.cuda11.cudnn_cnn_infer64_8.runtime.win-x64.f01/8.9.7.29/fragments/win-x64/native/cudnn_cnn_infer64_8.dll.f01'))</_CudnnCnnInferFragment1>
<_CublasLtOutput>$([System.IO.Path]::GetFullPath('$(PublishDir)/cublasLt64_11.dll'))</_CublasLtOutput>
<_CudnnCnnInferOutput>$([System.IO.Path]::GetFullPath('$(PublishDir)/cudnn_cnn_infer64_8.dll'))</_CudnnCnnInferOutput>
</PropertyGroup>
<Error Condition="!Exists('$(_CublasLtFragment0)')" Text="Missing CUDA runtime fragment: $(_CublasLtFragment0)" />
<Error Condition="!Exists('$(_CublasLtFragment1)')" Text="Missing CUDA runtime fragment: $(_CublasLtFragment1)" />
<Error Condition="!Exists('$(_CudnnCnnInferFragment0)')" Text="Missing cuDNN runtime fragment: $(_CudnnCnnInferFragment0)" />
<Error Condition="!Exists('$(_CudnnCnnInferFragment1)')" Text="Missing cuDNN runtime fragment: $(_CudnnCnnInferFragment1)" />
<Exec Condition="$([MSBuild]::IsOsPlatform('Windows'))" Command="powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;$ErrorActionPreference='Stop'; function Join-Binary([string]$outFile, [string[]]$parts) { $stream = [System.IO.File]::Create($outFile); try { foreach ($part in $parts) { $input = [System.IO.File]::OpenRead($part); try { $input.CopyTo($stream) } finally { $input.Dispose() } } } finally { $stream.Dispose() } }; Join-Binary '$(_CublasLtOutput)' @('$(_CublasLtFragment0)', '$(_CublasLtFragment1)'); Join-Binary '$(_CudnnCnnInferOutput)' @('$(_CudnnCnnInferFragment0)', '$(_CudnnCnnInferFragment1)')&quot;" />
<Exec Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Command="cat &quot;$(_CublasLtFragment0)&quot; &quot;$(_CublasLtFragment1)&quot; &gt; &quot;$(_CublasLtOutput)&quot; &amp;&amp; cat &quot;$(_CudnnCnnInferFragment0)&quot; &quot;$(_CudnnCnnInferFragment1)&quot; &gt; &quot;$(_CudnnCnnInferOutput)&quot;" />
</Target>
<Target Name="ValidateWindowsCatalogPublishOutput">
<Error Condition="'$(PublishDir)' == ''" Text="PublishDir must be set before validating the Windows Catalog output." />
<PropertyGroup>
<_CatalogPublishDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)'))</_CatalogPublishDirectory>
<_OpenCvSharpRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'OpenCvSharpExtern.dll'))</_OpenCvSharpRuntimePath>
<_CublasRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cublas64_11.dll'))</_CublasRuntimePath>
<_CublasLtRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cublasLt64_11.dll'))</_CublasLtRuntimePath>
<_CudaRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cudart64_110.dll'))</_CudaRuntimePath>
<_CudnnRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cudnn64_8.dll'))</_CudnnRuntimePath>
<_CudnnOpsRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cudnn_ops_infer64_8.dll'))</_CudnnOpsRuntimePath>
<_CudnnAdvRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cudnn_adv_infer64_8.dll'))</_CudnnAdvRuntimePath>
<_CudnnCnnRuntimePath>$([System.IO.Path]::Combine('$(_CatalogPublishDirectory)', 'cudnn_cnn_infer64_8.dll'))</_CudnnCnnRuntimePath>
</PropertyGroup>
<ItemGroup>
<_CatalogPublishedExecutable Include="$(_CatalogPublishDirectory)/*.exe" />
</ItemGroup>
<Error Condition="!Exists('$(_CatalogPublishDirectory)')" Text="Windows Catalog publish directory does not exist: $(_CatalogPublishDirectory)" />
<Error Condition="'@(_CatalogPublishedExecutable)' == ''" Text="No Windows Catalog executable was found in $(_CatalogPublishDirectory)." />
<Error Condition="!Exists('$(_OpenCvSharpRuntimePath)')" Text="Required OpenCV runtime library is missing: $(_OpenCvSharpRuntimePath)" />
<Error Condition="!Exists('$(_CublasRuntimePath)')" Text="Required CUDA runtime library is missing: $(_CublasRuntimePath)" />
<Error Condition="!Exists('$(_CublasLtRuntimePath)')" Text="Required CUDA runtime library is missing: $(_CublasLtRuntimePath)" />
<Error Condition="!Exists('$(_CudaRuntimePath)')" Text="Required CUDA runtime library is missing: $(_CudaRuntimePath)" />
<Error Condition="!Exists('$(_CudnnRuntimePath)')" Text="Required cuDNN runtime library is missing: $(_CudnnRuntimePath)" />
<Error Condition="!Exists('$(_CudnnOpsRuntimePath)')" Text="Required cuDNN runtime library is missing: $(_CudnnOpsRuntimePath)" />
<Error Condition="!Exists('$(_CudnnAdvRuntimePath)')" Text="Required cuDNN runtime library is missing: $(_CudnnAdvRuntimePath)" />
<Error Condition="!Exists('$(_CudnnCnnRuntimePath)')" Text="Required cuDNN runtime library is missing: $(_CudnnCnnRuntimePath)" />
</Target>
<Target Name="PackageWindowsCatalogOutput" DependsOnTargets="ValidateWindowsCatalogPublishOutput">
<Error Condition="'$(PublishArchivePath)' == ''" Text="PublishArchivePath must be set before packaging the Windows Catalog output." />
<PropertyGroup>
<_CatalogPublishArchivePath Condition="'$(PublishArchivePath)' != ''">$([System.IO.Path]::GetFullPath('$(PublishArchivePath)'))</_CatalogPublishArchivePath>
</PropertyGroup>
<ZipDirectory SourceDirectory="$(_CatalogPublishDirectory)" DestinationFile="$(_CatalogPublishArchivePath)" Overwrite="true" />
</Target>
</Project>