From: barate Date: Fri, 8 Mar 2013 14:16:26 +0000 (+0000) Subject: Fix VTK 6 detection and usage with CMake X-Git-Tag: V7_1_0~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0e0062ce92b1dd27322e6eee235a984fc9cd66c;p=modules%2Fgui.git Fix VTK 6 detection and usage with CMake --- diff --git a/adm_local/cmake_files/FindSalomeVTK.cmake b/adm_local/cmake_files/FindSalomeVTK.cmake index 6bf4b002b..0af466192 100644 --- a/adm_local/cmake_files/FindSalomeVTK.cmake +++ b/adm_local/cmake_files/FindSalomeVTK.cmake @@ -1,28 +1,14 @@ -# VTK detection for Salome +# VTK detection for Salome (see http://www.vtk.org/Wiki/VTK/Build_System_Migration) set(PARAVIEW_ROOT_DIR $ENV{PARAVIEW_ROOT_DIR} CACHE PATH "Path to ParaView directory") set(PARAVIEW_VERSION $ENV{PARAVIEW_VERSION} CACHE STRING "Version of Paraview") if(EXISTS ${PARAVIEW_ROOT_DIR}) - set(VTK_DIR ${PARAVIEW_ROOT_DIR}/lib/paraview-${PARAVIEW_VERSION} CACHE PATH "Path to directory including VTKConfig.cmake") + set(VTK_DIR ${PARAVIEW_ROOT_DIR}/lib/cmake/paraview-${PARAVIEW_VERSION} CACHE PATH "Path to directory including VTKConfig.cmake") endif(EXISTS ${PARAVIEW_ROOT_DIR}) -find_package(VTK REQUIRED) +set(VTK_COMPONENTS vtkRenderingOpenGL vtkRenderingLOD vtkRenderingAnnotation vtkFiltersParallel vtkIOExport) +find_package(VTK 6.0 REQUIRED COMPONENTS ${VTK_COMPONENTS} NO_MODULE) if (VTK_FOUND) - include(${VTK_USE_FILE}) message(STATUS "VTK version is ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") - message(STATUS "Kit VTK availables : ${VTK_KITS}") - message(STATUS "VTK Library dir is : ${VTK_LIBRARY_DIRS}") - set(CMAKE_LIBRARY_PATH ${VTK_LIBRARY_DIRS}) - set(VTK_LIBSWENEED vtkCommon vtkGraphics vtkImaging vtkFiltering vtkIO vtkRendering vtkHybrid vtkParallel vtkWidgets vtkInfovis vtkVolumeRendering) - unset(VTK_LIBRARIES) - foreach(VTK_LIB_NEEDED ${VTK_LIBSWENEED}) - unset(VTK_LIB CACHE) - find_library(VTK_LIB ${VTK_LIB_NEEDED}) - set(VTK_LIBRARIES ${VTK_LIBRARIES} ${VTK_LIB}) - endforeach(VTK_LIB_NEEDED) - find_library(VTK_PYLIBS vtkWrappingPython${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}-pv${PARAVIEW_VERSION}) - #find_library(vtkCommonPythonD vtkCommonPythonD) - #find_library(vtkGraphicsPythonD vtkGraphicsPythonD) - #find_library(vtkImagingPythonD vtkImagingPythonD) - #find_library(vtkPythonCore vtkPythonCore) + message(STATUS "VTK libraries are: ${VTK_LIBRARIES}") endif(VTK_FOUND) diff --git a/src/SALOME_PY/CMakeLists.txt b/src/SALOME_PY/CMakeLists.txt index f52f4be84..867c5fa28 100755 --- a/src/SALOME_PY/CMakeLists.txt +++ b/src/SALOME_PY/CMakeLists.txt @@ -17,12 +17,13 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} ${PYTHON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - ${VTK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_CURRENT_SOURCE_DIR}/../LightApp @@ -50,7 +51,7 @@ SET(COMMON_LIBS # ${vtkPythonCore} ) -ADD_DEFINITIONS("-DHAVE_CONFIG_H ${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${BOOST_DEFINITIONS} ${VTK_DEFINITIONS} ${PYTHON_DEFINITIONS}") +ADD_DEFINITIONS("-DHAVE_CONFIG_H ${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS}") ADD_LIBRARY(SalomePy SalomePy.cxx) TARGET_LINK_LIBRARIES(SalomePy ${COMMON_LIBS}) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt index fd5057149..c8e67e6d7 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} @@ -25,7 +27,6 @@ INCLUDE_DIRECTORIES( ${SIP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} - ${VTK_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIR} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_CURRENT_SOURCE_DIR} @@ -58,7 +59,7 @@ SET(COMMON_LIBS SET(GUI_HEADERS SALOME_PYQT_Module.h) QT4_WRAP_CPP(GUI_HEADERS_MOC ${GUI_HEADERS}) -ADD_DEFINITIONS("-DCALL_OLD_METHODS -DHAVE_CONFIG_H ${QT_DEFINITIONS} ${PYTHON_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${VTK_DEFINITIONS} ${OMNIORB_DEFINITIONS}") +ADD_DEFINITIONS("-DCALL_OLD_METHODS -DHAVE_CONFIG_H ${QT_DEFINITIONS} ${PYTHON_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS}") ADD_LIBRARY(SalomePyQtGUI SALOME_PYQT_Module.cxx ${GUI_HEADERS_MOC}) TARGET_LINK_LIBRARIES(SalomePyQtGUI ${COMMON_LIBS}) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt index abb02c164..b0f472178 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt @@ -17,13 +17,14 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} ${SIP_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} - ${VTK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_CURRENT_BINARY_DIR} @@ -87,7 +88,7 @@ SET(SalomePyQtGUI_SOURCES SALOME_PYQT_PyInterp.cxx ) -ADD_DEFINITIONS( "-DHAVE_CONFIG_H -DCALL_OLD_METHODS ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${VTK_DEFINITIONS} ${PYTHON_DEFINITIONS}") +ADD_DEFINITIONS( "-DHAVE_CONFIG_H -DCALL_OLD_METHODS ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS}") ADD_LIBRARY(SalomePyQtGUILight ${SalomePyQtGUI_SOURCES} ${GUI_HEADERS_MOC} ${SIP_SRC}) TARGET_LINK_LIBRARIES(SalomePyQtGUILight ${COMMON_LIBS}) diff --git a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt index 112a17800..3953c503f 100755 --- a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt +++ b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} @@ -25,7 +27,6 @@ INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} - ${VTK_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} @@ -97,7 +98,7 @@ ENDFOREACH(input ${SIP_FILES}) SET(SalomePyQt_SOURCES SalomePyQt.cxx) # -DHAVE_CONFIG_H -ADD_DEFINITIONS("${QWT_DEFINITIONS} ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${VTK_DEFINITIONS} ${PYTHON_DEFINITIONS}") +ADD_DEFINITIONS("${QWT_DEFINITIONS} ${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS}") ADD_LIBRARY(SalomePyQt ${SalomePyQt_SOURCES} ${GUI_HEADERS_MOC} ${SIP_SRC}) TARGET_LINK_LIBRARIES(SalomePyQt ${COMMON_LIBS}) diff --git a/src/SALOME_SWIG/CMakeLists.txt b/src/SALOME_SWIG/CMakeLists.txt index 5b98e9aae..9c8752426 100755 --- a/src/SALOME_SWIG/CMakeLists.txt +++ b/src/SALOME_SWIG/CMakeLists.txt @@ -20,6 +20,7 @@ FIND_PACKAGE(SWIG REQUIRED) INCLUDE(${SWIG_USE_FILE}) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake) +INCLUDE(${VTK_USE_FILE}) SET_SOURCE_FILES_PROPERTIES(libSALOME_Swig.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(libSALOME_Swig.i PROPERTIES SWIG_DEFINITIONS "-shadow") @@ -30,7 +31,6 @@ INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} ${QWT_INCLUDE_DIR} - ${VTK_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} @@ -55,7 +55,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../Plot2d ) -ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${VTK_DEFINITIONS} ${BOOST_DEFINITIONS}) +ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${BOOST_DEFINITIONS}) SWIG_ADD_MODULE(libSALOME_Swig python libSALOME_Swig.i SALOMEGUI_Swig.cxx) SWIG_LINK_LIBRARIES(libSALOME_Swig LightApp ${PYTHON_LIBRARIES}) diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 5cad6454b..6326aab35 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -18,11 +18,11 @@ # INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/UseQT4EXT.cmake) +INCLUDE(${VTK_USE_FILE}) INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} - ${VTK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome @@ -36,7 +36,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../OpenGLUtils ) -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${VTK_DEFINITIONS} ${BOOST_DEFINITIONS}) +ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS}) SET(COMMON_LIBS qtx diff --git a/src/SalomeApp/CMakeLists.txt b/src/SalomeApp/CMakeLists.txt index ba95a0531..205fde4ea 100755 --- a/src/SalomeApp/CMakeLists.txt +++ b/src/SalomeApp/CMakeLists.txt @@ -27,11 +27,11 @@ ENDIF(CPPUNIT_IS_OK) INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/UseQT4EXT.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake) +INCLUDE(${VTK_USE_FILE}) INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} - ${VTK_INCLUDE_DIRS} ${QWT_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} @@ -135,7 +135,7 @@ SET(GUITS_SOURCES resources/SalomeApp_msg_fr.ts ) -ADD_DEFINITIONS(${QT_DEFINITIONS} ${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${VTK_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${QT_DEFINITIONS} ${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS}) ADD_LIBRARY(SalomeApp ${SalomeApp_SOURCES} ${GUI_HEADERS_MOC}) TARGET_LINK_LIBRARIES(SalomeApp ${COMMON_LIBS}) diff --git a/src/VTKViewer/CMakeLists.txt b/src/VTKViewer/CMakeLists.txt index 51780f7dd..0af80d69e 100755 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -17,18 +17,18 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/UseQT4EXT.cmake) +INCLUDE(${VTK_USE_FILE}) INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} - ${VTK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_CURRENT_SOURCE_DIR}/../Qtx ${CMAKE_CURRENT_SOURCE_DIR}/../SUIT ) -ADD_DEFINITIONS(${VTK_DEFINITIONS} ${CAS_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS}) SET(COMMON_LIBS ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${VTK_LIBRARIES} ${CAS_KERNEL} qtx suit ${SALOMELocalTrace}) diff --git a/tools/vtkEDFOverloads/CMakeLists.txt b/tools/vtkEDFOverloads/CMakeLists.txt index 70a9dcec6..9acde0292 100755 --- a/tools/vtkEDFOverloads/CMakeLists.txt +++ b/tools/vtkEDFOverloads/CMakeLists.txt @@ -17,11 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE_DIRECTORIES( - ${VTK_INCLUDE_DIRS} -) - -ADD_DEFINITIONS(${VTK_DEFINITIONS}) +INCLUDE(${VTK_USE_FILE}) ADD_LIBRARY(vtkTools vtkEDFCutter.cxx) TARGET_LINK_LIBRARIES(vtkTools ${VTK_LIBRARIES})