<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
  <PropertyGroup>
    <ProjectGuid>{18D185EB-489A-4EF8-AA35-B7CA658543CC}</ProjectGuid>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <OutputType>Library</OutputType>
    <RootNamespace>BigIntegerArithmetics</RootNamespace>
    <AssemblyName>BigIntegerArithmetics</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <OutputPath>bin\Debug\</OutputPath>
    <DebugSymbols>True</DebugSymbols>
    <DebugType>Full</DebugType>
    <Optimize>False</Optimize>
    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <OutputPath>bin\Release\</OutputPath>
    <DebugSymbols>False</DebugSymbols>
    <DebugType>None</DebugType>
    <Optimize>True</Optimize>
    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
    <DefineConstants>TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup>
    <!-- Release -> SMath Release Manager -->
    <SMathDir Condition=" '$(SMathDir)' == '' AND '$(Configuration)' == 'Release' ">C:\Program Files (x86)\SMath Studio</SMathDir>
    <!-- Debug -> development -->
    <SMathDir Condition=" '$(SMathDir)' == '' AND '$(Configuration)' == 'Debug' ">C:\Program Files (x86)\SMath Studio</SMathDir>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>$(SMathDir)\SMathStudio_Desktop.exe</StartProgram>
    <Optimize>true</Optimize>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="PresentationBuildTasks" />
    <Reference Include="SMath.Controls">
      <HintPath>$(SMathDir)\SMath.Controls.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="SMath.Drawing">
      <HintPath>$(SMathDir)\SMath.Drawing.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="SMath.Environment">
      <HintPath>$(SMathDir)\SMath.Environment.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="SMath.Manager">
      <HintPath>$(SMathDir)\SMath.Manager.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="SMath.Math.Numeric">
      <HintPath>$(SMathDir)\SMath.Math.Numeric.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="SMath.Math.Symbolic">
      <HintPath>$(SMathDir)\SMath.Math.Symbolic.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Numerics">
      <HintPath>System\System.Numerics.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Implementer.cs" />
    <Compile Include="Primitives\bigMax.cs" />
    <Compile Include="Primitives\bigNeg.cs" />
    <Compile Include="Primitives\bigAbs.cs" />
    <Compile Include="Primitives\bigAdd.cs" />
    <Compile Include="Primitives\bigGCD.cs" />
    <Compile Include="Primitives\bigCmp.cs" />
    <Compile Include="Primitives\bigLog.cs" />
    <Compile Include="Primitives\bigLog10.cs" />
    <Compile Include="Primitives\bigMin.cs" />
    <Compile Include="Primitives\bigModPow.cs" />
    <Compile Include="Primitives\bigPow.cs" />
    <Compile Include="Primitives\bigSub.cs" />
    <Compile Include="Primitives\bigMul.cs" />
    <Compile Include="Primitives\bigDiv.cs" />
    <Compile Include="Primitives\bigMod.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="DeployExtension">
    <!-- copy anything from the build path to the SMath Studio extension path -->
    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
      <Output TaskParameter="Assemblies" ItemName="AssemblyInfo" />
    </GetAssemblyIdentity>
    <GetAssemblyIdentity AssemblyFiles="$(SMathDir)\SMath.Manager.dll">
      <Output TaskParameter="Assemblies" ItemName="ProgramInfo" />
    </GetAssemblyIdentity>
    <PropertyGroup>
      <ProgramVersion>%(ProgramInfo.Version)</ProgramVersion>
      <ConfigFileName>config.$(ProgramVersion.Replace(".", "_")).ini</ConfigFileName>
      <!-- SS portable -->
      <PluginPath Condition=" Exists('$(SMathDir)\portable.version') ">$(SMathDir)\extensions\plugins\$(ProjectGuid.TrimStart("{").TrimEnd("}"))</PluginPath>
      <!-- SS from installer -->
      <PluginPath Condition=" '$(PluginPath)' == '' ">$(APPDATA)\SMath\extensions\plugins\$(ProjectGuid.TrimStart("{").TrimEnd("}"))</PluginPath>
    </PropertyGroup>
    <ItemGroup>
      <BuildFiles Include="$(TargetDir)\*.*" />
      <ConfigFileContent Include="%(AssemblyInfo.Version)" />
      <!-- extension status (0: enabled; 2: disabled; 1: removed) -->
      <ConfigFileContent Include="0" />
      <!-- assembly filename -->
      <ConfigFileContent Include="$(TargetFileName)" />
    </ItemGroup>
    <!-- uncomment line below to keep clean the extension directory -->
    <!-- <RemoveDir Condition="'$(Configuration)' == 'Debug'" Directories="$(PluginPath)" /> -->
    <Copy SourceFiles="@(BuildFiles)" DestinationFolder="$(PluginPath)\%(AssemblyInfo.Version)" ContinueOnError="false" />
    <WriteLinesToFile File="$(PluginPath)\$(ConfigFileName)" Lines="@(ConfigFileContent)" Overwrite="true" />
  </Target>
  <Target Name="AfterBuild">
    <CallTarget Condition=" '$(Configuration)' == 'Debug' " Targets="DeployExtension" />
  </Target>
</Project>