Fixed recently introduced build problems on some platforms

This commit is contained in:
Andrey Kamaev 2012-06-08 06:19:17 +00:00
parent f62028dc16
commit 79df8db76f
6 changed files with 49 additions and 11 deletions

View File

@ -410,7 +410,7 @@ typedef uLong FAR uLongf;
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if -_LARGEFILE64_SOURCE - -1 == 1
#if defined _LARGEFILE64_SOURCE && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif

View File

@ -481,6 +481,7 @@ else()
status(" Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
endif()
status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
# ========================== OpenCV modules ==========================
status("")
@ -570,7 +571,7 @@ if(WITH_TIFF)
if(TIFF_VERSION_STRING AND TIFF_FOUND)
status(" TIFF:" "${TIFF_LIBRARY} (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
else()
status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION})" ELSE "build (ver ${TIFF_VERSION})")
status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
endif()
else()
status(" TIFF:" "NO")

View File

@ -61,6 +61,16 @@ if(TIFF_BIGTIFF_VERSION AND NOT TIFF_VERSION_BIG)
set(TIFF_VERSION_BIG ${TIFF_BIGTIFF_VERSION})
endif()
if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR)
list(GET TIFF_INCLUDE_DIR 0 _TIFF_INCLUDE_DIR)
if(EXISTS "${_TIFF_INCLUDE_DIR}/tiffvers.h")
file(STRINGS "${_TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1" TIFF_VERSION_STRING "${tiff_version_str}")
unset(tiff_version_str)
endif()
unset(_TIFF_INCLUDE_DIR)
endif()
# --- libjpeg (optional) ---
if(WITH_JPEG)
if(BUILD_JPEG)

View File

@ -131,7 +131,7 @@ macro(ocv_add_module _name)
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export")
endif()
endif()
# add self to the world dependencies
if(NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS" OR OPENCV_MODULE_IS_PART_OF_WORLD)
ocv_add_dependencies(opencv_world OPTIONAL ${the_module})
@ -512,8 +512,8 @@ endmacro()
macro(ocv_add_precompiled_headers the_target)
if("${the_target}" MATCHES "^opencv_test_.*$")
SET(pch_path "test/test_")
elseif("${the_target}" MATCHES "opencv_perf_gpu_cpu")
SET(pch_path "perf_cpu/perf_cpu_")
elseif("${the_target}" MATCHES "opencv_perf_gpu_cpu")
SET(pch_path "perf_cpu/perf_cpu_")
elseif("${the_target}" MATCHES "^opencv_perf_.*$")
SET(pch_path "perf/perf_")
else()

View File

@ -32,6 +32,32 @@ macro(ocv_clear_vars)
endforeach()
endmacro()
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
macro(ocv_check_flag_support lang flag varname)
if("_${lang}_" MATCHES "_CXX_")
set(_lang CXX)
elseif("_${lang}_" MATCHES ".*_C_.*")
set(_lang C)
else()
set(_lang ${lang})
endif()
string(TOUPPER "${flag}" ${varname})
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
string(REPLACE "-" "_" ${varname} "${${varname}}")
if(_lang STREQUAL "CXX")
CHECK_CXX_COMPILER_FLAG(${flag} ${${varname}})
elseif(_lang STREQUAL "C")
CHECK_C_COMPILER_FLAG("${flag}" ${${varname}})
else()
set(${varname} FALSE)
endif()
endmacro()
# turns off warnings
macro(ocv_warnings_disable)
if(NOT ENABLE_NOISY_WARNINGS)
@ -56,11 +82,12 @@ macro(ocv_warnings_disable)
elseif(CV_COMPILER_IS_GNU AND _gxx_warnings AND _flag_vars)
foreach(var ${_flag_vars})
foreach(warning ${_gxx_warnings})
if(warning MATCHES "^-Wno-")
set(${var} "${${var}} ${warning}")
else()
if(NOT warning MATCHES "^-Wno-")
string(REPLACE "${warning}" "" ${var} "${${var}}")
string(REPLACE "-W" "-Wno-" warning "${warning}")
endif()
ocv_check_flag_support(${var} "${warning}" _varname)
if(${_varname})
set(${var} "${${var}} ${warning}")
endif()
endforeach()

View File

@ -82,7 +82,8 @@ if(HAVE_QT)
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
if(CMAKE_COMPILER_IS_GNUCXX)
CHECK_CXX_COMPILER_FLAG(-Wno-missing-declarations HAVE_CXX_WNO_MISSING_DECLARATIONS)
if(HAVE_CXX_WNO_MISSING_DECLARATIONS)
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS "-Wno-missing-declarations")
endif()
elseif(WIN32)
@ -170,7 +171,6 @@ if(WITH_IMAGEIO)
if(IOS)
list(APPEND HIGHGUI_LIBRARIES "-framework ImageIO")
endif()
#TODO: check if need to link with some framework on OS X: -framework ApplicationServices ??
endif(WITH_IMAGEIO)
if(WITH_AVFOUNDATION)
@ -224,7 +224,7 @@ endif()
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
ocv_add_precompiled_headers(${the_module})
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-deprecated-declarations)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
if(WIN32 AND WITH_FFMPEG)
#copy ffmpeg dll to the output folder