UnitTests: Delete output Sys folder before copying to it

Like the previous commit, but for UnitTests. This time all operating
systems were affected.

I also made UnitTests.vcxproj use the same way of copying as
DolphinQt.vcxproj, just for consistency.
This commit is contained in:
JosJuice 2024-08-15 20:28:23 +02:00
parent a62f8eac1a
commit f695a65aad
2 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,7 @@ set_target_properties(tests PROPERTIES FOLDER Tests)
target_link_libraries(tests PRIVATE fmt::fmt gtest::gtest core uicommon)
add_test(NAME tests COMMAND tests)
add_custom_command(TARGET tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
)
add_dependencies(unittests tests)

View File

@ -24,9 +24,6 @@
<Link>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>xcopy /i /e /s /y /f "$(ProjectDir)\..\..\Data\Sys\" "$(TargetDir)Sys"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Core\DSP\DSPTestBinary.h" />
@ -109,7 +106,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="ExecUnitTests" AfterTargets="AfterBuild;CopyDeps" Condition="'$(RunUnitTests)'=='true'">
<ItemGroup>
<DataSysFiles Include="$(DolphinRootDir)Data\**\Sys\**\*.*" />
</ItemGroup>
<Target Name="AfterBuild" Inputs="@(DataSysFiles)" Outputs="@(DataSysFiles -> '$(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')">
<Message Text="Copying Data directory..." Importance="High" />
<RemoveDir Directories="$(TargetDir)Sys" />
<Copy SourceFiles="@(DataSysFiles)" DestinationFolder="$(TargetDir)%(RecursiveDir)" SkipUnchangedFiles="True" />
</Target>
<Target Name="ExecUnitTests" AfterTargets="AfterBuild" Condition="'$(RunUnitTests)'=='true'">
<!--This is only executed via msbuild, VS test runner automatically does this-->
<Exec Command="$(TargetPath)" />
</Target>