Metafor

ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


doc:devel:vtk

This is an old revision of the document!


Compiler VTK pour Metafor

memo comment compiler vtk (5.10.1) pour les Libs

Windows : Release & Debug / Wrapper vtk-python (r&d) / Marlène & Luc

  • Détarer les sources : VTK\vtk-5.10.1
  • Créer le répertoire de compilation : VTK\VTKBuild
  • Modifier les sources VTK : link_directories modifier “VTK\vtk-5.10.1\UseVTK.cmake.in”
ligne 28-29  :
  # Add include directories needed to use VTK.
  INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
devient 28-31: 
  # Add include directories needed to use VTK.
  INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
  # Add link directories needed to use VTK.
  LINK_DIRECTORIES(${VTK_LIBRARY_DIRS})  
  • VTK Debug : ajout du postfix “_d” aux DLL's : modifier “VTK\vtk-5.10.1\CMakeLists.txt”
ligne 95-103 :

  # Append the library version information to the library target
  # properties.  A parent project may set its own properties and/or may
  # block this.
  IF(NOT VTK_NO_LIBRARY_VERSION)
    SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
      VERSION "${VTK_VERSION}"
      SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
      )
  ENDIF(NOT VTK_NO_LIBRARY_VERSION)

devient ligne 95-104:

  # Append the library version information to the library target
  # properties.  A parent project may set its own properties and/or may
  # block this.
  IF(NOT VTK_NO_LIBRARY_VERSION)
    SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
      VERSION "${VTK_VERSION}"
      SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
      )    
    SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES} DEBUG_POSTFIX _d )
  ENDIF(NOT VTK_NO_LIBRARY_VERSION)
  • Wrappers Python debug : postfix “_d” aux “pyd” : “VTK\vtk-5.10.1\Cmake\KitCommonPythonWrapBlock.cmake”
ligne 58-63

  # Python extension modules on Windows must have the extension ".pyd"
  # instead of ".dll" as of Python 2.5.  Older python versions do support
  # this suffix.
  IF(WIN32 AND NOT CYGWIN)
    SET_TARGET_PROPERTIES(vtk${KIT}Python PROPERTIES SUFFIX ".pyd")
  ENDIF(WIN32 AND NOT CYGWIN)

devient 58-64:

  # Python extension modules on Windows must have the extension ".pyd"
  # instead of ".dll" as of Python 2.5.  Older python versions do support
  # this suffix.
  IF(WIN32 AND NOT CYGWIN)
    SET_TARGET_PROPERTIES(vtk${KIT}Python PROPERTIES SUFFIX ".pyd")
    SET_TARGET_PROPERTIES(vtk${KIT}Python PROPERTIES DEBUG_POSTFIX "_d")
  ENDIF(WIN32 AND NOT CYGWIN)
  • installation des wrappers python_d : modifier VTK\vtk-5.10.1\Wrapping\Python\setup.py.in
ligne 85-97 :

  def get_libs():
      """Returns a list of libraries to be installed.  """
      libs = []
  
      # Select platform-specific components of the module file names.
      if os.name == 'posix':
          dir = vtk_lib_dir
          prefix = 'vtk'
          suffix = get_config_var('SO')
      else:
          dir = vtk_bin_dir.replace('/', '\\')
          prefix = 'vtk'
          suffix = '.pyd'
                     
devient 85-100 :

  def get_libs():
      """Returns a list of libraries to be installed.  """
      libs = []

      # Select platform-specific components of the module file names.
      if os.name == 'posix':
          dir = vtk_lib_dir
          prefix = 'vtk'
          suffix = get_config_var('SO')
      else:
          dir = vtk_bin_dir.replace('/', '\\')
          prefix = 'vtk'
          if vtk_build_type == 'Debug':
              suffix = '_d.pyd'
          else:
              suffix = '.pyd'
  • patcher vtktclutil.cxx pour utilisation tcltk8.6:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sci-libs/vtk/files/vtk-5.10.1-tcl8.6.patch

  "/VTK/vtk-5.10.1/Common/vtkTclUtil.cxx"
ligne 21 - 24 :
  #include <string>
  #include <vtksys/SystemTools.hxx>

  extern "C"

