Skip to content

Another way to build opencv#9514

Merged
opencv-pushbot merged 2 commits intoopencv:masterfrom
LaurentBerger:docInsWin
Aug 31, 2017
Merged

Another way to build opencv#9514
opencv-pushbot merged 2 commits intoopencv:masterfrom
LaurentBerger:docInsWin

Conversation

@LaurentBerger
Copy link
Copy Markdown
Contributor

Add another method to build opencv on windows using git-bash and cmake.

@vpisarev
Copy link
Copy Markdown
Contributor

@LaurentBerger, thank you for the contribution! @alalek, does it make sense to put this script to opencv/platforms?

@alalek
Copy link
Copy Markdown
Member

alalek commented Aug 30, 2017

to put this script to opencv/platforms

Probably no.
There are a lot of outdated/unused/broken scripts, so we should cleanup these scripts instead.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version>=2.14.1 here and above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

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'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optCMAKE => CMAKE_OPTIONS ?

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without cd .. above you can use . (dot) here:

cmake --build .  --config debug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

echo "************************* $Source_DIR -->release"
cmake --build $RepoSource --config release
cmake --build $RepoSource --target install --config release
cmake --build $RepoSource --target install --config debug
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--target install

Consider to use -DINSTALL_CREATE_DISTRIB=ON CMake option to prevent touching of global files (like Python module from Python subfolder)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

mkdir Build/opencv_contrib
else
cd opencv_contrib
git pull
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git pull --rebase
here and above

-# save this script with name installOCV.sh in c:/lib

@code{.bash}
myRepo=$(pwd)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add script header, something like:

#!/bin/bash -e

To stop script execution on errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

update

add anchor
cmake --build . --config release
cmake --build . --target install --config release
cmake --build . --target install --config debug
cd ..
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd ../.. should be here to be consistent.

Or use pushd/popd snippet:

-cd Build/$RepoSource
+pushd Build/$RepoSource
 ... cmake commands ...
-cd ..
+popd

@alalek
Copy link
Copy Markdown
Member

alalek commented Aug 31, 2017

@LaurentBerger Well done! Thank you 👍

@sturkmen72
Copy link
Copy Markdown
Contributor

what is your opininon also adding this link
http://www.learnopencv.com/install-opencv3-on-windows/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants