Commit fd734425 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

Fix building of python scripts when testing is off and disable the building on CMake 1.4 or older

parent 15adac2a
......@@ -285,11 +285,22 @@ IF (VTK_WRAP_PYTHON)
ENDIF (NOT VTK_BUILD_SHARED_LIBS)
ENDIF (VTK_WRAP_PYTHON)
# python executable is used by some tests
# whether VTK_WRAP_PYTHON is on or not.
# do not add a VTK_WRAP_PYTHON to this if.
# python executable is used by some tests whether VTK_WRAP_PYTHON is
# on or not. do not add a VTK_WRAP_PYTHON to this if.
SET(VTK_NEED_PYTHON_EXECUTABLE 0)
IF(BUILD_TESTING)
IF (DART_ROOT)
SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF (DART_ROOT)
ENDIF(BUILD_TESTING)
# If VTK_WRAP_PYTHON is on, then we need python executable to compile
# scripts.
IF(VTK_WRAP_PYTHON)
SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF(VTK_WRAP_PYTHON)
IF(VTK_NEED_PYTHON_EXECUTABLE)
FIND_PROGRAM(PYTHON_EXECUTABLE
NAMES python2.2 python2.1 python1.6 python1.5 python
PATHS
......@@ -301,8 +312,7 @@ IF(BUILD_TESTING)
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
)
MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
ENDIF (DART_ROOT)
ENDIF(BUILD_TESTING)
ENDIF(VTK_NEED_PYTHON_EXECUTABLE)
IF (VTK_WRAP_JAVA)
INCLUDE (${CMAKE_ROOT}/Modules/FindJNI.cmake)
......
......@@ -18,84 +18,6 @@ IF(VTK_USE_CARBON)
ENDIF(VTK_APPLE_RESOURCE)
ENDIF(VTK_USE_CARBON)
ADD_CUSTOM_TARGET(vtkpython_pyc ALL echo "...")
FOREACH(dir
${VTK_BINARY_DIR}/Wrapping/Python/vtk/gtk
${VTK_BINARY_DIR}/Wrapping/Python/vtk/qt
${VTK_BINARY_DIR}/Wrapping/Python/vtk/tk
${VTK_BINARY_DIR}/Wrapping/Python/vtk/util
${VTK_BINARY_DIR}/Wrapping/Python/vtk/wx
${VTK_BINARY_DIR}/Wrapping/Python/vtk/testing
${VTK_BINARY_DIR}/Wrapping/Python/vtk/test
)
MAKE_DIRECTORY(${dir})
ENDFOREACH(dir)
SET(VTK_PYTHON_LIBRARY_FILES "")
FOREACH(file
vtk/gtk/GtkVTKRenderWindow
vtk/gtk/__init__
vtk/gtk/GtkVTKRenderWindowInteractor
vtk/qt/QVTKRenderWidget
vtk/qt/__init__
vtk/qt/QVTKRenderWindowInteractor
vtk/__helper
vtk/__init__
vtk/common
vtk/filtering
vtk/graphics
vtk/hybrid
vtk/imaging
vtk/io
vtk/parallel
vtk/patented
vtk/rendering
vtk/required
vtk/tk/__init__
vtk/tk/vtkLoadPythonTkWidgets
vtk/tk/vtkTkImageViewerWidget
vtk/tk/vtkTkRenderWidget
vtk/tk/vtkTkRenderWindowInteractor
vtk/tk/vtkTkPhotoImage
vtk/util/__init__
vtk/util/vtkMethodParser
vtk/util/misc
vtk/util/vtkConstants
vtk/util/vtkImageExportToArray
vtk/util/vtkImageImportFromArray
vtk/util/colors
vtk/wx/__init__
vtk/wx/wxVTKRenderWindow
vtk/wx/wxVTKRenderWindowInteractor
vtk/test/BlackBox
vtk/test/Testing
vtk/test/__init__
QVTKRenderWidget
vtkRenderWidget
vtkTkImageViewerWidget
vtkTkRenderWidget
vtkpython
vtkpythontk
wxVTKRenderWindow
)
SET(src "${VTK_SOURCE_DIR}/Wrapping/Python/${file}.py")
SET(tgt "${VTK_BINARY_DIR}/Wrapping/Python/${file}.pyc")
ADD_CUSTOM_COMMAND(SOURCE ${src}
COMMAND ${PYTHON_EXECUTABLE}
ARGS -c "\"import" "py_compile;py_compile.compile('${src}','${tgt}','${tgt}')\""
TARGET vtkpython_pyc
OUTPUTS ${tgt}
)
SET(VTK_PYTHON_LIBRARY_FILES ${VTK_PYTHON_LIBRARY_FILES} ${tgt})
ENDFOREACH(file)
ADD_CUSTOM_COMMAND(
SOURCE vtkpython_pyc
COMMAND echo
ARGS ".."
DEPENDS ${VTK_PYTHON_LIBRARY_FILES}
TARGET vtkpython_pyc
)
FIND_LIBRARY(UTIL_LIBRARY
NAMES util
......@@ -178,6 +100,95 @@ ENDIF (VTK_USE_PARALLEL)
INSTALL_TARGETS(/bin vtkpython)
# Precompile python scripts
SET(VTK_COMPILE_PYTHON_SCRIPTS 0)
IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
SET(VTK_COMPILE_PYTHON_SCRIPTS 1)
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
IF(NOT PYTHON_EXECUTABLE)
SET(VTK_COMPILE_PYTHON_SCRIPTS 0)
ENDIF(NOT PYTHON_EXECUTABLE)
IF(VTK_COMPILE_PYTHON_SCRIPTS)
ADD_CUSTOM_TARGET(vtkpython_pyc ALL echo "...")
FOREACH(dir
${VTK_BINARY_DIR}/Wrapping/Python/vtk/gtk
${VTK_BINARY_DIR}/Wrapping/Python/vtk/qt
${VTK_BINARY_DIR}/Wrapping/Python/vtk/tk
${VTK_BINARY_DIR}/Wrapping/Python/vtk/util
${VTK_BINARY_DIR}/Wrapping/Python/vtk/wx
${VTK_BINARY_DIR}/Wrapping/Python/vtk/testing
${VTK_BINARY_DIR}/Wrapping/Python/vtk/test
)
MAKE_DIRECTORY(${dir})
ENDFOREACH(dir)
SET(VTK_PYTHON_LIBRARY_FILES "")
FOREACH(file
vtk/gtk/GtkVTKRenderWindow
vtk/gtk/__init__
vtk/gtk/GtkVTKRenderWindowInteractor
vtk/qt/QVTKRenderWidget
vtk/qt/__init__
vtk/qt/QVTKRenderWindowInteractor
vtk/__helper
vtk/__init__
vtk/common
vtk/filtering
vtk/graphics
vtk/hybrid
vtk/imaging
vtk/io
vtk/parallel
vtk/patented
vtk/rendering
vtk/required
vtk/tk/__init__
vtk/tk/vtkLoadPythonTkWidgets
vtk/tk/vtkTkImageViewerWidget
vtk/tk/vtkTkRenderWidget
vtk/tk/vtkTkRenderWindowInteractor
vtk/tk/vtkTkPhotoImage
vtk/util/__init__
vtk/util/vtkMethodParser
vtk/util/misc
vtk/util/vtkConstants
vtk/util/vtkImageExportToArray
vtk/util/vtkImageImportFromArray
vtk/util/colors
vtk/wx/__init__
vtk/wx/wxVTKRenderWindow
vtk/wx/wxVTKRenderWindowInteractor
vtk/test/BlackBox
vtk/test/Testing
vtk/test/__init__
QVTKRenderWidget
vtkRenderWidget
vtkTkImageViewerWidget
vtkTkRenderWidget
vtkpython
vtkpythontk
wxVTKRenderWindow
)
SET(src "${VTK_SOURCE_DIR}/Wrapping/Python/${file}.py")
SET(tgt "${VTK_BINARY_DIR}/Wrapping/Python/${file}.pyc")
ADD_CUSTOM_COMMAND(SOURCE ${src}
COMMAND ${PYTHON_EXECUTABLE}
ARGS -c "\"import" "py_compile;py_compile.compile('${src}','${tgt}','${tgt}')\""
TARGET vtkpython_pyc
OUTPUTS ${tgt}
)
SET(VTK_PYTHON_LIBRARY_FILES ${VTK_PYTHON_LIBRARY_FILES} ${tgt})
ENDFOREACH(file)
ADD_CUSTOM_COMMAND(
SOURCE vtkpython_pyc
COMMAND echo
ARGS ".."
DEPENDS ${VTK_PYTHON_LIBRARY_FILES}
TARGET vtkpython_pyc
)
ENDIF(VTK_COMPILE_PYTHON_SCRIPTS)
# Allow the user to customize their build with some local options
#
INCLUDE (${VTK_BINARY_DIR}/Wrapping/Tcl/LocalUserOptions.cmake OPTIONAL)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment