diff --git a/.travis.yml b/.travis.yml index bf67d415e..3f3f9de9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ env: before_install: # install needed deps - travis_retry sudo apt-get update -qq - - travis_retry sudo apt-get install -qq python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy + - travis_retry sudo apt-get install -qq python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev # Python 2 modules - travis_retry python2 -m pip install --user pytest==4.6.4 - travis_retry python2 -m pip install --user pylint diff --git a/cfg/opencv2.cfg b/cfg/opencv2.cfg new file mode 100644 index 000000000..e71d1b007 --- /dev/null +++ b/cfg/opencv2.cfg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + false + + + + + + + + + + + + false + + + + + + + + + + + + false + + + + + + + diff --git a/test/cfg/opencv2.cpp b/test/cfg/opencv2.cpp new file mode 100644 index 000000000..c6056f40b --- /dev/null +++ b/test/cfg/opencv2.cpp @@ -0,0 +1,35 @@ + +// Test library configuration for opencv2.cfg +// +// Usage: +// $ cppcheck --check-library --library=cairo --enable=information --error-exitcode=1 --inline-suppr --suppress=missingIncludeSystem test/cfg/opencv2.cpp +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +#include +#include + + +void validCode(char* argStr) +{ + cv::Mat image; + image = cv::imread(argStr, cv::IMREAD_COLOR); + if (!image.data) { + printf("No image data \n"); + return; + } + cv::namedWindow("Display Image", cv::WINDOW_AUTOSIZE); + cv::imshow("Display Image", image); + cv::waitKey(0); + + cv::String cvStr("Hello"); + cvStr += " World"; + std::cout << cvStr; +} + +void ignoredReturnValue() +{ + // cppcheck-suppress ignoredReturnValue + cv::imread("42.png"); +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index ba252b802..cc478ff7c 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -365,6 +365,33 @@ else fi ${CPPCHECK} ${CPPCHECK_OPT} --library=openssl ${DIR}openssl.c +# opencv2.cpp +set +e +pkg-config --version +PKGCONFIG_RETURNCODE=$? +set -e +if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then + echo "pkg-config needed to retrieve OpenCV configuration is not available, skipping syntax check." +else + set +e + OPENCVCONFIG=$(pkg-config --cflags opencv) + OPENCVCONFIG_RETURNCODE=$? + set -e + if [ $OPENCVCONFIG_RETURNCODE -eq 0 ]; then + set +e + echo -e "#include \n" | ${CXX} ${CXX_OPT} ${OPENCVCONFIG} -x c++ - + OPENCVCONFIG_RETURNCODE=$? + set -e + if [ $OPENCVCONFIG_RETURNCODE -ne 0 ]; then + echo "OpenCV not completely present or not working, skipping syntax check with ${CXX}." + else + echo "OpenCV found and working, checking syntax with ${CXX} now." + ${CXX} ${CXX_OPT} ${OPENCVCONFIG} ${DIR}opencv2.cpp + fi + fi +fi +${CPPCHECK} ${CPPCHECK_OPT} --library=opencv2 ${DIR}opencv2.cpp + # Check the syntax of the defines in the configuration files set +e xmlstarlet --version diff --git a/tools/donate_cpu_lib.py b/tools/donate_cpu_lib.py index c263e4f9e..14fac5b75 100644 --- a/tools/donate_cpu_lib.py +++ b/tools/donate_cpu_lib.py @@ -460,6 +460,7 @@ def get_libraries(): 'microsoft_sal': [''], 'motif': ['', '"prtypes.h"'], + # 'opencv2': ['', '', ''], 'openmp': [''], # 'openssl': ['