Files
freeswitch/w32/libsndfile.props
T

79 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<libsndfileImported>true</libsndfileImported>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="libsndfile-version.props" Condition=" '$(libsndfileVersionImported)' == '' "/>
<Import Project="downloadpackage.task" Condition=" '$(downloadpackagetask_Imported)' == '' " />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<!-- Upstream names its archives after the target word size, not after the
MSBuild platform: x64 -> win64, Win32 -> win32. -->
<libsndfileArch Condition=" '$(Platform.ToLower())' == 'x64' ">win64</libsndfileArch>
<libsndfileArch Condition=" '$(libsndfileArch)' == '' ">win32</libsndfileArch>
<libsndfileDir>$(BaseDir)libs\libsndfile-$(libsndfileVersion)-$(libsndfileArch)</libsndfileDir>
<libsndfilePkgBase>https://github.com/libsndfile/libsndfile/releases/download/$(libsndfileVersion)</libsndfilePkgBase>
</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
-->
<!-- One archive per platform holds the headers, the import lib and the DLL, so a
single download covers what used to take separate headers/binaries packages.
Upstream publishes Release builds only; they link the CRT statically and import
nothing but KERNEL32, so a Debug build can use the very same files.
archivecontains="binary" stops the task from looking for an inner tarball. -->
<Target Name="libsndfileDownloadTarget" BeforeTargets="CustomBuild;PreBuildEvent;" DependsOnTargets="7za">
<DownloadPackageTask
package="$(libsndfilePkgBase)/libsndfile-$(libsndfileVersion)-$(libsndfileArch).zip"
expectfileordirectory="$(libsndfileDir)\lib\sndfile.lib"
outputfolder=""
outputfilename=""
extractto="$(BaseDir)libs\"
archivecontains="binary"
/>
</Target>
<!-- Copy sndfile.dll next to the FreeSWITCH binary. SkipUnchangedFiles refreshes it
when the source differs, so bumping the version updates the output DLL instead
of leaving a stale one behind. -->
<Target Name="libsndfilecopyTarget" BeforeTargets="CustomBuild" DependsOnTargets="libsndfileDownloadTarget">
<ItemGroup>
<libsndfileFiles Include="$(libsndfileDir)\bin\sndfile.dll" />
</ItemGroup>
<Copy SkipUnchangedFiles="true"
SourceFiles="@(libsndfileFiles)"
DestinationFiles="@(libsndfileFiles->'$(BaseDir)$(Platform)\$(Configuration)\%(Filename)%(Extension)')"
/>
</Target>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(libsndfileDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(libsndfileDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>sndfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>