]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix VTK 6 detection and usage with CMake
authorbarate <barate>
Fri, 8 Mar 2013 14:16:26 +0000 (14:16 +0000)
committerbarate <barate>
Fri, 8 Mar 2013 14:16:26 +0000 (14:16 +0000)
adm_local/cmake_files/FindSalomeVTK.cmake
src/SALOME_PY/CMakeLists.txt
src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt
src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/SALOME_SWIG/CMakeLists.txt
src/SVTK/CMakeLists.txt
src/SalomeApp/CMakeLists.txt
src/VTKViewer/CMakeLists.txt
tools/vtkEDFOverloads/CMakeLists.txt

index 6bf4b002bdb3e3da46b94750068974f1091e3753..0af466192a68e24b94d54e08e4571cc9acc90a54 100644 (file)
@@ -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)
index f52f4be841203fa80bcfac2414ffdf0a151592e8..867c5fa28458975c84a9507b78888d474cfd5de8 100755 (executable)
 # 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})
index fd50571498939e2937b82d81c7b0faff4eb453e6..c8e67e6d7a1f8c7299dfb4cd5b8c951d40f940a4 100755 (executable)
@@ -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})
index abb02c164b4f090b803462f7848aabdd5c4e0522..b0f472178def53d401a9240bef85b159d72318be 100755 (executable)
 # 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})
index 112a17800ec13d9b24020599c68f3e5f0e39b379..3953c503f40c4c7102c14f4db11f1b8c55df1b66 100755 (executable)
@@ -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})
index 5b98e9aaea67ee4d42b74e1699621d77a3e7f6ae..9c87524263d4c0c4d20011affc45a69e898f22a5 100755 (executable)
@@ -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})
index 5cad6454b0b0f6e47826e0dce8515b936a4176de..6326aab353f216b56a8a3bd5dfafec5688d48522 100755 (executable)
 #
 
 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
index ba95a0531046432252feea4c541f563c920730c4..205fde4ea479d1c8590c0c9ba294362ef34958d7 100755 (executable)
@@ -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})
index 51780f7dd732b98687b3d13b31757037046d75ec..0af80d69e9e17656880fa67401b070f6fc01d6ac 100755 (executable)
 # 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})
 
index 70a9dcec628e31a51804c8077b4fb341e56cf778..9acde02922cad45e1a9a934fa6933f525c5caf91 100755 (executable)
 # 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})