Commit b6da8ad7 authored by jcfr's avatar jcfr

ENH: ITKPython: Add support for optionally installing ITKPython Wrapping

This commit adds the option Slicer_INSTALL_ITKPython (default OFF) that
depends on Slicer_BUILD_ITKPython (also OFF by default).

When enabled, ITK Wrapping files will be installed and packaged along
side the Slicer application.
Co-authored-by: Jean-Christophe Fillion-Robin's avatarJean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>

From: Johan Andruejol <johan.andruejol@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24895 3bd1e089-480b-0410-8dfb-8563597acbee
parent 858d1a70
......@@ -17,6 +17,17 @@ if(NOT "${ITK_DIR}" STREQUAL "" AND EXISTS "${ITK_DIR}/CMakeCache.txt")
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ITK_DIR};ITK;libraries;/")
# HDF5 until ITK4. final, then it can be removed
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ITK_DIR};ITK;Unspecified;/")
# -------------------------------------------------------------------------
# Install ITKPython
# -------------------------------------------------------------------------
if(Slicer_INSTALL_ITKPython)
if("${Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER}" STREQUAL "")
message(FATAL_ERROR "To allow optional packaging of ITK Wrapping. Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER should never be empty")
endif()
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ITK_DIR};ITK;${Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER}RuntimeLibraries;/")
endif()
endif()
# -------------------------------------------------------------------------
......
......@@ -285,6 +285,10 @@ mark_as_superbuild(Slicer_USE_SimpleITK)
option(Slicer_BUILD_ITKPython "Build Python wrapping for ITK" OFF)
mark_as_superbuild(Slicer_BUILD_ITKPython)
CMAKE_DEPENDENT_OPTION(
Slicer_INSTALL_ITKPython "Install Slicer with Python wrapping for ITK" OFF
"Slicer_BUILD_ITKPython" OFF)
mark_as_superbuild(Slicer_INSTALL_ITKPython)
#
# SimpleITK has large internal libraries, which take an extremely long
......
......@@ -47,7 +47,18 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DPYTHON_EXECUTABLE:PATH=${PYTHON_EXECUTABLE}
)
endif()
if(Slicer_BUILD_ITKPython)
# Custom name for the components associated with ITK
# wrapping install rules enabling Slicer to optionally
# package ITK Wrapping in Slicer installer by simply
# toggling the Slicer_INSTALL_ITKPython option.
set(Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER "Wrapping")
mark_as_superbuild(Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING)
set(PY_SITE_PACKAGES_PATH ${pythonpath_subdir}/site-packages)
list(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
......@@ -55,6 +66,8 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE}
-DITK_USE_SYSTEM_SWIG:BOOL=ON
-DITK_LEGACY_SILENT:BOOL=ON
-DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=${Slicer_WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER}
-DPY_SITE_PACKAGES_PATH:STRING=${PY_SITE_PACKAGES_PATH}
)
endif()
......@@ -126,6 +139,13 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
)
endif()
#-----------------------------------------------------------------------------
# Launcher setting specific to install tree
# Since ITK Wrapping is installed in the Slicer standard site-packages
# location, there is no need to specify custom setting for the install
# case.
else()
ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
endif()
......
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