Commit bbefde33 authored by Ben Boeckel's avatar Ben Boeckel

Examples/Infovis: update to the new module system

parent 70ec3748
......@@ -36,6 +36,7 @@ else ()
add_example(GUI/Qt/SimpleView)
add_example(IO/Cxx)
add_example(ImageProcessing/Cxx)
add_example(Infovis/Cxx)
endif ()
if (FALSE)
......@@ -84,10 +85,6 @@ else()
add_subdirectory(Build/vtkMy)
if (NOT VTK_RENDERING_BACKEND STREQUAL "None")
add_subdirectory(Infovis/Cxx)
endif ()
# IF(VTK_USE_INFOVIS)
# IF(VTK_USE_N_WAY_ARRAYS)
# add_subdirectory(Array/Cxx)
......
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
project(Infovis)
find_package(VTK REQUIRED)
# List of VTK_Modules required from VTK
# for all examples in this directory and its subdirectories to work.
set(VTK_Modules
vtkCommonCore
vtkFiltersSources
vtkIOInfovis
vtkIOSQL
vtkInfovisLayout
vtkInteractionStyle
vtkRenderingLabel
vtkRendering${VTK_RENDERING_BACKEND}
vtkViewsInfovis
)
if(TARGET vtkGUISupportQt AND
TARGET vtkViewsQt)
set(VTK_Modules ${VTK_Modules}
vtkGUISupportQt
vtkViewsQt
)
endif()
vtk_module_config(VTK
${VTK_Modules}
)
include(${VTK_USE_FILE})
add_executable(TreeLayout TreeLayout.cxx)
target_link_libraries(TreeLayout ${VTK_LIBRARIES})
if(vtkViewsInfovis_LOADED)
add_executable(HelloWorld HelloWorld.cxx)
target_link_libraries(HelloWorld ${VTK_LIBRARIES})
add_executable(Theme Theme.cxx)
target_link_libraries(Theme ${VTK_LIBRARIES})
add_executable(CreateTree CreateTree.cxx)
target_link_libraries(CreateTree ${VTK_LIBRARIES})
add_executable(MultiView MultiView.cxx)
target_link_LIBRARIES(MultiView ${VTK_LIBRARIES})
endif()
# If Qt is enabled include the QT based examples
if(vtkGUISupportQt_LOADED AND vtkViewsQt_LOADED)
set(vtk_modules
find_package(VTK
COMPONENTS
FiltersSources
IOInfovis
InfovisCore
InfovisLayout
InteractionStyle
RenderingCore
RenderingLabel
RenderingOpenGL2)
OPTIONAL_COMPONENTS
FiltersStatistics
GUISupportQt
IOSQL
ViewsInfovis
ViewsQt)
if (NOT VTK_FOUND)
message("Skipping example: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
add_executable(TreeLayout
TreeLayout.cxx)
target_link_libraries(TreeLayout
PRIVATE
${vtk_modules})
vtk_module_autoinit(
TARGETS TreeLayout
MODULES ${vtk_modules})
if (TARGET VTK::ViewsInfovis)
add_executable(HelloWorld
HelloWorld.cxx)
target_link_libraries(HelloWorld
PRIVATE
${vtk_modules}
vtkViewsInfovis)
add_executable(Theme
Theme.cxx)
target_link_libraries(Theme
PRIVATE
${vtk_modules}
vtkViewsInfovis)
add_executable(CreateTree
CreateTree.cxx)
target_link_libraries(CreateTree
PRIVATE
${vtk_modules}
vtkViewsInfovis)
add_executable(MultiView
MultiView.cxx)
target_link_libraries(MultiView
PRIVATE
${vtk_modules}
vtkViewsInfovis)
vtk_module_autoinit(
TARGETS HelloWorld
Theme
CreateTree
MultiView
MODULES ${vtk_modules}
vtkViewsInfovis)
endif ()
# If Qt is enabled include the Qt based examples
if (TARGET VTK::GUISupportQt AND TARGET VTK::ViewsQt)
add_subdirectory(EasyView)
add_subdirectory(CustomLinkView)
if(vtkIOSQL_LOADED)
if (TARGET VTK::IOSQL AND TARGET VTK::FiltersStatistics)
add_subdirectory(StatsView)
endif()
endif()
endif ()
endif ()
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project(CustomLinkView)
find_package(VTK REQUIRED)
vtk_module_config(VTK
vtkCommonCore
vtkCommonDataModel
vtkFiltersGeneral
vtkGUISupportQt
vtkIOInfovis
vtkInfovisCore
vtkRenderingOpenGL2
vtkViewsCore
vtkViewsInfovis
vtkViewsQt
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Set your files and resources here
set(Srcs main.cxx CustomLinkView.cxx)
set(UIs CustomLinkView.ui)
set(Hdrs CustomLinkView.h)
set(MOC_Hdrs CustomLinkView.h)
set(Rcs Icons/icons.qrc)
# It is nice to have the ui in the windows project file.
# Right-click, choose Open With... press the Add button,
# and then find designer.exe and set as default.
# After this just click on it to bring it up in designer.
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs ${Srcs} ${UIs})
endif(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs
CustomLinkView.cxx
main.cxx)
set(UIs
CustomLinkView.ui)
set(Hdrs
CustomLinkView.h)
set(Rcs
Icons/icons.qrc)
find_package(Qt5 COMPONENTS Widgets)
qt5_wrap_ui(UI_Srcs ${UIs})
qt5_add_resources(Rcs_Srcs ${Rcs})
set_source_files_PROPERTIES(${Srcs} PROPERTIES
OBJECT_DEPENDS "${UI_Srcs}")
add_executable(CustomLinkView
MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${Rcs_Srcs})
target_link_libraries(CustomLinkView Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(CustomLinkView ${VTK_LIBRARIES})
if (NOT TARGET Qt5::Widgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
add_executable(CustomLinkView MACOSX_BUNDLE
${Srcs} ${Hdrs} ${UIs} ${Rcs})
target_link_libraries(CustomLinkView
PRIVATE
${vtk_modules}
VTK::GUISupportQt
VTK::ViewsQt
Qt5::Widgets)
vtk_module_autoinit(
TARGETS CustomLinkView
MODULES ${vtk_modules}
VTK::GUISupportQt
VTK::ViewsQt)
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project(EasyView)
find_package(VTK REQUIRED)
vtk_module_config(VTK
vtkCommonCore
vtkCommonDataModel
vtkGUISupportQt
vtkIOInfovis
vtkInfovisCore
vtkViewsCore
vtkViewsInfovis
vtkViewsQt
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Set your files and resources here
set(Srcs main.cxx EasyView.cxx)
set(UIs EasyView.ui)
set(Hdrs EasyView.h)
set(MOC_Hdrs EasyView.h)
set(Rcs Icons/icons.qrc)
# It is nice to have the ui in the windows project file.
# Right-click, choose Open With... press the Add button,
# and then find designer.exe and set as default.
# After this just click on it to bring it up in designer.
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs ${Srcs} ${UIs})
endif(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs
EasyView.cxx
main.cxx)
set(UIs
EasyView.ui)
set(Hdrs
EasyView.h)
set(Rcs
Icons/icons.qrc)
# We have ui files, this will bring in the macro: qt5_wrap_ui
find_package(Qt5 COMPONENTS Widgets REQUIRED QUIET)
qt5_wrap_ui(UI_Srcs ${UIs})
qt5_add_resources(Rcs_Srcs ${Rcs})
find_package(Qt5 COMPONENTS Widgets)
if (NOT TARGET Qt5::Widgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
source_group("Resources" FILES
${UIs}
${Rcs}
${EXE_ICON} # Not present
)
source_group("Generated" FILES
${UI_Srcs}
${MOC_Srcs}
${Rcs_Srcs}
)
# set_source_files_PROPERTIES(${Srcs} PROPERTIES
# OBJECT_DEPENDS "${UI_Srcs}")
add_executable(EasyView
MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${Rcs_Srcs})
target_link_libraries(EasyView Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(EasyView ${VTK_LIBRARIES})
MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UIs} ${Rcs})
target_link_libraries(EasyView
PRIVATE
${vtk_modules}
VTK::GUISupportQt
VTK::ViewsQt
Qt5::Widgets)
vtk_module_autoinit(
TARGETS EasyView
MODULES ${vtk_modules}
VTK::GUISupportQt
VTK::ViewsQt)
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project(StatsView)
find_package(VTK REQUIRED)
vtk_module_config(VTK
vtkCommonDataModel
vtkFiltersStatistics
vtkIOInfovis
vtkIOSQL
vtkInfovisCore
vtkViewsCore
vtkViewsQt
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Set your files and resources here
set(Srcs main.cxx StatsView.cxx)
set(UIs StatsView.ui)
set(Hdrs StatsView.h)
set(MOC_Hdrs StatsView.h)
set(Rcs Icons/icons.qrc)
# It is nice to have the ui in the windows project file.
# Right-click, choose Open With... press the Add button,
# and then find designer.exe and set as default.
# After this just click on it to bring it up in designer.
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs ${Srcs} ${UIs})
endif(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set(Srcs
StatsView.cxx
main.cxx)
set(UIs
StatsView.ui)
set(Hdrs
StatsView.h)
set(Rcs
Icons/icons.qrc)
find_package(Qt5 COMPONENTS Widgets)
qt5_wrap_ui(UI_Srcs ${UIs})
qt5_add_resources(Rcs_Srcs ${Rcs})
set_source_files_PROPERTIES(${Srcs} PROPERTIES
OBJECT_DEPENDS "${UI_Srcs}")
add_executable(StatsView
MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${Rcs_Srcs})
target_link_libraries(StatsView Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(StatsView ${VTK_LIBRARIES})
if (NOT TARGET Qt5::Widgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
add_executable(StatsView MACOSX_BUNDLE
${Srcs} ${Hdrs} ${UIs} ${Rcs})
target_link_libraries(StatsView
PRIVATE
${vtk_modules}
VTK::FiltersStatistics
VTK::GUISupportQt
VTK::ViewsQt
VTK::IOSQL)
vtk_module_autoinit(
TARGETS StatsView
MODULES ${vtk_modules}
VTK::FiltersStatistics
VTK::GUISupportQt
VTK::ViewsQt
VTK::IOSQL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment