我尝试用特拉维斯CI构建并为使用OpenCV的4.0我的程序运行测试。
我尝试这在我install
.travis.yml
文件部分:
install:
- sudo apt-get install -qq g++-7
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
# OpenCV dependencies - Details available at: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
- sudo apt-get install -y build-essential
- sudo apt-get install -y cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- sudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
- git clone https://github.com/opencv/opencv.git
- git clone https://github.com/opencv/opencv_contrib.git
- cd opencv
# Create a new 'build' folder.
- mkdir build
- cd build
# Set build instructions for Ubuntu distro.
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
# Run 'make' with four threads.
- make -j4
# Install to OS.
- sudo make install
# Add configuration to OpenCV to tell it where the library files are located on the file system (/usr/local/lib)
- sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
- sudo ldconfig
- echo "OpenCV installed."
但它给了我超时错误在make
的68%:The job exceeded the maximum time limit for jobs, and has been terminated.
有没有更好的对特拉维斯CI安装OpenCV的方式?
也许一些内置的机制?
或者,如果有一些方法来禁用此超时保护?
禁用BUILD_EXAMPLES,BUILD_TESTS和BUILD_PERF_TESTS
最后,我用这个命令在特拉维斯CI建设的OpenCV不会发生超时:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D BUILD_opencv_apps=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..