doc:devel:vtk
This is an old revision of the document!
−Table of Contents
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 490-493 : vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" << arg2->command << endl << Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0) << " at line number " << arg2->interp->errorLine); devient 496-499: vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" << arg2->command << endl << Tcl_GetVar(arg2->interp,(char *)("errorInfo"),0) << " at line number " << vtkTclGetErrorLine(this->Interp)); ligne 723-726 : 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 729-732: vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" << this->StringCommand << endl << Tcl_GetVar(this->Interp,(char *)("errorInfo"),0) << " at line number " << vtkTclGetErrorLine(this->Interp));
- Executer CMake : modifier les options suivante :
- BUILD_SHARED_LIBS : ON
- CMAKE_INSTALL_PREFIX :
VTK\VTKInstall
- VTK_DEBUG_LEAKS : OFF (pour une version à distribuer, peut-être ON pour debugger les )
- 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 & 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…
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}
dansF:\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 LibsF:\LibsVS2008\vtk\bin
- Copier les fichiers
F:\vtk-5.10.1\VTKInstallDebug\lib\vtk-5.10\*_d.lib
dans le répertoire de LibsF:\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 LibsF:\LibsVS2008\vtk\lib\vtk-5.10
- Installer les wrappers python : copier
F:\vtk-5.10.1\VTKBuildDebug\bin\Debug\*_d.pyd
dansF:\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
Windows (v. Luc)
- vtk : basé sur vtk-5.6.0
- Détarer les sources : E:\Dev64\Divers\vtk-5.6.0\VTK
- Créer le répertoire de compilation : E:\Dev64\Divers\vtk-5.6.0\VTK
- Modifier les sources VTK :
- DLL's VTK Debug : ajout du postfix “_d”
modifier "E:\Dev64\Divers\vtk-5.6.0\VTK\CMakeLists.txt" (ligne 80) : 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 "VTK/Cmake/KitCommonPythonWrapBlock.cmake" (ligne 43): 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)
- Utilisation de la lib python_d.dll en debug :
modifier "VTK/Common/vtkPython.h" ligne 35-48 remplacer : #if defined(VTK_WINDOWS_PYTHON_DEBUGGABLE) # include <Python.h> #else # ifdef _DEBUG # undef _DEBUG # if defined(_MSC_VER) && _MSC_VER >= 1400 # define _CRT_NOFORCE_MANIFEST 1 # endif # include <Python.h> # define _DEBUG # else # include <Python.h> # endif #endif par #include <Python.h>
- Executer CMake : modifier les options suivante :
- BUILD_SHARED_LIBS : ON
- CMAKE_INSTALL_PREFIX : E:\Dev64\Divers\vtk-5.6.0\vtkInstall
- VTK_DEBUG_LEAKS : ON
- VTK_USE_GL2PS : ON
- VTK_USE_QT : ON
- VTK_WRAP_PYTHON : ON
- VTK_WRAP_TCL : ON
- Les autres options doivent “suivre”
- Compiler (release et debug)
- Installer : via compilation du projet Install (release et debug)
- 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 “E:/Dev64/LibsVS2008” par “$ENV{METAFORLIBS_VS2008}” dans les fichiers :
- E:\Dev64\Divers\vtk-5.6.0\vtkInstall\lib\vtk-5.6\VTKConfig.cmake
- E:\Dev64\Divers\vtk-5.6.0\vtkInstall\lib\vtk-5.6\VTKConfigQt.cmake
- E:\Dev64\Divers\vtk-5.6.0\vtkInstall\lib\vtk-5.6\VTKLibraryDepends.cmake
- Copier le répertoire “E:\Dev64\Divers\vtk-5.6.0\vtkInstall” dans le répertoire de Libs : “E:\Dev64\LibsVS2008\vtk”
- Installer les wrappers python : copier “E:\Dev64\LibsVS2008\vtk\lib\site-packages” dans “E:\Dev64\LibsVS2008\Python\Lib\site-packages”
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.1377694064.txt.gz · Last modified: 2016/03/30 15:22 (external edit)