From 14e73bd95a6ab22cb59a2fb37707d4775c47958e Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Thu, 5 Sep 2013 13:35:07 -0400 Subject: [PATCH] Add CMake cache option for VTK_BUILD_PYTHON_MODULE_DIR This property allow ParaView to override the default VTK value ($BUILD/Wrapping/Python/) to be where ParaView expect its Python modules to be build. Change-Id: I5c2cc016356d7a4320f9f5c999225835abcd6bb1 --- CMake/vtkWrapPythonSIP.cmake | 2 +- CMakeLists.txt | 6 +++++- ThirdParty/AutobahnPython/CMakeLists.txt | 5 +---- ThirdParty/Twisted/CMakeLists.txt | 5 +---- ThirdParty/ZopeInterface/CMakeLists.txt | 5 +---- Utilities/Python/CMakeLists.txt | 9 +++++++-- Web/Python/CMakeLists.txt | 5 +---- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/CMake/vtkWrapPythonSIP.cmake b/CMake/vtkWrapPythonSIP.cmake index de53be3a86..42b3cc1c60 100644 --- a/CMake/vtkWrapPythonSIP.cmake +++ b/CMake/vtkWrapPythonSIP.cmake @@ -94,7 +94,7 @@ function(VTK_CREATE_SIP_MODULE KIT WRAP_SRCS) TARGET_LINK_LIBRARIES(vtk${KIT}PythonSIP vtk${KIT}PythonD) get_target_property(lib_loc vtk${KIT}PythonSIP LOCATION) ADD_CUSTOM_COMMAND(TARGET vtk${KIT}PythonSIP POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${lib_loc}" "${VTK_BINARY_DIR}/Wrapping/Python/vtk/" + COMMAND ${CMAKE_COMMAND} -E copy "${lib_loc}" "${VTK_BUILD_PYTHON_MODULE_DIR}/vtk/" ) IF(NOT VTK_INSTALL_NO_LIBRARIES) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d8a4c0f68..f1ea69b97f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,7 +119,11 @@ if(NOT VTK_INSTALL_PYTHON_MODULE_DIR) PATH "Directory where python modules will be installed") mark_as_advanced(VTK_INSTALL_PYTHON_MODULE_DIR) endif() - +if(NOT VTK_BUILD_PYTHON_MODULE_DIR) + set (VTK_BUILD_PYTHON_MODULE_DIR "-NOTFOUND" CACHE + PATH "Directory where python modules will be put inside the build tree") + mark_as_advanced(VTK_BUILD_PYTHON_MODULE_DIR) +endif() if (CMAKE_CROSSCOMPILING AND NOT COMPILE_TOOLS_IMPORTED) # if CMAKE_CROSSCOMPILING is true, we need to import build-tools targets. find_package(VTKCompileTools REQUIRED) diff --git a/ThirdParty/AutobahnPython/CMakeLists.txt b/ThirdParty/AutobahnPython/CMakeLists.txt index b5d391f2ee..22fc36cfad 100644 --- a/ThirdParty/AutobahnPython/CMakeLists.txt +++ b/ThirdParty/AutobahnPython/CMakeLists.txt @@ -9,11 +9,8 @@ if(NOT VTK_USE_SYSTEM_AUTOBAHN) include(vtkPythonPackages) - # Extract path where python module should be copied - get_property(pymodule_build_dir GLOBAL PROPERTY VTK_PYMODULE_BUILD_DIR) - set(AutobahnPython_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/autobahn") - set(AutobahnPython_BINARY_DIR "${pymodule_build_dir}/autobahn") + set(AutobahnPython_BINARY_DIR "${VTK_BUILD_PYTHON_MODULE_DIR}/autobahn") build_python_package("AutobahnPython" ${AutobahnPython_SOURCE_DIR} ${AutobahnPython_BINARY_DIR}) diff --git a/ThirdParty/Twisted/CMakeLists.txt b/ThirdParty/Twisted/CMakeLists.txt index ff9141da80..1e3e09b200 100644 --- a/ThirdParty/Twisted/CMakeLists.txt +++ b/ThirdParty/Twisted/CMakeLists.txt @@ -9,11 +9,8 @@ if(NOT VTK_USE_SYSTEM_TWISTED) include(vtkPythonPackages) - # Extract path where python module should be copied - get_property(pymodule_build_dir GLOBAL PROPERTY VTK_PYMODULE_BUILD_DIR) - set(Twisted_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/twisted") - set(Twisted_BINARY_DIR "${pymodule_build_dir}/twisted") + set(Twisted_BINARY_DIR "${VTK_BUILD_PYTHON_MODULE_DIR}/twisted") build_python_package("Twisted" ${Twisted_SOURCE_DIR} ${Twisted_BINARY_DIR}) diff --git a/ThirdParty/ZopeInterface/CMakeLists.txt b/ThirdParty/ZopeInterface/CMakeLists.txt index c8dc96048f..3e89851198 100644 --- a/ThirdParty/ZopeInterface/CMakeLists.txt +++ b/ThirdParty/ZopeInterface/CMakeLists.txt @@ -9,11 +9,8 @@ if(NOT VTK_USE_SYSTEM_ZOPE) include(vtkPythonPackages) - # Extract path where python module should be copied - get_property(pymodule_build_dir GLOBAL PROPERTY VTK_PYMODULE_BUILD_DIR) - set(zope_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zope") - set(zope_BINARY_DIR "${pymodule_build_dir}/zope") + set(zope_BINARY_DIR "${VTK_BUILD_PYTHON_MODULE_DIR}/zope") build_python_package("zope" ${zope_SOURCE_DIR} ${zope_BINARY_DIR}) diff --git a/Utilities/Python/CMakeLists.txt b/Utilities/Python/CMakeLists.txt index 78702d9d1c..86fe0511d3 100644 --- a/Utilities/Python/CMakeLists.txt +++ b/Utilities/Python/CMakeLists.txt @@ -32,5 +32,10 @@ if (NOT VTK_INSTALL_PYTHON_MODULE_DIR) CACHE PATH "Directory where python modules will be installed" FORCE) endif() -set_property(GLOBAL PROPERTY VTK_PYMODULE_BUILD_DIR - "${VTK_BINARY_DIR}/Wrapping/Python/") + +if (NOT VTK_BUILD_PYTHON_MODULE_DIR) + set(VTK_BUILD_PYTHON_MODULE_DIR + "${VTK_BINARY_DIR}/Wrapping/Python" + CACHE + PATH "Directory where python modules will be built" FORCE) +endif() diff --git a/Web/Python/CMakeLists.txt b/Web/Python/CMakeLists.txt index c5f20ad9d1..023d0fd2c5 100644 --- a/Web/Python/CMakeLists.txt +++ b/Web/Python/CMakeLists.txt @@ -5,11 +5,8 @@ find_package(PythonInterp) include(vtkPythonPackages) -# Extract path where python module should be copied -get_property(pymodule_build_dir GLOBAL PROPERTY VTK_PYMODULE_BUILD_DIR) - set(vtkWebPython_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(vtkWebPython_BINARY_DIR "${pymodule_build_dir}/vtk/web") +set(vtkWebPython_BINARY_DIR "${VTK_BUILD_PYTHON_MODULE_DIR}/vtk/web") build_python_package("vtkWebPython" ${vtkWebPython_SOURCE_DIR} ${vtkWebPython_BINARY_DIR}) -- GitLab