forked from stride3d/stride
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStride.UnitTests.targets
93 lines (75 loc) · 5.85 KB
/
Stride.UnitTests.targets
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="StrideGraphicsApis">
<!--Import Unit Tests Local Settings for the solution being loaded -->
<Import Project="$(SolutionDir)$(SolutionName).UnitTests.Build.targets" Condition="Exists('$(SolutionDir)$(SolutionName).UnitTests.Build.targets')" />
<!-- Setup GraphicsApi (we do it even if StrideGraphicsApiDependent is not set to true, so that ProjectReference works) -->
<PropertyGroup>
<!-- Check if we have override -->
<StrideGraphicsApis Condition="'$(StrideGraphicsApisTest)' != ''">$(StrideGraphicsApisTest)</StrideGraphicsApis>
<!-- Build list of Graphics API for platform that supports multiple -->
<StrideGraphicsApis Condition="'$(StridePlatform)' == 'Windows' And '$(StrideGraphicsApiDependentBuildAll)' == 'true'">Direct3D11;Direct3D12;OpenGL;OpenGLES;Vulkan</StrideGraphicsApis>
<StrideGraphicsApis Condition="'$(StridePlatform)' == 'Windows' And '$(StrideGraphicsApis)' == ''">Direct3D11</StrideGraphicsApis>
<!-- Setup default GraphicsApi-->
<StrideGraphicsApi Condition="'$(StrideGraphicsApi)' == '' And '$(StrideGraphicsApis)' != ''">$(StrideGraphicsApis.Split(';', StringSplitOptions.RemoveEmptyEntries)[0])</StrideGraphicsApi>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)Stride.PackageVersion.targets"/>
<PropertyGroup>
<!-- Do not compile unit test when packaging -->
<StrideCompilerTargetsEnable Condition="'$(StrideSkipUnitTests)' == 'true'">false</StrideCompilerTargetsEnable>
<StrideCompilerTargetsEnable Condition="'$(StridePackageBuild)' == 'true'">false</StrideCompilerTargetsEnable>
<StrideCommonDependenciesDir></StrideCommonDependenciesDir>
<!-- Unit tests are executables (execute asset compiler, embed native libraries, etc... -->
<StrideIsExecutable>true</StrideIsExecutable>
<!-- Setup Asset Compiler MSBuild SolutionDir and SolutionName to point to Stride Windows
Also disable BuildProjectReferences, otherwise it would try to recompile assemblies currently locked by the CompilerApp itself.
However, that means that Tests dependencies must be compiled properly on Windows (should be the case usually).
-->
<StrideCompileAssetOptions>--compile-property:BuildProjectReferences=false</StrideCompileAssetOptions>
<!-- Workaround for solution dependencies with incompatible frameworks: https://github.com/Microsoft/msbuild/issues/2661#issuecomment-338808156 -->
<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies>
</PropertyGroup>
<PropertyGroup Condition="'$(StrideGraphicsApiDependent)' != 'true'">
<OutputPath>$(MSBuildThisFileDirectory)..\..\bin\Tests\$(AssemblyName)\$(StridePlatform)\</OutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(StridePlatform)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(StrideGraphicsApiDependent)' == 'true'">
<OutputPath>$(MSBuildThisFileDirectory)..\..\bin\Tests\$(AssemblyName)\$(StridePlatform)\$(StrideGraphicsApi)\</OutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(StridePlatform)-$(StrideGraphicsApi)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(StridePlatform)' == 'Windows'">
<StartupObject>xunit.runner.stride.Program</StartupObject>
</PropertyGroup>
<ItemGroup Condition="'$(StridePlatform)' == 'Windows'">
<Compile Condition="'$(StrideGraphicsApiDependent)' != 'true'" Include="$(MSBuildThisFileDirectory)..\shared\tests\xunit\LauncherSimple.Windows.cs">
<Link>LauncherSimple.Windows.cs</Link>
</Compile>
<Compile Condition="'$(StrideGraphicsApiDependent)' == 'true'" Include="$(MSBuildThisFileDirectory)..\shared\tests\xunit\LauncherSimple.Windows.cs">
<Link>LauncherGame.Windows.cs</Link>
</Compile>
</ItemGroup>
<!-- Used by Stride.build to detect if unit tests prefer to run in 32 or 64 bits -->
<Target Name="_StrideAfterGetTargetPathWithTargetPlatformMoniker" AfterTargets="GetTargetPathWithTargetPlatformMoniker">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Update="$(TargetPath)">
<PlatformTarget>$(PlatformTarget)</PlatformTarget>
</TargetPathWithTargetPlatformMoniker>
</ItemGroup>
</Target>
<!-- Make sure sdsl/sdfx are properly setup with code generator; also mark generated code file as dependent -->
<ItemGroup>
<Compile Update="**\*.sdsl.cs" DependentUpon="%(Filename)" />
<None Update="**\*.sdsl" Generator="StrideShaderKeyGenerator" />
<Compile Update="**\*.sdfx.cs" DependentUpon="%(Filename)" />
<None Update="**\*.sdfx" Generator="StrideEffectCodeGenerator" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="MSBuild.Sdk.Extras" Version="2.0.87" />
<Import Condition="'$(IsCrossTargetingBuild)' == 'true'" Project="$(MSBuildThisFileDirectory)Stride.UnitTests.CrossTargeting.targets"/>
<!-- Add Default targets used by Msbuild for undefined Platforms / or when skipping compilation under a platform -->
<Import Condition="'$(StrideCompilerTargetsEnable)' == 'false'" Project="$(MSBuildThisFileDirectory)Stride.UnitTests.DisableBuild.targets"/>
<!-- This needs to be after Sdk.targets -->
<Import Project="$(MSBuildThisFileDirectory)..\core\Stride.Core\build\Stride.Core.targets"/>
<Import Project="$(MSBuildThisFileDirectory)Stride.Core.RuntimeIdentifier.ProjectReference.targets"/>
<Import Project="$(MSBuildThisFileDirectory)Stride.GraphicsApi.PackageReference.targets"/>
<Import Project="$(MSBuildThisFileDirectory)Stride.GraphicsApi.Dev.targets"/>
<Import Condition="'$(StrideCompileAssets)' == 'true' And '$(StrideCompilerTargetsEnable)' != 'false'" Project="$(MSBuildThisFileDirectory)..\assets\Stride.Core.Assets.CompilerApp\build\Stride.Core.Assets.CompilerApp.targets"/>
</Project>