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) / Luc (version 140109)
- Détarer les sources : VTK\vtk-5.10.1
- Créer le répertoire de compilation : VTK\VTKBuild
- Modifier les sources VTK :
- VTK Debug : ajout du postfix “_d” aux DLL's : modifier “VTK\vtk-5.10.1\CMakeLists.txt ligne 107”
# 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) SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES} DEBUG_POSTFIX _d )
- Wrappers Python debug : postfix “_d” aux “pyd” : “VTK\vtk-5.10.1\Cmake\KitCommonPythonWrapBlock.cmake”
# 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
lignes 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 (Debug) (Commencer par debug)
- Installer
- Compiler ALL_BUILD (Release)
- Installer
Attention : certains fichiers debug seront écrasés par leur version release, mais normalement c'est les même … raison pour laquelle on démarre par la version 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 le lieu d'installation
E:\Dev64\…
par$ENV{METAFORLIBS}
dans les fichiers :VTK\VTKInstall\lib\vtk-5.10.1\VTKConfig.cmake
VTK\VTKInstall\lib\vtk-5.10.1\VTKConfigQt.cmake
VTK\VTKInstall\lib\vtk-5.10.1\VTKTargets-release.cmake
VTK\VTKInstall\lib\vtk-5.10.1\VTKTargets-debug.cmake
- idem pour les chemins vers tcl/tk,
$ENV{METAFORLIBS}/TclTk-8.5.15/…
- includes de vtk_freetype, vtk_libproj4, vtk_dhf5 dans les même fichiers
SET(VTK_FREETYPE_INCLUDE_DIR “$ENV{METAFORLIBS}/Vtk-5.10.1_tcltk85/include/vtk-5.10/vtkfreetype/include”)
SET(VTK_LIBPROJ4_INCLUDE_DIR “$ENV{METAFORLIBS}/Vtk-5.10.1_tcltk85/include/vtk-5.10/vtklibproj4”)
SET(VTK_HDF5_INCLUDE_DIR “$ENV{METAFORLIBS}/Vtk-5.10.1_tcltk85/include/vtk-5.10/vtkhdf5”)
- enlever les chemins absolu vers “vtkMathConfigure.h” et “vtkConfigure.h” dans
VTK\VTKInstall\lib\vtk-5.10.1\vtkCommonKit.cmake)
- Copier le répertoire
VTK\VTKInstall
dans le répertoire de Libs :LibsVS2012\vtk-5.10.1
- Installer les wrappers python (crée le répertoire LibsVS2012\Python\Lib\site_packages\VTK-5.10.1-py2.6.egg):
- ouvrir une invite de commande et aller dans
VTK\VTKBuild\Wrapping\Python
python setup.py install BUILD_TYPE=Release
python setup.py install BUILD_TYPE=Debug
- Vérification: faire un import vtk dans python.exe & dans python_d.exe
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 (Debug) (Commencer par debug)
- Installer
- Compiler ALL_BUILD (Release)
- Installer
Attention : certains fichiers debug seront écrasés par leur version release, mais normalement c'est les même … raison pour laquelle on démarre par la version 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
\VTK\VTKInstall
par$ENV{METAFORLIBS}
dans les fichiers :VTK\VTKInstall\lib\vtk-5.10.1\VTKConfig.cmake
VTK\VTKInstall\lib\vtk-5.10.1\VTKConfigQt.cmake
VTK\VTKInstall\lib\vtk-5.10.1\VTKTargets-release.cmake
- Copier le répertoire
VTK\VTKInstall
dans le répertoire de Libs :LibsVS2012\vtk-5.10.1
- Installer les wrappers python (crée le répertoire LibsVS2012\Python\Lib\site_packages\VTK-5.10.1-py2.6.egg):
- ouvrir une invite de commande et aller dans
VTK\VTKBuild\Wrapping\Python
python setup.py install BUILD_TYPE=Release
python setup.py install BUILD_TYPE=Debug
- Vérification: faire un import vtk dans python.exe & dans python_d.exe
doc/devel/vtk.1389269256.txt.gz · Last modified: 2016/03/30 15:22 (external edit)