devient 21-30 : 
  #include <string>
  #include <vtksys/SystemTools.hxx>

  #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
  #define vtkTclGetErrorLine(m) (m->errorLine)
  #else
  #define vtkTclGetErrorLine(m) (Tcl_GetErrorLine(m))
  #endif

  extern "C"

ligne 488-500 :
    if (Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0))
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             arg2->command << endl <<
                             Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0) <<
                             " at line number " << arg2->interp->errorLine);
      }
    else
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             arg2->command << endl <<
                             " at line number " << arg2->interp->errorLine);
      }
      
devient 494-506:

    if (Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0))
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             arg2->command << endl <<
                             Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0) <<
                             " at line number " << vtkTclGetErrorLine(arg2->interp));
      }
    else
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             arg2->command << endl <<
                             " at line number " << vtkTclGetErrorLine(arg2->interp));
      }
 
ligne 721-732 : 
    if (Tcl_GetVar(this->Interp,(char *)("errorInfo"),0))
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             this->StringCommand << endl <<
                             Tcl_GetVar(this->Interp,(char *)("errorInfo"),0) <<
                             " at line number " << this->Interp->errorLine);
      }
    else
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             this->StringCommand << endl <<
                             " at line number " << this->Interp->errorLine);
      }
    }
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             this->StringCommand << endl <<
                             Tcl_GetVar(this->Interp,(char *)("errorInfo"),0) <<
                             " at line number " << this->Interp->errorLine);
devient 727-739:
    if (Tcl_GetVar(this->Interp,(char *)("errorInfo"),0))
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             this->StringCommand << endl <<
                             Tcl_GetVar(this->Interp,(char *)("errorInfo"),0) <<
                             " at line number " << vtkTclGetErrorLine(this->Interp));
      }
    else
      {
      vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
                             this->StringCommand << endl <<
                             " at line number " <<  vtkTclGetErrorLine(this->Interp));
      }
    }            
  • Executer CMake : modifier les options suivante :
    • BUILD_SHARED_LIBS : ON
    • CMAKE_INSTALL_PREFIX : ../VTKInstall (attention “../” pas “..\”)
    • CMAKE_CXX_MP_FLAG : ON (permet de compiler en parallele en local)
    • VTK_DEBUG_LEAKS : OFF (pour une version à distribuer, peut-être ON pour developpement)
    • VTK_USE_GL2PS : ON (advanced option)
    • VTK_USE_QT : ON
    • VTK_WRAP_PYTHON : ON
    • VTK_WRAP_TCL : ON
    • Les autres options doivent “suivre” : (qt (definir qmake suffit généralement), python (Include, lib, libdebug), tcl/tk (include, lib, exe))
  • Compiler ALL_BUILD (Release)
  • Installer & renommer le répertoire d'installation en VTKInstallRelease
Attention : ne pas oublier de renommer (ou backuper d'autre part le répertoire d'install). sinon, certains fichiers seront ecrasés par la version debug…
  • Compiler ALL_BUILD (Debug)
  • Installer & renommer le répertoire d'installation en VTKInstallDebug
  • merger les repertoires d'install:
  • Modifier les chemins relatifs des librairies en variables d'environnement : VTK conserve les chemins absolus vers les librairies utilisées lors de la compilation (qt, …) ce qui est incompatible avec les Libs déplaçables.
    • remplacer F:/LibsVS2008 par $ENV{METAFORLIBS_VS2008} dans les fichiers :
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKConfig.cmake
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKConfigQt.cmake
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKTargets-release.cmake
  • Copier le répertoire F:\vtk-5.10.1\VTKInstall dans le répertoire de Libs : F:\LibsVS2008\vtk
  • Installer les wrappers python (crée le répertoire F:\LibsVS2008\Python\Lib\site_packages\VTK-5.10.1-py2.6.egg):

dans F:\vtk-5.10.1\VTKBuild\Wrapping\Python ouvrir une invite de commande et taper : python setup.py install BUILD_TYPE=Release

Vérification: faire un import vtk dans python

Windows (compatible python_d pour vtk 5.10) - v. Marlène

