<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectGuid>{C323DAEE-B307-4C7B-ACE5-7293CBEFCB5B}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>ControlUnitTests</RootNamespace>
    <ProjectName>UnitTests_Control</ProjectName>
    <TargetName>Control.Unit.Tests</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <OpenConsoleCppWinRTProject>true</OpenConsoleCppWinRTProject>
  </PropertyGroup>

  <PropertyGroup Label="NuGet Dependencies">
    <TerminalCppWinrt>true</TerminalCppWinrt>
    <TerminalMUX>true</TerminalMUX>
  </PropertyGroup>

  <Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
  <Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
  <Import Project="$(OpenConsoleDir)\src\cppwinrt.build.pre.props" />

  <!-- ========================= Headers ======================== -->
  <ItemGroup>
    <ClInclude Include="pch.h" />
    <ClInclude Include="MockControlSettings.h" />
    <ClInclude Include="MockConnection.h" />
  </ItemGroup>

  <!-- ========================= Cpp Files ======================== -->
  <ItemGroup>
    <ClCompile Include="ControlCoreTests.cpp" />
    <ClCompile Include="ControlInteractivityTests.cpp" />
    <ClCompile Include="pch.cpp">
      <PrecompiledHeader>Create</PrecompiledHeader>
    </ClCompile>
  </ItemGroup>

  <!-- ========================= Project References ======================== -->
  <ItemGroup>

    <ProjectReference Include="$(OpenConsoleDir)src\buffer\out\lib\bufferout.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\renderer\base\lib\base.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\renderer\dx\lib\dx.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\renderer\uia\lib\uia.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\terminal\parser\lib\parser.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\terminal\input\lib\terminalinput.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalCore\lib\TerminalCore-lib.vcxproj" />

    <ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalControl\TerminalControlLib.vcxproj" />
    <ProjectReference Include="$(OpenConsoleDir)\src\types\lib\types.vcxproj" />

  </ItemGroup>

  <ItemGroup>
    <Reference Include="Microsoft.Terminal.TerminalConnection">
      <HintPath>$(OpenConsoleCommonOutDir)TerminalConnection\Microsoft.Terminal.TerminalConnection.winmd</HintPath>
      <IsWinMDFile>true</IsWinMDFile>
      <Private>false</Private>
      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
    </Reference>
  </ItemGroup>
  <!-- ========================= Globals ======================== -->

  <!-- ====================== Compiler & Linker Flags ===================== -->
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>$(OpenConsoleDir)src\inc;$(OpenConsoleDir)src\cascadia\inc;$(OpenConsoleDir)src\inc\test;$(WinRT_IncludePath)\..\cppwinrt\winrt;"$(OpenConsoleDir)\src\cascadia\TerminalControl\Generated Files";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>

      <!-- Manually disable unreachable code warning, because jconcpp has a ton of that. -->
      <DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <Link>
      <AdditionalDependencies>onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <!--
      ControlLib contains a DllMain that we need to force the use of.
      If you don't have this, then you'll see an error like
      "(init.obj) : error LNK2005: DllMain already defined in MSVCRTD.lib(dll_dllmain_stub.obj)"
      -->
      <AdditionalOptions Condition="'$(Platform)'=='Win32'">/INCLUDE:_DllMain@12</AdditionalOptions>
      <AdditionalOptions Condition="'$(Platform)'!='Win32'">/INCLUDE:DllMain</AdditionalOptions>
    </Link>
  </ItemDefinitionGroup>

  <PropertyGroup>
    <GenerateManifest>true</GenerateManifest>
    <EmbedManifest>true</EmbedManifest>
  </PropertyGroup>

  <!-- Careful reordering these. Some default props (contained in these files) are order sensitive. -->
  <Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
  <Import Project="$(OpenConsoleDir)src\common.build.tests.props" />

  <!-- This -must- go after cppwinrt.build.post.props because that includes many VS-provided props including appcontainer.common.props, which stomps on what cppwinrt.targets did. -->
  <Import Project="$(OpenConsoleDir)src\common.nugetversions.targets" />

</Project>
