Another way to build opencv

update

add anchor
This commit is contained in:
LaurentBerger 2017-08-30 09:00:04 +02:00
parent 91ef0b9537
commit 3e9a659f4c

View File

@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
-# To finalize the installation go to the @ref tutorial_windows_install_path section.
Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
===============================================================
-# You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
-# You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
-# Run git-bash. You observe a command line window.
Suppose you want to build opencv and opencv_contrib in c:/lib
-# In git command line enter following command (if folder does not exist) :
@code{.bash}
mkdir /c/lib
cd /c/lib
@endcode
-# save this script with name installOCV.sh in c:/lib
@code{.bash}
#!/bin/bash -e
myRepo=$(pwd)
CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64"
if [ ! -d "$myRepo/opencv" ]; then
echo "clonning opencv"
git clone https://github.com/opencv/opencv.git
mkdir Build
mkdir Build/opencv
mkdir Install/opencv
else
cd opencv
git pull --rebase
cd ..
fi
if [ ! -d "$myRepo/opencv_contrib" ]; then
echo "clonning opencv_contrib"
git clone https://github.com/opencv/opencv_contrib.git
mkdir Build
mkdir Build/opencv_contrib
else
cd opencv_contrib
git pull --rebase
cd ..
fi
RepoSource=opencv
cd Build/$RepoSource
CMAKE_OPTIONS='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=ON'
cmake -G"$CMAKE_CONFIG_GENERATOR" $CMAKE_OPTIONS -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource"
echo "************************* $Source_DIR -->debug"
cmake --build . --config debug
echo "************************* $Source_DIR -->release"
cmake --build . --config release
cmake --build . --target install --config release
cmake --build . --target install --config debug
cd ..
@endcode
In this script I suppose you use VS 2015 in 64 bits
@code{.bash}
CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64"
@endcode
and opencv will be installed in c:/lib/install
@code{.bash}
-DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource"
@endcode
with no Perf tests, no tests, no doc, no CUDA and no example
@code{.bash}
CMAKE_OPTIONS='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF'
@endcode
-# In git command line enter following command :
@code{.bash}
./installOCV.sh
@endcode
-# Drink a coffee or two... opencv is ready : That's all!
-# Next time you run this script, opencv and opencv_contrib will be updated and rebuild
Installation by Making Your Own Libraries from the Source Files {#tutorial_windows_install_build}
===============================================================