vtk : basé sur vtk-5.10.1 (les libs de luc sont dans “F:/LibsVS2008”)

deux projets différents: un en release et un en debug

Release

  • Détarer les sources : F:\vtk-5.10.1\VTKSource
  • Créer le répertoire de compilation : F:\vtk-5.10.1\VTKBuild
  • Créer le répertoire d'installation: F:\vtk-5.10.1\VTKInstall
  • Modifier les sources VTK : link_directories
 modifier "F:\vtk-5.10.1\VTKSource\UseVTK.cmake.in"  :
Ajouter :
  # Add link directories needed to use VTK.
  LINK_DIRECTORIES(${VTK_LIBRARY_DIRS})
après
  INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
  • Executer CMake : modifier les options suivante (cfr config de luc ci-dessous) :
    • BUILD_SHARED_LIBS : ON
    • CMAKE_INSTALL_PREFIX : F:\vtk-5.10.1\VTKInstall
    • VTK_DEBUG_LEAKS : OFF (pour une version à distribuer, peut-être ON sinon)
    • VTK_USE_GL2PS : ON
    • VTK_USE_QT : ON
    • VTK_WRAP_PYTHON : ON
    • VTK_WRAP_TCL : ON
    • Les autres options doivent “suivre”
  • Compiler ALL_BUILD (Release)
  • Installer : via compilation du projet INSTALL (Release)
  • Modifier les chemins relatifs des librairies en variables d'environnement : VTK conserve les chemins absolus vers les librairies utilisées lors de la compilation (qt, …) ce qui est incompatible avec les Libs déplaçables.
    • remplacer F:/LibsVS2008 par $ENV{METAFORLIBS_VS2008} dans les fichiers :
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKConfig.cmake
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKConfigQt.cmake
      • F:\vtk-5.10.1\VTKInstall\lib\vtk-5.6\VTKTargets-release.cmake
  • Copier le répertoire F:\vtk-5.10.1\VTKInstall dans le répertoire de Libs : F:\LibsVS2008\vtk
  • Installer les wrappers python (crée le répertoire F:\LibsVS2008\Python\Lib\site_packages\VTK-5.10.1-py2.6.egg):

dans F:\vtk-5.10.1\VTKBuild\Wrapping\Python ouvrir une invite de commande et taper : python setup.py install BUILD_TYPE=Release

Vérification: faire un import vtk dans python

Debug

  • Détarer les sources (ou copier celle de F:\vtk-5.10.1\VTKSource) : F:\vtk-5.10.1\VTKSourceDebug
  • Créer le répertoire de compilation : F:\vtk-5.10.1\VTKBuildDebug
  • Créer le répertoire d'installation: F:\vtk-5.10.1\VTKInstallDebug
  • Modifier les sources VTK :
    • link_directories:
 modifier (si on a détarré!, si on a copié F:\vtk-5.10.1\VTKSource alors c'est déjà fait) "F:\vtk-5.10.1\VTKSourceDebug\UseVTK.cmake.in"  :
Ajouter :
  # Add link directories needed to use VTK.
  LINK_DIRECTORIES(${VTK_LIBRARY_DIRS})
après
  INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
  • DLL's VTK Debug : ajout du postfix “_d”
 modifier "F:\vtk-5.10.1\VTKSourceDebug\CMakeLists.txt" (ligne 103) :
Ajouter la propriété :
    SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES} DEBUG_POSTFIX _d )
dans le tests : 
    IF(NOT VTK_NO_LIBRARY_VERSION)    

soit : 
IF(NOT VTK_NO_LIBRARY_VERSION)
  SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
    VERSION "${VTK_VERSION}"
    SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
    )
  SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
    DEBUG_POSTFIX _d
    )
ENDIF(NOT VTK_NO_LIBRARY_VERSION)
  • Wrappers Python debug : postfix “_d” aux “pyd”
modifier "F:\vtk-5.10.1\VTKSourceDebug\Cmake\KitCommonPythonWrapBlock.cmake" (ligne 63):
  IF(WIN32 AND NOT CYGWIN)
    SET_TARGET_PROPERTIES(vtk${KIT}Python PROPERTIES SUFFIX ".pyd")
    SET_TARGET_PROPERTIES(vtk${KIT}Python PROPERTIES DEBUG_POSTFIX "_d")
  ENDIF(WIN32 AND NOT CYGWIN)
  • Executer CMake : modifier les options suivante (cfr config de luc ci-dessous) :
    • PYTHON_EXECUTABLE : aller chercher le path de python_d.exe
    • CMAKE_CONFIGURATION_TYPE : Debug
    • BUILD_SHARED_LIBS : ON
    • CMAKE_INSTALL_PREFIX : F:\vtk-5.10.1\VTKInstallDebug
    • VTK_DEBUG_LEAKS : OFF (pour une version à distribuer, peut-être ON sinon)
    • VTK_USE_GL2PS : ON
    • VTK_USE_QT : ON
    • VTK_WRAP_PYTHON : ON
    • VTK_WRAP_TCL : ON
    • Les autres options doivent “suivre”
  • Compiler ALL_BUILD (Debug)
  • Installer : via compilation du projet INSTALL (Debug)
  • Modifier les chemins relatifs des librairies en variables d'environnement : remplacer F:/LibsVS2008 par $ENV{METAFORLIBS_VS2008} dans F:\vtk-5.10.1\VTKInstallDebug\lib\vtk-5.10\VTKTargets-debug.cmake
  • Copier les fichiers F:\vtk-5.10.1\VTKInstallDebug\bin\*_d.dll dans le répertoire de Libs F:\LibsVS2008\vtk\bin
  • Copier les fichiers F:\vtk-5.10.1\VTKInstallDebug\lib\vtk-5.10\*_d.lib dans le répertoire de Libs F:\LibsVS2008\vtk\lib\vtk-5.10
  • Copier le fichier F:\vtk-5.10.1\VTKInstallDebug\lib\vtk-5.10\VTKTargets-debug.cmake dans le répertoire de Libs F:\LibsVS2008\vtk\lib\vtk-5.10
  • Installer les wrappers python : copier F:\vtk-5.10.1\VTKBuildDebug\bin\Debug\*_d.pyd dans F:\LibsVS2008\Python\Lib\site_packages\VTK-5.10.1-py2.6.egg\vtk

Vérification: faire un import vtk dans python_d

Compiler Metafor

Pour compiler Metafor avec ces libs, changer le numero de version vtk dans le chemin de ZLIB dans la config cmake

Linux - Old version to be updated ...

  • vtk : /opt/vtk-5.4.2
    • Détarer les sources (~/setup/vtk-5.4.2/VTK)
    • Créer un répertoire de compilation (~/setup/vtk-5.4.2/VTKBIN)
    • Aller dans le répertoire de compilation (~/setup/vtk-5.4.2/VTKBIN)
    • Lancer cmake interfacé : ccmake ../VTK
    • gérer les options : (celles à modifier. en “advanced mode [t])
      • BUILD_SHARED_LIBS : ON
      • CMAKE_INSTALL_PREFIX : /opt/vtk-5.4.2
      • VTK_WRAP_PYTHON : ON
      • VTK_WRAP_TCL : ON
      • VTK_USE_GL2PS : ON
      • VTK_USE_GUISUPPORT : ON
      • configure (et vérifier que les libs nécessaires sont présente) [c]
      • VTK_USE_QVTK : ON
      • configure (et vérifier que les libs nécessaires sont présente) [c]
      • DESIRED_QT_VERSION : 4
      • VTK_USE_QVTK_QTOPENGL : ON
      • configure [c]
      • generate makefiles & exit [g]
    • compiler - installer
      • gmake -j 16
      • sudo make install
    • installer le wrapper python
      • cd ~/setup/vtk-5.4.2/VTKBIN/Wrapping/Python
      • sudo python setup.py install
    • Ajouter le répertoire vtk dans le ldconfig (chemin des .so dans le système)
      • sudo echo /opt/vtk-5.4.2/lib/vtk-5.4 > /etc/ld.so.conf)
      • sudo ldconfig -v -f /etc/ld.so.conf
doc/devel/vtk.1377701878.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki