mirror of
https://github.com/OpenFOAM/ThirdParty-6.git
synced 2025-12-08 06:57:43 +00:00
106 lines
2.4 KiB
CMake
106 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 2.8.8)
|
|
if(POLICY CMP0020)
|
|
cmake_policy(SET CMP0020 NEW)
|
|
endif()
|
|
if(POLICY CMP0025)
|
|
cmake_policy(SET CMP0025 NEW) # CMake 3.0
|
|
endif()
|
|
if(POLICY CMP0043)
|
|
cmake_policy(SET CMP0043 NEW) # CMake 3.0
|
|
endif()
|
|
if(POLICY CMP0053)
|
|
cmake_policy(SET CMP0053 NEW) # CMake 3.1
|
|
endif()
|
|
project(SimpleView)
|
|
|
|
find_package(VTK COMPONENTS
|
|
vtkCommonCore
|
|
vtkFiltersCore
|
|
vtkInfovisCore
|
|
vtkInteractionStyle
|
|
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}
|
|
)
|
|
|
|
# Set your files and resources here
|
|
set( Srcs main.cxx SimpleView.cxx )
|
|
|
|
set( Hdrs SimpleView.h )
|
|
|
|
set( MOC_Hdrs SimpleView.h )
|
|
|
|
set( UIs SimpleView.ui )
|
|
|
|
set( QRCs Icons/icons.qrc )
|
|
|
|
|
|
# Instruct CMake to run moc automatically when needed.
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
# The rest should just work (sure...)
|
|
if(VTK_QT_VERSION VERSION_GREATER "4")
|
|
# 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(QRC_Srcs ${QRCs} )
|
|
|
|
source_group("Resources" FILES
|
|
${UIs}
|
|
${QRCs}
|
|
${EXE_ICON} # Not present
|
|
)
|
|
|
|
source_group("Generated" FILES
|
|
${UI_Srcs}
|
|
${MOC_Srcs}
|
|
${QRC_Srcs}
|
|
${QRC_Srcs}
|
|
)
|
|
|
|
add_executable(SimpleView MACOSX_BUNDLE
|
|
${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${QRC_Srcs})
|
|
qt5_use_modules(SimpleView Core Gui Widgets)
|
|
target_link_libraries(SimpleView ${VTK_LIBRARIES})
|
|
else()
|
|
find_package(Qt4 REQUIRED)
|
|
include(${QT_USE_FILE})
|
|
# Use what VTK built with
|
|
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
|
|
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
|
|
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
|
|
qt4_wrap_ui(UI_Srcs ${UIs})
|
|
qt4_wrap_cpp(MOC_Srcs ${MOC_Hdrs} )
|
|
qt4_add_resources(QRC_Srcs ${QRCs})
|
|
|
|
source_group("Resources" FILES
|
|
${UIs}
|
|
${QRCs}
|
|
${EXE_ICON} # Not present
|
|
)
|
|
|
|
source_group("Generated" FILES
|
|
${UI_Srcs}
|
|
${QRC_Srcs}
|
|
${QRC_Srcs}
|
|
)
|
|
|
|
add_definitions(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
|
|
|
|
add_executable(SimpleView MACOSX_BUNDLE
|
|
${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${QRC_Srcs})
|
|
target_link_libraries(SimpleView
|
|
${QT_LIBRARIES}
|
|
${VTK_LIBRARIES}
|
|
)
|
|
endif()
|