<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Globals">
    <ProjectGuid>{CA5CAD1A-082C-4476-9F33-94B339494076}</ProjectGuid>
    <ProjectName>Microsoft.Terminal.Settings.Model</ProjectName>
    <RootNamespace>Microsoft.Terminal.Settings.Model</RootNamespace>
    <!-- cppwinrt.build.pre.props depends on these settings: -->
    <!-- build a dll, not exe (Application) -->
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <SubSystem>Console</SubSystem>
    <!-- sets a bunch of Windows Universal properties -->
    <OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
    <PgoTarget>true</PgoTarget>
  </PropertyGroup>
  <Import Project="..\..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
  <Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
  <!-- ========================= XAML files ======================== -->
  <ItemGroup>
    <!-- DON'T PUT XAML FILES HERE! Put them in TerminalAppLib.vcxproj -->
  </ItemGroup>
  <!-- ========================= Headers ======================== -->
  <ItemGroup>
    <!-- Only put headers for winrt types in here. Don't put other header files
    in here - put them in the lib's vcxproj instead! -->
    <ClInclude Include="../ActionArgs.h" />
    <ClInclude Include="../ActionMap.h" />
    <ClInclude Include="../CascadiaSettings.h" />
    <ClInclude Include="../ColorScheme.h" />
    <ClInclude Include="../Command.h" />
    <ClInclude Include="../GlobalAppSettings.h" />
    <ClInclude Include="../KeyChordSerialization.h" />
    <ClInclude Include="../KeyMapping.h" />
    <ClInclude Include="../Profile.h" />
    <ClInclude Include="../TerminalWarnings.h" />
    <ClInclude Include="../IconPathConverter.h" />
  </ItemGroup>
  <!-- ========================= Cpp Files ======================== -->
  <!-- Don't put source files in here - put them in the lib's vcxproj instead! -->
  <!-- ========================= idl Files ======================== -->
  <ItemGroup>
    <!-- DON'T PUT IDL FILES HERE! Put them in the lib's vcxproj -->
  </ItemGroup>
  <!-- ========================= Misc Files ======================== -->
  <ItemGroup>
    <None Include="$(ProjectName).def" />
  </ItemGroup>
  <!-- ========================= Project References ======================== -->
  <ItemGroup>
    <!--
      the packaging project won't recurse through our dependencies, you have to
      make sure that if you add a cppwinrt dependency to any of these projects,
      you also update all the consumers
    -->
    <ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj">
      <Project>{18D09A24-8240-42D6-8CB6-236EEE820263}</Project>
    </ProjectReference>
    <ProjectReference Include="$(OpenConsoleDir)src\propslib\propslib.vcxproj">
      <Project>{345FD5A4-B32B-4F29-BD1C-B033BD2C35CC}</Project>
    </ProjectReference>
    <!-- The midl compiler however, _will_ aggregate our winmd dependencies
    somehow. So make sure to only include top-level dependencies here (don't
    include Settings and Connection, since Control will include them for us) -->
    <ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalConnection\TerminalConnection.vcxproj">
      <Private>false</Private>
    </ProjectReference>

    <ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalControl\dll\TerminalControl.vcxproj">
      <!-- Private:false and ReferenceOutputAssembly:false, in combination with
      the manual reference to TerminalControl.winmd below make sure that this
      project will compile correct, and that we won't roll up the TermControl
      xbf's into the packaging project twice. -->
      <Private>true</Private>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>

    <!-- Reference Microsoft.Terminal.Settings.ModelLib here, so we can use it's winmd as
    our winmd. This didn't work correctly in VS2017, you'd need to
    manually reference the lib -->
    <ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalSettingsModel\Microsoft.Terminal.Settings.ModelLib.vcxproj">
      <Private>true</Private>
    </ProjectReference>
  </ItemGroup>

  <ItemGroup>
    <!-- Manually add a reference to TerminalControl here. We need this so
    MDMERGE will know where the TermControl types are defined. However, we need
    to do it exactly like this so the packaging project won't roll up
    TermControl's .xbf's from both the TermControl project and this one. -->
    <Reference Include="Microsoft.Terminal.Control">
      <HintPath>$(OpenConsoleCommonOutDir)Microsoft.Terminal.Control\Microsoft.Terminal.Control.winmd</HintPath>
      <IsWinMDFile>true</IsWinMDFile>
      <Private>false</Private>
      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
    </Reference>

    <Reference Include="Microsoft.Terminal.Core">
      <HintPath>$(OpenConsoleCommonOutDir)TerminalCore\Microsoft.Terminal.Core.winmd</HintPath>
      <IsWinMDFile>true</IsWinMDFile>
      <Private>false</Private>
      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
    </Reference>
  </ItemGroup>

  <Import Project="$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
  </Target>

  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>$(OpenConsoleDir)\dep\jsoncpp\json;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <AdditionalDependencies>User32.lib;WindowsApp.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <!-- TSM Lib contains a DllMain that we need to force the use of. -->
      <AdditionalOptions Condition="'$(Platform)'=='Win32'">/INCLUDE:_DllMain@12 %(AdditionalOptions)</AdditionalOptions>
      <AdditionalOptions Condition="'$(Platform)'!='Win32'">/INCLUDE:DllMain %(AdditionalOptions)</AdditionalOptions>
    </Link>
    <Reference>
      <!-- Do not propagate microsoft.ui.xaml upwards as a private dependency. -->
      <Private>false</Private>
    </Reference>
  </ItemDefinitionGroup>
  <Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
</Project>
