opencv/modules/viz/CMakeLists.txt

53 lines
1.6 KiB
CMake
Raw Normal View History

2013-03-18 23:52:46 +08:00
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)
2013-09-03 05:25:04 +08:00
if(QVTK_FOUND)
2013-03-18 23:52:46 +08:00
get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH)
2013-09-03 05:25:04 +08:00
list(APPEND VTK_LIBRARY_DIRS ${QVTK_LIBRARY_DIR})
list(APPEND VTK_INCLUDE_DIRS ${QVTK_INCLUDE_DIR})
2013-03-18 23:52:46 +08:00
set (VTK_USE_QVTK ON)
endif()
endmacro()
macro(find_vtk)
2013-09-06 23:32:35 +08:00
find_package(VTK 5.10.0 REQUIRED)
2013-03-18 23:52:46 +08:00
if(VTK_FOUND)
if (BUILD_SHARED_LIBS OR (NOT BUILD_SHARED_LIBS AND NOT VTK_BUILD_SHARED_LIBS))
find_qvtk()
message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARY_DIRS})")
link_directories(${VTK_LIBRARY_DIRS})
include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
set(HAVE_VTK ON)
else ()
set(HAVE_VTK OFF)
message (FATAL_ERROR "VTK disabled. You are to build OpenCV in STATIC but VTK is SHARED!")
2013-03-18 23:52:46 +08:00
endif ()
endif()
endmacro()
if (NOT OPENCV_INITIAL_PASS AND DEFINED BUILD_opencv_viz AND BUILD_opencv_viz)
find_vtk()
endif()
2013-03-18 23:52:46 +08:00
if(DEFINED HAVE_VTK AND HAVE_VTK)
2013-03-18 23:52:46 +08:00
set(VTK_USE_FILE ${VTK_USE_FILE} CACHE INTERNAL "VTK_USE_FILE")
include (${VTK_USE_FILE})
2013-09-03 05:25:04 +08:00
add_definitions(-DHAVE_VTK)
2013-03-18 23:52:46 +08:00
endif()
set(the_description "Viz")
2013-03-18 23:52:46 +08:00
set(BUILD_opencv_viz_INIT OFF)
include_directories(src)
ocv_define_module(viz opencv_core)
2013-03-18 23:52:46 +08:00
if(DEFINED BUILD_opencv_viz AND BUILD_opencv_viz AND DEFINED HAVE_VTK AND HAVE_VTK)
2013-09-03 05:25:04 +08:00
target_link_libraries(opencv_viz vtkCommon vtkWidgets vtkFiltering vtkRendering)
if(APPLE)
target_link_libraries(opencv_viz "-framework Cocoa")
2013-09-03 05:25:04 +08:00
endif()
2013-03-18 23:52:46 +08:00
endif()