Skip to content

Commit 3e9a659

Browse files
committed
Another way to build opencv
update add anchor
1 parent 91ef0b9 commit 3e9a659

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

doc/tutorials/introduction/windows_install/windows_install.markdown

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
2424

2525
-# To finalize the installation go to the @ref tutorial_windows_install_path section.
2626

27+
Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
28+
===============================================================
29+
30+
-# You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
31+
32+
-# You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
33+
34+
-# Run git-bash. You observe a command line window.
35+
Suppose you want to build opencv and opencv_contrib in c:/lib
36+
37+
-# In git command line enter following command (if folder does not exist) :
38+
@code{.bash}
39+
mkdir /c/lib
40+
cd /c/lib
41+
@endcode
42+
43+
-# save this script with name installOCV.sh in c:/lib
44+
@code{.bash}
45+
#!/bin/bash -e
46+
myRepo=$(pwd)
47+
CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64"
48+
if [ ! -d "$myRepo/opencv" ]; then
49+
echo "clonning opencv"
50+
git clone https://github.com/opencv/opencv.git
51+
mkdir Build
52+
mkdir Build/opencv
53+
mkdir Install/opencv
54+
else
55+
cd opencv
56+
git pull --rebase
57+
cd ..
58+
fi
59+
if [ ! -d "$myRepo/opencv_contrib" ]; then
60+
echo "clonning opencv_contrib"
61+
git clone https://github.com/opencv/opencv_contrib.git
62+
mkdir Build
63+
mkdir Build/opencv_contrib
64+
else
65+
cd opencv_contrib
66+
git pull --rebase
67+
cd ..
68+
fi
69+
RepoSource=opencv
70+
cd Build/$RepoSource
71+
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'
72+
cmake -G"$CMAKE_CONFIG_GENERATOR" $CMAKE_OPTIONS -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource"
73+
echo "************************* $Source_DIR -->debug"
74+
cmake --build . --config debug
75+
echo "************************* $Source_DIR -->release"
76+
cmake --build . --config release
77+
cmake --build . --target install --config release
78+
cmake --build . --target install --config debug
79+
cd ..
80+
@endcode
81+
In this script I suppose you use VS 2015 in 64 bits
82+
@code{.bash}
83+
CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64"
84+
@endcode
85+
and opencv will be installed in c:/lib/install
86+
@code{.bash}
87+
-DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource"
88+
@endcode
89+
with no Perf tests, no tests, no doc, no CUDA and no example
90+
@code{.bash}
91+
CMAKE_OPTIONS='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF'
92+
@endcode
93+
-# In git command line enter following command :
94+
@code{.bash}
95+
./installOCV.sh
96+
@endcode
97+
-# Drink a coffee or two... opencv is ready : That's all!
98+
-# Next time you run this script, opencv and opencv_contrib will be updated and rebuild
99+
100+
27101
Installation by Making Your Own Libraries from the Source Files {#tutorial_windows_install_build}
28102
===============================================================
29103

0 commit comments

Comments
 (0)