From c105b72945013b1cecb00617879598c43b82f298 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Sun, 21 Dec 2014 17:59:50 +0300 Subject: [PATCH] Assorted fixes: * cmake CMP0054 and CMP0045 * aarch64 build * portable code options in PCH cmake * some of gcc 4.9 warnings --- 3rdparty/.gitignore | 1 + 3rdparty/libpng/CMakeLists.txt | 2 +- cmake/OpenCVModule.cmake | 8 ++++---- cmake/OpenCVPCHSupport.cmake | 19 +++++++++---------- cmake/OpenCVUtils.cmake | 4 ++-- .../core/include/opencv2/core/internal.hpp | 2 +- modules/core/src/cmdparser.cpp | 2 ++ modules/flann/include/opencv2/flann/dist.h | 4 ++-- modules/highgui/src/grfmt_tiff.cpp | 3 +++ modules/ts/misc/run.py | 2 +- modules/video/test/test_tvl1optflow.cpp | 2 ++ 11 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 3rdparty/.gitignore diff --git a/3rdparty/.gitignore b/3rdparty/.gitignore new file mode 100644 index 0000000000..87e933d8b4 --- /dev/null +++ b/3rdparty/.gitignore @@ -0,0 +1 @@ +ippicv \ No newline at end of file diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 8d3d5f4976..1b2dddd0d7 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -14,7 +14,7 @@ ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR}) file(GLOB lib_srcs *.c) file(GLOB lib_hdrs *.h) -if(NEON) +if(NEON AND CMAKE_SIZEOF_VOID_P EQUAL 4) list(APPEND lib_srcs arm/filter_neon.S) add_definitions(-DPNG_ARM_NEON) endif() diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 92dbdec3fc..b277c1ad4b 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -707,7 +707,7 @@ macro(__ocv_parse_test_sources tests_type) set(__file_group_sources "") elseif(arg STREQUAL "DEPENDS_ON") set(__currentvar "OPENCV_TEST_${the_module}_DEPS") - elseif("${__currentvar}" STREQUAL "__file_group_sources" AND NOT __file_group_name) + elseif(" ${__currentvar}" STREQUAL " __file_group_sources" AND NOT __file_group_name) # spaces to avoid CMP0054 set(__file_group_name "${arg}") else() list(APPEND ${__currentvar} "${arg}") @@ -925,7 +925,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind) if(__resolved_deps MATCHES "(^|;)${__rdep}(;|$)") #all dependencies of this module are already resolved list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${__dep}") - else() + elseif(TARGET ${__dep}) get_target_property(__module_type ${__dep} TYPE) if(__module_type STREQUAL "STATIC_LIBRARY") if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind}) @@ -933,9 +933,9 @@ macro(__ocv_track_module_link_dependencies the_module optkind) endif() list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep}) list(APPEND __resolved_deps "${__dep}") - elseif(NOT __module_type) - list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}") endif() + else() + list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}") endif() #else() # get_target_property(__dep_location "${__dep}" LOCATION) diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake index 8b07f30449..a7f8198140 100644 --- a/cmake/OpenCVPCHSupport.cmake +++ b/cmake/OpenCVPCHSupport.cmake @@ -41,16 +41,15 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) SET(${_out_compile_flags} ${${_flags_var_name}} ) - IF(CMAKE_COMPILER_IS_GNUCXX) - - GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) - IF(${_targetType} STREQUAL SHARED_LIBRARY AND NOT WIN32) - LIST(APPEND ${_out_compile_flags} "-fPIC") - ENDIF() - - ELSE() - ## TODO ... ? or does it work out of the box - ENDIF() + GET_TARGET_PROPERTY(_targetPIC ${_PCH_current_target} POSITION_INDEPENDENT_CODE) + if (_targetPIC AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + LIST(APPEND ${_out_compile_flags} "${CMAKE_CXX_COMPILE_OPTIONS_PIC}") + elseif(CMAKE_COMPILER_IS_GNUCXX) + GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) + IF(${_targetType} STREQUAL SHARED_LIBRARY AND NOT WIN32) + LIST(APPEND ${_out_compile_flags} "-fPIC") + ENDIF() + endif() GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) FOREACH(item ${DIRINC}) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 9fa94bb8bd..4a33f3acdf 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -200,12 +200,12 @@ macro(OCV_OPTION variable description value) endif() endforeach() unset(__varname) - if("${__condition}" STREQUAL "") + if(__condition STREQUAL "") set(__condition 2 GREATER 1) endif() if(${__condition}) - if("${__value}" MATCHES ";") + if(__value MATCHES ";") if(${__value}) option(${variable} "${description}" ON) else() diff --git a/modules/core/include/opencv2/core/internal.hpp b/modules/core/include/opencv2/core/internal.hpp index 9959c169ac..c2c89613ac 100644 --- a/modules/core/include/opencv2/core/internal.hpp +++ b/modules/core/include/opencv2/core/internal.hpp @@ -153,7 +153,7 @@ CV_INLINE IppiSize ippiSize(const cv::Size & _size) # include "arm_neon.h" # define CV_NEON 1 # define CPU_HAS_NEON_FEATURE (true) -#elif defined(__ARM_NEON__) +#elif defined(__ARM_NEON__) || defined(__ARM_NEON) # include # define CV_NEON 1 # define CPU_HAS_NEON_FEATURE (true) diff --git a/modules/core/src/cmdparser.cpp b/modules/core/src/cmdparser.cpp index ecc0d291e9..7816fd4a88 100644 --- a/modules/core/src/cmdparser.cpp +++ b/modules/core/src/cmdparser.cpp @@ -7,6 +7,7 @@ using namespace std; using namespace cv; namespace { +#if 0 void helpParser() { printf("\nThe CommandLineParser class is designed for command line arguments parsing\n" @@ -50,6 +51,7 @@ void helpParser() " It also works with 'unsigned int', 'double', and 'float' types \n" ); } +#endif vector split_string(const string& str, const string& delimiters) { diff --git a/modules/flann/include/opencv2/flann/dist.h b/modules/flann/include/opencv2/flann/dist.h index 88f9abc305..5ba3d34579 100644 --- a/modules/flann/include/opencv2/flann/dist.h +++ b/modules/flann/include/opencv2/flann/dist.h @@ -47,7 +47,7 @@ typedef unsigned __int64 uint64_t; # include #endif -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON__) || defined(__ARM_NEON) # include "arm_neon.h" #endif @@ -460,7 +460,7 @@ struct Hamming ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const { ResultType result = 0; -#ifdef __ARM_NEON__ +#if defined(__ARM_NEON__) || defined(__ARM_NEON) { uint32x4_t bits = vmovq_n_u32(0); for (size_t i = 0; i < size; i += 16) { diff --git a/modules/highgui/src/grfmt_tiff.cpp b/modules/highgui/src/grfmt_tiff.cpp index d1425be30d..9b05b364ec 100644 --- a/modules/highgui/src/grfmt_tiff.cpp +++ b/modules/highgui/src/grfmt_tiff.cpp @@ -50,6 +50,9 @@ #include "precomp.hpp" #include "grfmt_tiff.hpp" +#define int64 int64_tiff +#define uint64 uint64_tiff + #ifdef HAVE_TIFF # include "tiff.h" # include "tiffio.h" diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index 19ab2ab7f1..e30fac6640 100755 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -46,7 +46,7 @@ SIMD_DETECTION_PROGRAM=""" #if __MMX__ # error MMX #endif -#if __ARM_NEON__ +#if __ARM_NEON__ || __ARM_NEON # error NEON #endif #error NOSIMD diff --git a/modules/video/test/test_tvl1optflow.cpp b/modules/video/test/test_tvl1optflow.cpp index 804eae8b62..67dc7fe973 100644 --- a/modules/video/test/test_tvl1optflow.cpp +++ b/modules/video/test/test_tvl1optflow.cpp @@ -54,6 +54,7 @@ namespace const float FLO_TAG_FLOAT = 202021.25f; // check for this when READING the file const char FLO_TAG_STRING[] = "PIEH"; // use this when WRITING the file +#ifdef DUMP // binary file format for flow data specified here: // http://vision.middlebury.edu/flow/data/ void writeOpticalFlowToFile(const Mat_& flow, const string& fileName) @@ -76,6 +77,7 @@ namespace } } } +#endif // binary file format for flow data specified here: // http://vision.middlebury.edu/flow/data/