<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
    <Import Project="downloadpackage.task" Condition=" '$(downloadpackagetask_Imported)' == '' " />
  </ImportGroup>
  <PropertyGroup>
    <YasmPropsImported>true</YasmPropsImported>
    <Is64yasm Condition="$([System.Environment]::Is64BitProcess)">true</Is64yasm>
    <PackageToDownload Condition="'$(Is64yasm)' == 'true'">http://files.freeswitch.org/downloads/win64/yasm.exe</PackageToDownload>
    <PackageToDownload Condition="'$(Is64yasm)' != 'true'">http://files.freeswitch.org/downloads/win32/yasm.exe</PackageToDownload>
  </PropertyGroup>

  <!--
       Download Target.
       Name must be unique.
       By design, targets are executed only once per project.

       Usage:

       package: URI

       expectfileordirectory: Skips the download and extraction if exists

       outputfolder: Folder to store a downloaded file.
                     By default "$(BaseDir)libs", if empty

       outputfilename: If not empty, overrides filename from URI.
                       .exe files don't get extracted

       extractto: Folder to extract an archive to
   -->

  <Target Name="YasmDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="">
      <Message Text="System is 64 bit." Condition="'$(Is64yasm)' == 'true'" Importance="High" />
      <DownloadPackageTask
           package="$(PackageToDownload)"
           expectfileordirectory="$(ProjectDir)\yasm.exe"
           outputfolder="$(ProjectDir)\"
           outputfilename=""
           extractto=""
      />
  </Target>

</Project>