Merge pull request #7869 from alalek:icc

Build with ICC
This commit is contained in:
Alexander Alekhin 2016-12-15 19:21:18 +02:00 committed by GitHub
commit f7d956ea3e
4 changed files with 34 additions and 8 deletions

View File

@ -101,6 +101,10 @@ if(MINGW)
endif() endif()
endif() endif()
if(CV_ICC AND NOT ENABLE_FAST_MATH)
add_extra_compiler_option("-fp-model precise")
endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
# High level of warnings. # High level of warnings.
add_extra_compiler_option(-W) add_extra_compiler_option(-W)
@ -432,6 +436,13 @@ if(MSVC)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception' ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm' ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm'
endif() endif()
if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS)
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}")
endforeach()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qwd673") # PCH warning
endif()
endif() endif()
if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/usr/local/lib") if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/usr/local/lib")

View File

@ -302,6 +302,7 @@ macro(ocv_warnings_disable)
set(_flag_vars "") set(_flag_vars "")
set(_msvc_warnings "") set(_msvc_warnings "")
set(_gxx_warnings "") set(_gxx_warnings "")
set(_icc_warnings "")
foreach(arg ${ARGN}) foreach(arg ${ARGN})
if(arg MATCHES "^CMAKE_") if(arg MATCHES "^CMAKE_")
list(APPEND _flag_vars ${arg}) list(APPEND _flag_vars ${arg})
@ -309,6 +310,8 @@ macro(ocv_warnings_disable)
list(APPEND _msvc_warnings ${arg}) list(APPEND _msvc_warnings ${arg})
elseif(arg MATCHES "^-W") elseif(arg MATCHES "^-W")
list(APPEND _gxx_warnings ${arg}) list(APPEND _gxx_warnings ${arg})
elseif(arg MATCHES "^-wd" OR arg MATCHES "^-Qwd" OR arg MATCHES "^/Qwd")
list(APPEND _icc_warnings ${arg})
endif() endif()
endforeach() endforeach()
if(MSVC AND _msvc_warnings AND _flag_vars) if(MSVC AND _msvc_warnings AND _flag_vars)
@ -331,9 +334,25 @@ macro(ocv_warnings_disable)
endforeach() endforeach()
endforeach() endforeach()
endif() endif()
if(CV_ICC AND _icc_warnings AND _flag_vars)
foreach(var ${_flag_vars})
foreach(warning ${_icc_warnings})
if(UNIX)
string(REPLACE "-Qwd" "-wd" warning "${warning}")
else()
string(REPLACE "-wd" "-Qwd" warning "${warning}")
endif()
ocv_check_flag_support(${var} "${warning}" _varname)
if(${_varname})
set(${var} "${${var}} ${warning}")
endif()
endforeach()
endforeach()
endif()
unset(_flag_vars) unset(_flag_vars)
unset(_msvc_warnings) unset(_msvc_warnings)
unset(_gxx_warnings) unset(_gxx_warnings)
unset(_icc_warnings)
endif(NOT ENABLE_NOISY_WARNINGS) endif(NOT ENABLE_NOISY_WARNINGS)
endmacro() endmacro()

View File

@ -1,9 +1,5 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include <cmath> #include <cmath>
#ifndef NAN
#include <limits> // numeric_limits<T>::quiet_NaN()
#define NAN std::numeric_limits<float>::quiet_NaN()
#endif
using namespace cv; using namespace cv;
using namespace std; using namespace std;
@ -1895,7 +1891,7 @@ TEST(MinMaxLoc, regression_4955_nans)
cv::Mat one_mat(2, 2, CV_32F, cv::Scalar(1)); cv::Mat one_mat(2, 2, CV_32F, cv::Scalar(1));
cv::minMaxLoc(one_mat, NULL, NULL, NULL, NULL); cv::minMaxLoc(one_mat, NULL, NULL, NULL, NULL);
cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(NAN)); cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(std::numeric_limits<float>::quiet_NaN()));
cv::minMaxLoc(nan_mat, NULL, NULL, NULL, NULL); cv::minMaxLoc(nan_mat, NULL, NULL, NULL, NULL);
} }

View File

@ -1087,7 +1087,7 @@ void HOGDescriptorTester::detect(const Mat& img,
} }
const double eps = FLT_EPSILON * 100; const double eps = FLT_EPSILON * 100;
double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2); double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2 + NORM_RELATIVE);
if (diff_norm > eps) if (diff_norm > eps)
{ {
ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n" ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n"
@ -1167,7 +1167,7 @@ void HOGDescriptorTester::compute(InputArray _img, vector<float>& descriptors,
std::vector<float> actual_descriptors; std::vector<float> actual_descriptors;
actual_hog->compute(img, actual_descriptors, winStride, padding, locations); actual_hog->compute(img, actual_descriptors, winStride, padding, locations);
double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2); double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2 + NORM_RELATIVE);
const double eps = FLT_EPSILON * 100; const double eps = FLT_EPSILON * 100;
if (diff_norm > eps) if (diff_norm > eps)
{ {
@ -1316,7 +1316,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle
const double eps = FLT_EPSILON * 100; const double eps = FLT_EPSILON * 100;
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
{ {
double diff_norm = cvtest::norm(reference_mats[i], actual_mats[i], NORM_L2); double diff_norm = cvtest::norm(actual_mats[i], reference_mats[i], NORM_L2 + NORM_RELATIVE);
if (diff_norm > eps) if (diff_norm > eps)
{ {
ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n" ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n"