zlib.props 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3. <PropertyGroup>
  4. <zlibImported>true</zlibImported>
  5. </PropertyGroup>
  6. <ImportGroup Label="PropertySheets">
  7. <Import Project="zlib-version.props" Condition=" '$(zlibVersionImported)' == '' "/>
  8. <Import Project="downloadpackage.task" Condition=" '$(downloadpackagetask_Imported)' == '' " />
  9. </ImportGroup>
  10. <PropertyGroup>
  11. <LibraryConfiguration Condition="$(Configuration.ToLower().Contains('debug'))">Debug</LibraryConfiguration>
  12. <LibraryConfiguration Condition="$(Configuration.ToLower().Contains('release'))">Release</LibraryConfiguration>
  13. <LibraryFileName Condition=" '$(LibraryConfiguration)' == 'Debug' ">zlibd</LibraryFileName>
  14. <LibraryFileName Condition=" '$(LibraryConfiguration)' == 'Release' ">zlib</LibraryFileName>
  15. </PropertyGroup>
  16. <PropertyGroup Label="UserMacros">
  17. <zlibLibDir>$(BaseDir)libs\zlib-$(zlibVersion)</zlibLibDir>
  18. </PropertyGroup>
  19. <!--
  20. Download Target.
  21. Name must be unique.
  22. By design, targets are executed only once per project.
  23. Usage:
  24. package: URI
  25. expectfileordirectory: Skips the download and extraction if exists
  26. outputfolder: Folder to store a downloaded file.
  27. By default "$(BaseDir)libs", if empty
  28. outputfilename: If not empty, overrides filename from URI.
  29. .exe files don't get extracted
  30. extractto: Folder to extract an archive to
  31. -->
  32. <Target Name="zlibBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
  33. <DownloadPackageTask
  34. package="http://files.freeswitch.org/windows/packages/zlib/$(zlibVersion)/zlib-$(zlibVersion)-binaries-$(Platform.ToLower())-$(LibraryConfiguration.ToLower()).zip"
  35. expectfileordirectory="$(zlibLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\lib\$(LibraryFileName).lib"
  36. outputfolder=""
  37. outputfilename=""
  38. extractto="$(BaseDir)libs\"
  39. />
  40. </Target>
  41. <Target Name="zlibHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
  42. <DownloadPackageTask
  43. package="http://files.freeswitch.org/windows/packages/zlib/$(zlibVersion)/zlib-$(zlibVersion)-headers.zip"
  44. expectfileordirectory="$(zlibLibDir)\include\zlib.h"
  45. outputfolder=""
  46. outputfilename=""
  47. extractto="$(BaseDir)libs\"
  48. />
  49. </Target>
  50. <Target Name="zlibcopyTarget" BeforeTargets="CustomBuild" DependsOnTargets="zlibBinariesDownloadTarget">
  51. <ItemGroup>
  52. <zlibFiles Include="$(zlibLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\bin\*.dll" />
  53. </ItemGroup>
  54. <Copy Condition="!exists('$(BaseDir)$(Platform)\$(LibraryConfiguration)\$(LibraryFileName).dll')"
  55. SourceFiles="@(zlibFiles)"
  56. DestinationFiles="@(zlibFiles->'$(BaseDir)$(Platform)\$(LibraryConfiguration)\%(Filename)%(Extension)')"
  57. />
  58. </Target>
  59. <ItemDefinitionGroup>
  60. <ClCompile>
  61. <AdditionalIncludeDirectories>$(SolutionDir)libs\zlib-$(zlibVersion)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  62. <PreprocessorDefinitions>HAVE_ZLIB;ZLIB_STATICLIB;Z_SOLO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  63. </ClCompile>
  64. <Link>
  65. <AdditionalLibraryDirectories>$(SolutionDir)libs\zlib-$(zlibVersion)\binaries\$(Platform)\$(LibraryConfiguration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
  66. <AdditionalDependencies>$(LibraryFileName).lib;%(AdditionalDependencies)</AdditionalDependencies>
  67. </Link>
  68. </ItemDefinitionGroup>
  69. </Project>