14

Building OpenCV 4.3.0 with Visual Studio 2019 Community

 3 years ago
source link: https://amin-ahmadi.com/2020/05/04/building-opencv-4-3-0-with-visual-studio-2019-community/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Building OpenCV 4.3.0 with Visual Studio 2019 Community

This is another one of those notes for myself which might be useful to you as well so I’m sharing it here. If you want to easily download and build OpenCV 4.3.0 with a simple PowerShell script, the this guide is for you.





The requirements are pretty straightforward:

  • PowerShell (latest version)
  • Visual Studio 2019 Community Edition
  • Python 3.x (Install latest version as part of Visual Studio)
  • numpy module for Python
  • CMake

Now, simply paste the following into a text file with ps1 extension and run it using PowerShell (as an Administrator):

$env:Path += ";C:\Tools\CMake_64\bin"
$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64"
$env:Path += "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\"
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell 534f7fd3

Set-Location "C:\some_build_folder"
git clone --branch 4.3.0 https://github.com/opencv/opencv.git
Set-Location opencv
mkdir build
Set-Location build

cmake ".." -G "Visual Studio 16 2019"

cmake --build "." --config Debug --target ALL_BUILD
cmake --build "." --config Release --target ALL_BUILD
cmake --build "." --config Debug --target INSTALL
cmake --build "." --config Release --target INSTALL

You can replace the cmake generator (Visual Studio 16 2019) with other generator types or replace OpenCV version number and reuse it with other projects as well.






About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK