Skip to content
PimenovAlexander edited this page May 6, 2020 · 41 revisions

Instruction how to build a project

NOTE CoreCVS is in process of migration to cmake. New way of building is available at branch master_cmake. For the guide please see - CMakeBuild

Linux

Prerequisite

A word on prerequisites. Core of the project has no dependances and should work with C++14. Only prerequisite would be qmake. However if you only need core, you would have to comment out all the other sub-projects.

  • Get git
sudo apt-get install git
  • Clone the repository
mkdir student
cd student
git clone https://github.com/PimenovAlexander/corecvs.git .
  • Check if you have prerequisites installed (Qt should be Qt5)
sudo apt-get install qt5-default qt5-qmake gcc g++ 
sudo apt-get install libqt5serialport5-dev
  • Optional prerequisites. I recommend installing them, it they are avalibale they would be used autmomatically, in case you force them off in cvs-config.pri
sudo apt-get install libjpeg-dev libpng-dev
sudo apt-get install libopenblas-dev liblapacke-dev
  • Optional prerequisites. I recommend installing them, otherwise you will have to switch them off in cvs-config.pri file.

Ubuntu Xenial

 
sudo apt-get install libtbb-dev libcv-dev libhighgui-dev graphviz valgrind libxtst-dev
sudo apt-get install libavcodec-dev libavutil-dev libavformat-dev libswscale-dev

Ubuntu Cosmic 18.10

 
sudo apt-get install libtbb-dev libopencv-*3.* graphviz valgrind libxtst-dev
sudo apt-get install libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
sudo apt-get install libfftw3-dev libsoapysdr-dev
  • QScript If you get error with qscript module you can

    1. Add following packages
       sudo apt-get install qtscript-tools qtscript5-dev 
    2. Remove qscript from options i.e in cvs-config.pri comment out "with_qscript". After this you would need to clean and rebuild.
  • You will also need to either build Google Test (http://askubuntu.com/questions/145887/why-no-library-files-installed-for-google-test), or switch off all tests. Let's review your options

  1. Install gtest in the system (not ideal)
 
sudo apt-get install libgtest-dev cmake
cd /usr/src/gtest
sudo cmake .
sudo make
sudo mv libg* /usr/lib/
  1. Clone gtest inside our repo (recommended) So far it is not submodule for political reasons. You may do it submodule in your fork.
 
mkdir -P siblings
cd ./siblings
git clone https://github.com/google/googletest.git 
cp -r googletest/googletest gtest

Alternatively

 
cd ./siblings
./clone_gtest.sh

After this - cvs-open.pro would find it.

  1. Disable tests on cvs-open.pro (discouraged)
  • Configuration is stored in file cvs-config.pri. Please edit it according to how you want to build the project

Command Line Building

  • Enter the root directory of the code enter
qmake -r && make

Or on all cores

qmake -r && make -j

Third-party libraries

OpenCV

Currently we support OpenCV 3.X You could either build it yourself or install from repository - OpenCV guide

Tips for building with QtCreator

NB. Please switch shadow build off

cvs-config.pri

This file allows you to switch on and off several features of the build

  • with_sse - allow compiler and our code to use SSE
  • with_sse3
  • with_sse4
  • with_avx - allow compiler and our code to use AVX
  • with_avx2
  • with_tbb - try use TBB (Intel thread building blocks)
  • with_blas - try use BLAS (OpenBlas or MKL)
  • with_native - auto detect configuration

Dependency related. If there is a problem with a build try switching off dependences

  • with_ueye - add IDS UEye camera support
  • with_opencv - add openCV wrappers
  • with_avcodec - add AV Codec support for input (needs libavcodec-dev libavutil-dev)
  • with_qscript - switch off QScript support. Switch it off you rarely need it

Cleanup

There are sometimes cases when you need to clean the build directory to fix qmake errors

  1. Caution. Burn all non committed and not belonging to work copy to the ground.
git clean -dfx
  1. Use typical qmake clean procedure
make distclean
  1. Remove all Makefiles. This basically reverses call to "qmake -r"
find . -name "Makefile*" -delete
  1. Remove all objects and binaries
rm -rf ./bin/*
rm -rf ./.obj/*
  1. TLDR
make distclean
find . -name "Makefile*" -delete
rm -rf ./bin/*
rm -rf ./.obj/*

Clone this wiki locally