More proper OpneCv+Qt+Vtk issues handling (http://code.opencv.org/issues/3492)
This commit is contained in:
parent
eb8728d727
commit
975a6299fa
@ -2,25 +2,52 @@ if(NOT WITH_VTK OR ANDROID OR IOS)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (HAVE_QT5)
|
# VTK 6.x components
|
||||||
message(STATUS "VTK is disabled because OpenCV is linked with Q5. Some VTK disributives are compiled with Q4 and therefore can't be linked together Qt5.")
|
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||||
|
|
||||||
|
# VTK 5.x components
|
||||||
|
if(NOT VTK_FOUND)
|
||||||
|
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT VTK_FOUND)
|
||||||
|
set(HAVE_VTK OFF)
|
||||||
|
message(STATUS "VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(VTK 6.0 QUIET COMPONENTS vtkRenderingCore vtkInteractionWidgets vtkInteractionStyle vtkIOLegacy vtkIOPLY vtkRenderingFreeType vtkRenderingLOD vtkFiltersTexture vtkIOExport NO_MODULE)
|
# Don't support ealier VTKs
|
||||||
|
if(${VTK_VERSION} VERSION_LESS "5.8.0")
|
||||||
if(NOT DEFINED VTK_FOUND OR NOT VTK_FOUND)
|
message(STATUS "VTK support is disabled. VTK ver. 5.8.0 is minimum required, but found VTK ver. ${VTK_VERSION}")
|
||||||
find_package(VTK 5.10 QUIET COMPONENTS vtkCommon vtkFiltering vtkRendering vtkWidgets vtkImaging NO_MODULE)
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED VTK_FOUND OR NOT VTK_FOUND)
|
# Different Qt versions can't be linked together
|
||||||
find_package(VTK 5.8 QUIET COMPONENTS vtkCommon vtkFiltering vtkRendering vtkWidgets vtkImaging NO_MODULE)
|
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_LESS "6.0.0")
|
||||||
|
if(VTK_USE_QT)
|
||||||
|
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(VTK_FOUND)
|
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
||||||
set(HAVE_VTK ON)
|
if(HAVE_QT5 AND ${VTK_VERSION} VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
||||||
message(STATUS "Found VTK ver. ${VTK_VERSION} (usefile: ${VTK_USE_FILE})")
|
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
||||||
else()
|
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
||||||
set(HAVE_VTK OFF)
|
return()
|
||||||
message(STATUS "VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or set $VTK_DIR enviroment variable to VTK install subdirectory with VTKConfig.cmake file (for windows)")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Different Qt versions can't be linked together
|
||||||
|
if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
||||||
|
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
||||||
|
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
||||||
|
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(HAVE_VTK ON)
|
||||||
|
message(STATUS "Found VTK ver. ${VTK_VERSION} (usefile: ${VTK_USE_FILE})")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user