Commit baa51264 authored by blezek's avatar blezek
Browse files

ENH: Added weave to SuperBuild.

Weave is a Python library that allows C/C++ code to be "woven" into Python code.  This is usually done for performance reasons.  Weave has great integration with Numpy, and can be used to speed up image processing in Slicer3/Slicer4.


git-svn-id: http://svn.slicer.org/Slicer4/trunk@14346 3bd1e089-480b-0410-8dfb-8563597acbee
parent 5bf9671d
......@@ -338,6 +338,7 @@ endif()
set(CLAPACK_DEPENDENCIES)
set(NUMPY_DEPENDENCIES CLAPACK python)
set(scipy_DEPENDENCIES NUMPY)
set(weave_DEPENDENCIES python NUMPY)
set(VTK_DEPENDENCIES)
set(CTK_DEPENDENCIES VTK)
......@@ -369,6 +370,7 @@ if(Slicer3_USE_PYTHON OR Slicer3_USE_PYTHONQT)
if(Slicer3_BUILD_NUMPY)
include(External_CLAPACK)
include(External_NUMPY)
include(External_weave)
if(Slicer3_BUILD_SCIPY)
include(External_SciPy)
endif(Slicer3_BUILD_SCIPY)
......
# The Weave external project
set(weave_binary "${CMAKE_CURRENT_BINARY_DIR}/weave/")
# to configure weave we run a cmake -P script
# the script will create a site.cfg file
# then run python setup.py config to verify setup
# configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/weave_configure_step.cmake.in
# ${CMAKE_CURRENT_BINARY_DIR}/weave_configure_step.cmake @ONLY)
# to build weave we also run a cmake -P script.
# the script will set LD_LIBRARY_PATH so that
# python can run after it is built on linux
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/weave_make_step.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/weave_make_step.cmake @ONLY)
# create an external project to download weave,
# and configure and build it
message ( ${Slicer3_SOURCE_DIR}/Modules/Python/FilteredTractography/weave )
ExternalProject_Add(weave
# URL ${Slicer3_SOURCE_DIR}/Modules/Python/FilteredTractography/weave
SVN_REPOSITORY http://svn.slicer.org/Slicer3-lib-mirrors/trunk/weave
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/weave
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/weave
BUILD_COMMAND ${CMAKE_COMMAND}
-P ${CMAKE_CURRENT_BINARY_DIR}/weave_make_step.cmake
CONFIGURE_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
${weave_DEPENDENCIES}
)
message("Configuring WEAVE:\n@weave_binary@")
set(ENV{LD_LIBRARY_PATH} "@CMAKE_CURRENT_BINARY_DIR@/python-build/lib")
set(ENV{VS_UNICODE_OUTPUT} "")
execute_process(
COMMAND "@slicer_PYTHON_EXECUTABLE@" setup.py config
WORKING_DIRECTORY "@weave_source@"
RESULT_VARIABLE res
)
if(NOT ${res} EQUAL 0)
message(FATAL_ERROR "Error in config of Weave")
endif()
message("Weave config worked.")
message("Building WEAVE:\n@weave_binary@")
set(ENV{LD_LIBRARY_PATH} "@CMAKE_CURRENT_BINARY_DIR@/python-build/lib")
set(ENV{VS_UNICODE_OUTPUT} "")
execute_process(
COMMAND "@slicer_PYTHON_EXECUTABLE@" setup.py install
WORKING_DIRECTORY "@weave_source@"
RESULT_VARIABLE res
OUTPUT_VARIABLE WEAVE_OUT
OUTPUT_VARIABLE WEAVE_ERR)
if(NOT ${res} EQUAL 0)
message("WEAVE Errors detected: \n${WEAVE_OUT}\n${WEAVE_ERR}")
message(FATAL_ERROR "Error in config of Weave")
endif()
message("Weave build worked.")
Markdown is supported
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