-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
77 lines (65 loc) · 3.98 KB
/
Directory.Build.targets
File metadata and controls
77 lines (65 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Default flags (defensive) - preserve values set by Directory.Build.props in subfolders -->
<PropertyGroup>
<SkipVeldrid Condition="'$(SkipVeldrid)' == ''">false</SkipVeldrid>
<NoPackageVeldrid Condition="'$(NoPackageVeldrid)' == ''">false</NoPackageVeldrid>
<!-- Only enable PackageVeldrid by default for non-Library projects -->
<PackageVeldrid Condition="'$(PackageVeldrid)' == '' and '$(OutputType)' != 'Library'">true</PackageVeldrid>
<PackageVeldrid Condition="'$(PackageVeldrid)' == ''">false</PackageVeldrid>
<!-- Compute the expected native file path for Veldrid SPIRV. -->
<_VeldridNativePath>$(NuGetPackageRoot)veldrid.spirv\$(VeldridSpirvVersion)\runtimes\$(RuntimeID)\native\$(VeldridSpirvNativeName)</_VeldridNativePath>
</PropertyGroup>
<Target Name="RemoveSupportDirectories" BeforeTargets="Clean">
<RemoveDir Directories="$(OutputPath)lib"/>
<RemoveDir Directories="$(OutputPath)shaders"/>
</Target>
<!-- Diagnostics so we can see which projects have which flags when running CI -->
<Target Name="DisplayVeldridFlags" BeforeTargets="CopyVeldridSpirvNative;CopyShaders">
<Message Importance="high" Text="--- Veldrid flags for project: $(MSBuildProjectName) ---"/>
<Message Text="Project Dir = $(MSBuildProjectDirectory)"/>
<Message Text="OutputType = $(OutputType)"/>
<Message Text="PackageVeldrid = $(PackageVeldrid)"/>
<Message Text="NoPackageVeldrid = $(NoPackageVeldrid)"/>
<Message Text="SkipVeldrid = $(SkipVeldrid)"/>
<Message Text="Veldrid native path = $(_VeldridNativePath)"/>
<Message Text="Configuration = $(Configuration)"/>
<Message Text="OutputPath = $(OutputPath)"/>
<Message Importance="high" Text="---------------------------------------------"/>
</Target>
<Target Name="SetPaths" AfterTargets="Build" BeforeTargets="CopyVeldridSpirvNative">
<PropertyGroup>
<UsingMacAppBundle>false</UsingMacAppBundle>
<UsingMacAppBundle Condition="$(BuildOS) == 'macOS' AND $(OutputAppPath) != ''">true</UsingMacAppBundle>
<NeatenizePath>$(OutputPath)</NeatenizePath>
<NeatenizePath Condition="$(UsingMacAppBundle) AND $(MacBundleMono) == false">$(OutputAppPath)\Contents\MonoBundle\</NeatenizePath>
</PropertyGroup>
</Target>
<!-- Guarded copy: only when Veldrid packaging is enabled AND the native file actually exists. -->
<Target Name="CopyVeldridSpirvNative" AfterTargets="SetPaths" BeforeTargets="Cleanup"
Condition="'$(SkipVeldrid)' != 'true' and '$(PackageVeldrid)' == 'true' and '$(NoPackageVeldrid)' != 'true' and Exists('$(_VeldridNativePath)')">
<Copy
SourceFiles="$(_VeldridNativePath)"
DestinationFolder="$(OutputPath)"/>
</Target>
<Target Name="Cleanup" AfterTargets="SetPaths" Condition="$(Configuration.Contains('Release'))">
<ItemGroup>
<_DelItems3 Include="$(OutputPath)*.xml"/>
<_DelItems4 Include="$(OutputPath)*.pdb"/>
</ItemGroup>
<Delete Files="@(_DelItems3)"/>
<Delete Files="@(_DelItems4)"/>
</Target>
<Target Name="CopyShaders" AfterTargets="Cleanup"
Condition="'$(SkipVeldrid)' != 'true' and '$(PackageVeldrid)' == 'true' and '$(NoPackageVeldrid)' != 'true' and Exists('$(TopLevelDirectory)..\\DesignLibs_GPL\\Eto\\shaders')">
<ItemGroup>
<Shaders Include="$(TopLevelDirectory)..\DesignLibs_GPL\Eto\shaders\**\*"/>
</ItemGroup>
<Copy Condition="$(OutputAppPath) != ''" SourceFiles="@(Shaders)" DestinationFolder="$(OutputAppPath)\Contents\Resources\shaders\%(Shaders.RecursiveDir)"/>
<Copy Condition="$(OutputAppPath) == ''" SourceFiles="@(Shaders)" DestinationFolder="$(OutputPath)\shaders\%(Shaders.RecursiveDir)"/>
</Target>
<Target Name="DisplayMessages" BeforeTargets="Build">
<Message Importance="High" Text="Project Name = $(MSBuildProjectName)"/>
<Message Text="Project File Name = $(MSBuildProjectFile)"/>
<Message Text="Project Extension = $(MSBuildProjectExtension)"/>
</Target>
</Project>