simplify modules/viz/CMakeLists.txt

This commit is contained in:
Anatoly Baksheev 2013-09-03 01:25:04 +04:00
parent 8b20ceb024
commit 35e7952909

View File

@ -1,24 +1,12 @@
set(BUILD_opencv_viz_INIT OFF)
###############################################################################
# Find qvtk
# This sets the following variables:
# QVTK_FOUND - True if QVTK was found.
# QVTK_INCLUDE_DIR - Directory containing the QVTK include files.
# QVTK_LIBRARY - QVTK library.
# if QVTK_FOUND then QVTK_INCLUDE_DIR is appended to VTK_INCLUDE_DIRS and QVTK_LIBRARY is appended to QVTK_LIBRARY_DIR
macro(find_qvtk)
find_library (QVTK_LIBRARY QVTK HINTS ${VTK_DIR} ${VTK_DIR}/bin)
find_path (QVTK_INCLUDE_DIR QVTKWidget.h HINT ${VTK_INCLUDE_DIRS})
find_package_handle_standard_args(QVTK DEFAULT_MSG QVTK_LIBRARY QVTK_INCLUDE_DIR)
if(NOT QVTK_FOUND)
set (VTK_USE_QVTK OFF)
else(NOT QVTK_FOUND)
if(QVTK_FOUND)
get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH)
set (VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS} ${QVTK_LIBRARY_DIR})
set (VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${QVTK_INCLUDE_DIR})
list(APPEND VTK_LIBRARY_DIRS ${QVTK_LIBRARY_DIR})
list(APPEND VTK_INCLUDE_DIRS ${QVTK_INCLUDE_DIR})
set (VTK_USE_QVTK ON)
endif()
endmacro()
@ -34,52 +22,31 @@ macro(find_vtk)
set(HAVE_VTK ON)
else ()
set(HAVE_VTK OFF)
message ("Warning: VTK disabled. You are to build OpenCV in STATIC but VTK is SHARED!")
message (WARNING "VTK disabled. You are to build OpenCV in STATIC but VTK is SHARED!")
endif ()
endif()
endmacro()
#find_package(OpenGL)
#if (OPENGL_FOUND)
# if(OPENGL_INCLUDE_DIR)
# include_directories("${OPENGL_INCLUDE_DIR}")
# endif()
# if(OPENGL_DEFINITIONS)
# add_definitions("${OPENGL_DEFINITIONS}")
# endif()
#endif()
find_vtk()
if(NOT HAVE_VTK)
set(DEFAULT FALSE)
set(REASON "VTK was not found.")
else()
set(DEFAULT TRUE)
set(REASON)
if(HAVE_VTK)
set(VTK_USE_FILE ${VTK_USE_FILE} CACHE INTERNAL "VTK_USE_FILE")
include (${VTK_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_definitions(-DHAVE_VTK)
else()
return()
endif()
add_definitions(-DHAVE_VTK)
set(the_description "Viz")
set(BUILD_opencv_viz_INIT OFF)
include_directories(src)
ocv_define_module(viz opencv_core)
target_link_libraries(opencv_viz vtkCommon vtkWidgets vtkFiltering vtkRendering)
#${OPENGL_LIBRARIES})
if(APPLE)
if(BUILD_opencv_viz)
target_link_libraries(opencv_viz vtkCommon vtkWidgets vtkFiltering vtkRendering)
if(APPLE)
target_link_libraries(opencv_viz "-framework Cocoa")
endif()
endif()