Another way to build opencv#9514
Another way to build opencv#9514opencv-pushbot merged 2 commits intoopencv:masterfrom LaurentBerger:docInsWin
Conversation
|
@LaurentBerger, thank you for the contribution! @alalek, does it make sense to put this script to |
Probably no. |
alalek
left a comment
There was a problem hiding this comment.
Thank you!
Please take a look on comments below.
|
|
||
| -# 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>=.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation |
| fi | ||
| RepoSource=opencv | ||
| cd Build/$RepoSource | ||
| optCMAKE='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF' |
| cmake -G"$CMAKE_CONFIG_GENERATOR" $optCMAKE -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource" | ||
| cd .. | ||
| echo "************************* $Source_DIR -->debug" | ||
| cmake --build $RepoSource --config debug |
There was a problem hiding this comment.
without cd .. above you can use . (dot) here:
cmake --build . --config debug
| echo "************************* $Source_DIR -->release" | ||
| cmake --build $RepoSource --config release | ||
| cmake --build $RepoSource --target install --config release | ||
| cmake --build $RepoSource --target install --config debug |
There was a problem hiding this comment.
--target install
Consider to use -DINSTALL_CREATE_DISTRIB=ON CMake option to prevent touching of global files (like Python module from Python subfolder)
| mkdir Build/opencv_contrib | ||
| else | ||
| cd opencv_contrib | ||
| git pull |
There was a problem hiding this comment.
git pull --rebase
here and above
| -# save this script with name installOCV.sh in c:/lib | ||
|
|
||
| @code{.bash} | ||
| myRepo=$(pwd) |
There was a problem hiding this comment.
Add script header, something like:
#!/bin/bash -e
To stop script execution on errors.
update add anchor
| cmake --build . --config release | ||
| cmake --build . --target install --config release | ||
| cmake --build . --target install --config debug | ||
| cd .. |
There was a problem hiding this comment.
cd ../.. should be here to be consistent.
Or use pushd/popd snippet:
-cd Build/$RepoSource
+pushd Build/$RepoSource
... cmake commands ...
-cd ..
+popd|
@LaurentBerger Well done! Thank you 👍 |
|
what is your opininon also adding this link |
Add another method to build opencv on windows using git-bash and cmake.