123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- project(CTKVisualizationVTKWidgets)
- include(${VTK_USE_FILE})
- #
- # See CTK/CMake/ctkMacroBuildLib.cmake for details
- #
- set(KIT_export_directive "CTK_VISUALIZATION_VTK_WIDGETS_EXPORT")
- #
- # Add the libraries QtTesting
- #
- if(CTK_USE_QTTESTING)
- find_package(QtTesting REQUIRED)
- include_directories(
- ${QtTesting_INCLUDE_DIRS}
- ${CMAKE_BINARY_DIR} # For ctkConfig.h
- )
- endif()
- # Source files
- set(KIT_SRCS
- ctkVTKAbstractMatrixWidget.cpp
- ctkVTKAbstractMatrixWidget.h
- ctkVTKAbstractMatrixWidget_p.h
- ctkVTKAbstractView.cpp
- ctkVTKAbstractView.h
- ctkVTKAbstractView_p.h
- ctkVTKColorTransferFunction.cpp
- ctkVTKColorTransferFunction.h
- ctkVTKCompositeFunction.cpp
- ctkVTKCompositeFunction.h
- ctkVTKDataSetModel.cpp
- ctkVTKDataSetModel.h
- ctkVTKDataSetArrayComboBox.cpp
- ctkVTKDataSetArrayComboBox.h
- ctkVTKHistogram.cpp
- ctkVTKHistogram.h
- ctkVTKLookupTable.cpp
- ctkVTKLookupTable.h
- ctkVTKMagnifyView.cpp
- ctkVTKMagnifyView.h
- ctkVTKMagnifyView_p.h
- ctkVTKMatrixWidget.cpp
- ctkVTKMatrixWidget.h
- ctkVTKOpenGLNativeWidget.h
- ctkVTKPiecewiseFunction.cpp
- ctkVTKPiecewiseFunction.h
- ctkVTKPropertyWidget.cpp
- ctkVTKPropertyWidget.h
- ctkVTKRenderView.cpp
- ctkVTKRenderView.h
- ctkVTKRenderView_p.h
- ctkVTKScalarBarWidget.cpp
- ctkVTKScalarBarWidget.h
- ctkVTKScalarsToColorsComboBox.cpp
- ctkVTKScalarsToColorsComboBox.h
- ctkVTKSliceView.cpp
- ctkVTKSliceView.h
- ctkVTKSliceView_p.h
- ctkVTKSurfaceMaterialPropertyWidget.cpp
- ctkVTKSurfaceMaterialPropertyWidget.h
- ctkVTKTextPropertyWidget.cpp
- ctkVTKTextPropertyWidget.h
- ctkVTKThresholdWidget.cpp
- ctkVTKThresholdWidget.h
- ctkVTKThumbnailView.cpp
- ctkVTKThumbnailView.h
- ctkVTKWidgetsUtils.cpp
- ctkVTKWidgetsUtils.h
- )
- # Headers that should run through moc
- set(KIT_MOC_SRCS
- ctkVTKAbstractMatrixWidget_p.h
- ctkVTKAbstractView.h
- ctkVTKAbstractView_p.h
- ctkVTKColorTransferFunction.h
- ctkVTKCompositeFunction.h
- ctkVTKDataSetArrayComboBox.h
- ctkVTKDataSetModel.h
- ctkVTKHistogram.h
- ctkVTKLookupTable.h
- ctkVTKMagnifyView.h
- ctkVTKMagnifyView_p.h
- ctkVTKMatrixWidget.h
- ctkVTKOpenGLNativeWidget.h
- ctkVTKPiecewiseFunction.h
- ctkVTKPropertyWidget.h
- ctkVTKRenderView.h
- ctkVTKRenderView_p.h
- ctkVTKScalarBarWidget.h
- ctkVTKScalarsToColorsComboBox.h
- ctkVTKSliceView.h
- ctkVTKSliceView_p.h
- ctkVTKSurfaceMaterialPropertyWidget.h
- ctkVTKTextPropertyWidget.h
- ctkVTKThresholdWidget.h
- ctkVTKThumbnailView.h
- )
- # UI files
- set(KIT_UI_FORMS
- Resources/UI/ctkVTKDiscretizableColorTransferWidget.ui
- Resources/UI/ctkVTKScalarBarWidget.ui
- Resources/UI/ctkVTKTextPropertyWidget.ui
- Resources/UI/ctkVTKPropertyWidget.ui
- Resources/UI/ctkVTKThresholdWidget.ui
- )
- # Resources
- set(KIT_resources
- Resources/ctkVTKWidgets.qrc
- )
- # Set VTK_LIBRARIES variable
- if(${VTK_VERSION_MAJOR} GREATER 5)
- set(VTK_LIBRARIES
- vtkChartsCore
- vtkCommonMath
- vtkFiltersSources
- vtkImagingGeneral
- vtkImagingStatistics
- vtkInteractionWidgets
- vtkRenderingContext2D
- vtkViewsContext2D
- vtkGUISupportQt
- )
- if(TARGET vtkRenderingContext${VTK_RENDERING_BACKEND})
- list(APPEND VTK_LIBRARIES vtkRenderingContext${VTK_RENDERING_BACKEND})
- endif()
- if(TARGET vtkRenderingGL2PS${VTK_RENDERING_BACKEND})
- list(APPEND VTK_LIBRARIES vtkRenderingGL2PS${VTK_RENDERING_BACKEND})
- endif()
- if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
- set(VTK_LIBRARIES ${VTK_LIBRARIES} vtkWrappingPythonCore)
- endif()
- else()
- set(VTK_LIBRARIES
- QVTK
- )
- endif()
- if(CTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS)
- set(CTK_USE_CHARTS 1)
- endif()
- if(${CTK_USE_CHARTS})
- set(KIT_SRCS
- ctkVTKChartView.cpp
- ctkVTKChartView.h
- ctkVTKDiscretizableColorTransferWidget.h
- ctkVTKDiscretizableColorTransferWidget.cpp
- ctkVTKVolumePropertyWidget.cpp
- ctkVTKVolumePropertyWidget.h
- ctkVTKScalarsToColorsView.cpp
- ctkVTKScalarsToColorsView.h
- ctkVTKScalarsToColorsWidget.cpp
- ctkVTKScalarsToColorsWidget.h
- ${KIT_SRCS})
- set(KIT_MOC_SRCS
- ctkVTKChartView.h
- ctkVTKDiscretizableColorTransferWidget.h
- ctkVTKVolumePropertyWidget.h
- ctkVTKScalarsToColorsView.h
- ctkVTKScalarsToColorsWidget.h
- ${KIT_MOC_SRCS})
- set(KIT_UI_FORMS
- Resources/UI/ctkVTKVolumePropertyWidget.ui
- Resources/UI/ctkVTKScalarsToColorsWidget.ui
- ${KIT_UI_FORMS})
- if(${VTK_VERSION_MAJOR} GREATER 5)
- set(VTK_LIBRARIES
- vtkChartsCore
- ${VTK_LIBRARIES})
- else()
- set(VTK_LIBRARIES
- vtkCharts
- ${VTK_LIBRARIES})
- endif()
- add_definitions(-DCTK_USE_CHARTS)
- endif()
- # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
- # The following macro will read the target libraries from the file 'target_libraries.cmake'
- ctkFunctionGetTargetLibraries(KIT_target_libraries)
- # If we use QtTessting, we add all the dependencies
- if(CTK_USE_QTTESTING)
- list(APPEND KIT_SRCS
- ctkVTKRenderViewEventPlayer.cpp
- ctkVTKRenderViewEventPlayer.h
- ctkVTKRenderViewEventTranslator.cpp
- ctkVTKRenderViewEventTranslator.h
- )
- list(APPEND KIT_MOC_SRCS
- ctkVTKRenderViewEventPlayer.h
- ctkVTKRenderViewEventTranslator.h
- )
- list(APPEND KIT_target_libraries QtTesting)
- endif()
- # Prefer QVTKOpenGLWidget to QVTKWidget when using Qt5
- set(_use_qvtkopenglwidget 1)
- if(CTK_QT_VERSION VERSION_LESS "5"
- OR VTK_VERSION VERSION_LESS "8"
- OR (NOT VTK_RENDERING_BACKEND STREQUAL "OpenGL2"))
- set(_use_qvtkopenglwidget 0)
- endif()
- if(_use_qvtkopenglwidget)
- add_definitions(-DCTK_USE_QVTKOPENGLWIDGET)
- endif()
- # Detect if QVTKOpenGLNativeWidget.h is available
- set(_has_QVTKOpenGLNativeWidget_h 0)
- if(_use_qvtkopenglwidget)
- set(_msg "Checking if QVTKOpenGLNativeWidget.h exists")
- message(STATUS "${_msg}")
- foreach(include_dir IN ITEMS ${vtkGUISupportQt_INCLUDE_DIRS})
- if(EXISTS "${include_dir}/QVTKOpenGLNativeWidget.h")
- set(_has_QVTKOpenGLNativeWidget_h 1)
- break()
- endif()
- endforeach()
- if(_has_QVTKOpenGLNativeWidget_h)
- message(STATUS "${_msg} - found")
- else()
- message(STATUS "${_msg} - not found")
- endif()
- endif()
- if(_has_QVTKOpenGLNativeWidget_h)
- add_definitions(-DCTK_HAS_QVTKOPENGLNATIVEWIDGET_H)
- endif()
- ctkMacroBuildLib(
- NAME ${PROJECT_NAME}
- EXPORT_DIRECTIVE ${KIT_export_directive}
- SRCS ${KIT_SRCS}
- MOC_SRCS ${KIT_MOC_SRCS}
- UI_FORMS ${KIT_UI_FORMS}
- TARGET_LIBRARIES ${KIT_target_libraries}
- RESOURCES ${KIT_resources}
- LIBRARY_TYPE ${CTK_LIBRARY_MODE}
- )
- if(_use_qvtkopenglwidget)
- target_compile_definitions(
- ${PROJECT_NAME}
- INTERFACE
- CTK_USE_QVTKOPENGLWIDGET
- )
- endif()
- if(_has_QVTKOpenGLNativeWidget_h)
- target_compile_definitions(
- ${PROJECT_NAME}
- INTERFACE
- CTK_HAS_QVTKOPENGLNATIVEWIDGET_H
- )
- endif()
- if(CTK_WRAP_PYTHONQT_LIGHT)
- ctkMacroBuildLibWrapper(
- TARGET ${PROJECT_NAME}
- SRCS ${KIT_SRCS}
- WRAPPER_LIBRARY_TYPE ${CTK_LIBRARY_MODE}
- )
- endif()
- # Plugins
- if(CTK_BUILD_QTDESIGNER_PLUGINS)
- add_subdirectory(Plugins)
- endif()
- # Testing
- if(BUILD_TESTING)
- add_subdirectory(Testing)
- endif()
|