2
0

opencv.props 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. <opencvImported>true</opencvImported>
  5. </PropertyGroup>
  6. <ImportGroup Label="PropertySheets">
  7. <Import Project="opencv-version.props" Condition=" '$(opencvVersionImported)' == '' "/>
  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. <OpenCVLibraryFileName Condition=" '$(LibraryConfiguration)' == 'Debug' ">opencv_world341d</OpenCVLibraryFileName>
  14. <OpenCVLibraryFileName Condition=" '$(LibraryConfiguration)' == 'Release' ">opencv_world341</OpenCVLibraryFileName>
  15. </PropertyGroup>
  16. <PropertyGroup Label="UserMacros">
  17. <opencvLibDir>$(BaseDir)libs\opencv-$(opencvVersion)</opencvLibDir>
  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="opencvBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
  33. <DownloadPackageTask
  34. package="http://files.freeswitch.org/windows/packages/opencv/$(opencvVersion)/opencv-$(opencvVersion)-binaries-$(Platform.ToLower())-$(LibraryConfiguration.ToLower()).zip"
  35. expectfileordirectory="$(opencvLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\lib\$(OpenCVLibraryFileName).lib"
  36. outputfolder=""
  37. outputfilename=""
  38. extractto="$(BaseDir)libs\"
  39. />
  40. </Target>
  41. <Target Name="opencvHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
  42. <DownloadPackageTask
  43. package="http://files.freeswitch.org/windows/packages/opencv/$(opencvVersion)/opencv-$(opencvVersion)-headers.zip"
  44. expectfileordirectory="$(opencvLibDir)\include\opencv\cv.h"
  45. outputfolder=""
  46. outputfilename=""
  47. extractto="$(BaseDir)libs\"
  48. />
  49. </Target>
  50. <Target Name="opencvcopyTarget" BeforeTargets="CustomBuild" DependsOnTargets="opencvBinariesDownloadTarget">
  51. <ItemGroup>
  52. <opencvFiles Include="$(opencvLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\bin\*.dll" />
  53. </ItemGroup>
  54. <Copy Condition="!exists('$(BaseDir)$(Platform)\$(LibraryConfiguration)\$(OpenCVLibraryFileName).dll')"
  55. SourceFiles="@(opencvFiles)"
  56. DestinationFiles="@(opencvFiles->'$(BaseDir)$(Platform)\$(LibraryConfiguration)\%(Filename)%(Extension)')"
  57. />
  58. </Target>
  59. <ItemDefinitionGroup>
  60. <ClCompile>
  61. <AdditionalIncludeDirectories>$(opencvLibDir)\include\;$(opencvLibDir)\include\opencv\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  62. </ClCompile>
  63. <Link>
  64. <AdditionalLibraryDirectories>$(SolutionDir)libs\opencv-$(opencvVersion)\binaries\$(Platform)\$(LibraryConfiguration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
  65. <AdditionalDependencies>$(OpenCVLibraryFileName).lib;%(AdditionalDependencies)</AdditionalDependencies>
  66. </Link>
  67. </ItemDefinitionGroup>
  68. </Project>