diff --git a/CMake/mitkMacroInstall.cmake b/CMake/mitkMacroInstall.cmake index 8385998d6b..ab19f736da 100644 --- a/CMake/mitkMacroInstall.cmake +++ b/CMake/mitkMacroInstall.cmake @@ -1,192 +1,192 @@ # # MITK specific install macro # # On Mac everything is installed for each bundle listed in MACOSX_BUNDLE_NAMES # by replacing the DESTINATION parameter. Everything else is passed to the CMake INSTALL command # # Usage: MITK_INSTALL( ) # macro(MITK_INSTALL) set(ARGS ${ARGN}) set(install_directories "") list(FIND ARGS DESTINATION _destination_index) # set(_install_DESTINATION "") if(_destination_index GREATER -1) message(SEND_ERROR "MITK_INSTALL macro must not be called with a DESTINATION parameter.") ### This code was a try to replace a given DESTINATION #math(EXPR _destination_index ${_destination_index} + 1) #list(GET ARGS ${_destination_index} _install_DESTINATION) #string(REGEX REPLACE ^bin "" _install_DESTINATION ${_install_DESTINATION}) else() if(NOT MACOSX_BUNDLE_NAMES) install(${ARGS} DESTINATION bin) else() foreach(bundle_name ${MACOSX_BUNDLE_NAMES}) install(${ARGS} DESTINATION ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION}) endforeach() endif() endif() endmacro() # Fix _target_location # This is used in several install macros macro(_fixup_target) if(NOT intermediate_dir) if(WIN32 AND NOT MINGW) set(intermediate_dir Release) else() set(intermediate_dir .) endif() endif() set(_python_libs ) set(_python_dirs ) if(MITK_USE_Python) - include(mitkFunctionInstallPython) - mitkFunctionInstallPython(_python_libs _python_dirs "${_bundle_dest_dir}") + include(mitkMacroInstallPython) + mitkMacroInstallPython(_python_libs _python_dirs "${_bundle_dest_dir}") endif() mitkFunctionGetLibrarySearchPaths(_search_paths ${intermediate_dir}) install(CODE " set(_bundle_dest_dir \"${_bundle_dest_dir}\") if(_bundle_dest_dir) set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/\${_bundle_dest_dir}\") else() set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/bin\") endif() macro(gp_item_default_embedded_path_override item default_embedded_path_var) get_filename_component(_item_name \"\${item}\" NAME) get_filename_component(_item_path \"\${item}\" PATH) # We have to fix all path references to build trees for plugins if(NOT _item_path MATCHES \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\") # item with relative path or embedded path pointing to some build dir set(full_path \"full_path-NOTFOUND\") file(GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} ) list(LENGTH full_path full_path_length) if(full_path_length GREATER 1) list(GET full_path 0 full_path) endif() get_filename_component(_item_path \"\${full_path}\" PATH) endif() set(_plugins_path \"\${_bin_path}/plugins\") if(_item_path STREQUAL _plugins_path OR (_item_path MATCHES \"\${_plugins_path}/\" AND _item_name MATCHES \"liborg\") # this is for legacy BlueBerry bundle support ) # Only fix plugins message(\"override: \${item}\") message(\"found file: \${_item_path}/\${_item_name}\") if(APPLE) string(REPLACE \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir} @executable_path \${default_embedded_path_var} \"\${_item_path}\" ) else() set(\${default_embedded_path_var} \"\${_item_path}\") endif() message(\"override result: \${\${default_embedded_path_var}}\") endif() endmacro(gp_item_default_embedded_path_override) macro(gp_resolved_file_type_override file type) if(NOT APPLE) get_filename_component(_file_path \"\${file}\" PATH) get_filename_component(_file_name \"\${file}\" NAME) if(_file_path MATCHES \"^\${CMAKE_INSTALL_PREFIX}\") set(\${type} \"local\") endif() if(_file_name MATCHES gdiplus) set(\${type} \"system\") endif(_file_name MATCHES gdiplus) endif() endmacro(gp_resolved_file_type_override) if(NOT APPLE) macro(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) if(\${item} MATCHES \"blueberry_osgi\") get_filename_component(_item_name \${item} NAME) set(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\") set(\${resolved_var} 1) endif() endmacro() endif() if(\"${_install_GLOB_PLUGINS}\" STREQUAL \"TRUE\") set(GLOBBED_PLUGINS ) set(_bb_osgi_lib \"\${_bin_path}/liborg_blueberry_osgi${CMAKE_SHARED_LIBRARY_SUFFIX}\") if(EXISTS \"\${_bb_osgi_lib}\") list(APPEND GLOBBED_PLUGINS \"\${_bb_osgi_lib}\") endif() # Iterate over all sub-directories which contain plug-ins # (BlueBerry plug-ins, Qt plug-ins, and auto-load modules) file(GLOB _children \"\${_bin_path}/*\") foreach(_child \${_children}) if(IS_DIRECTORY \${_child}) set(_plugins ) set(_modules ) file(GLOB_RECURSE _plugins \"\${_child}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") if(_plugins) list(APPEND GLOBBED_PLUGINS \${_plugins}) endif() # Now glob for all modules which might have a different extensions. # E.g. on MacOS plugins could have a .dylib extension as well as a .so extension if(NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"\" AND NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") file(GLOB_RECURSE _modules \"\${_child}/*${CMAKE_SHARED_MODULE_SUFFIX}\") endif() if(_modules) list(APPEND GLOBBED_PLUGINS \${_modules}) endif() endif() endforeach() endif() set(PLUGINS ) foreach(_plugin ${_install_PLUGINS} \${GLOBBED_PLUGINS}) get_filename_component(_plugin_realpath \${_plugin} REALPATH) list(APPEND PLUGINS \${_plugin_realpath}) endforeach() foreach(_py_lib ${_python_libs}) list(APPEND PLUGINS \"\${_bin_path}/\${_py_lib}\") endforeach() if(PLUGINS) list(REMOVE_DUPLICATES PLUGINS) endif(PLUGINS) message(\"globbed plugins: \${PLUGINS}\") set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) set(DIRS \"${_search_paths}\") set(_additional_search_paths ${_install_LIBRARY_DIRS}) if(_additional_search_paths) set(DIRS \"\${DIRS};\${_additional_search_paths}\") endif() foreach(_plugin \${PLUGINS}) get_filename_component(_pluginpath \${_plugin} PATH) list(APPEND DIRS \"\${_pluginpath}\") endforeach(_plugin) foreach(_dir ${_python_dirs}) list(APPEND DIRS \"\${_dir}\") endforeach() list(REMOVE_DUPLICATES DIRS) # use custom version of BundleUtilities include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\") ") endmacro() diff --git a/CMake/mitkFunctionInstallPython.cmake b/CMake/mitkMacroInstallPython.cmake similarity index 97% rename from CMake/mitkFunctionInstallPython.cmake rename to CMake/mitkMacroInstallPython.cmake index 057582615b..1dce8ce261 100644 --- a/CMake/mitkFunctionInstallPython.cmake +++ b/CMake/mitkMacroInstallPython.cmake @@ -1,144 +1,144 @@ -#! This CMake function install the python runtime with +#! This CMake macro installs the python runtime with #! all python related libraries and toolkits. Py files are #! searched one by one with a globbing expression to generate a list used #! by the mac and NSIS installer. #! #! params: #! _python_libs Returns a list of the installed libraries. Used to fixup the bundle. #! _python_dirs Returns a list with the directories containig the dependencies #! to the installed libs. #! _app_bundle App bundle name in case of a Apple bundle. #! -function(mitkFunctionInstallPython _python_libs _python_dirs _app_bundle) +macro(mitkMacroInstallPython _python_libs _python_dirs _app_bundle) set(_destination bin) if(APPLE) set(_destination ${_app_bundle}) endif() if(UNIX) # apple and linux only supports .so as loadable extension set(PYTHON_LIB_SUFFIX .so) else(WIN32) # windows only supports pyd as loadable extension set(PYTHON_LIB_SUFFIX .pyd) endif() # SimpleITK if(MITK_USE_SimpleITK) install(FILES "${SimpleITK_DIR}/Wrapping/SimpleITK.py" DESTINATION ${_destination}/Python/SimpleITK ) install(FILES "${SimpleITK_DIR}/Wrapping/__init__.py" DESTINATION ${_destination}/Python/SimpleITK ) install(FILES "${SimpleITK_DIR}/Wrapping/_SimpleITK${PYTHON_LIB_SUFFIX}" DESTINATION ${_destination}/Python/SimpleITK ) if(UNIX AND NOT APPLE) install(CODE "file(RPATH_REMOVE FILE \"\${CMAKE_INSTALL_PREFIX}/bin/Python/SimpleITK/_SimpleITK${PYTHON_LIB_SUFFIX}\")") endif() list(APPEND _python_libs "Python/SimpleITK/_SimpleITK${PYTHON_LIB_SUFFIX}") list(APPEND _python_dirs "${SimpleITK_DIR}/lib") endif() # install OpenCV python wrapping if(MITK_USE_OpenCV) list(APPEND _python_libs "cv2${PYTHON_LIB_SUFFIX}") if(UNIX) install(FILES "${OpenCV_DIR}/lib/cv2${PYTHON_LIB_SUFFIX}" DESTINATION ${_destination}) else() install(FILES "${OpenCV_DIR}/lib/Release/cv2${PYTHON_LIB_SUFFIX}" DESTINATION ${_destination}) endif() if(UNIX AND NOT APPLE) install(CODE "file(RPATH_REMOVE FILE \"\${CMAKE_INSTALL_PREFIX}/bin/cv2${CMAKE_SHARED_LIBRARY_SUFFIX}\")") endif() list(APPEND _python_dirs "${OpenCV_DIR}/lib") endif() # install VTK python wrapping find_package(VTK REQUIRED) set(_VTK_PYTHON_TARGETS ) # find all vtk python wrapped targets foreach(_lib ${VTK_LIBRARIES}) # exclude system libs if(${_lib} MATCHES "^vtk.+") # use only python wrapped modules ( targets end with PythonD ) if(TARGET ${_lib}PythonD) list(APPEND _VTK_PYTHON_TARGETS ${_lib}Python) endif() endif() endforeach() # install the python modules and loaders foreach(_target ${_VTK_PYTHON_TARGETS}) # get the properties of the python wrapped target if( CMAKE_BUILD_TYPE STREQUAL "Debug") get_target_property(_target_lib "${_target}D" IMPORTED_LOCATION_DEBUG) else() get_target_property(_target_lib "${_target}D" IMPORTED_LOCATION_RELEASE) endif() get_filename_component(_filepath "${_target_lib}" PATH) install(FILES "${_filepath}/${_target}${PYTHON_LIB_SUFFIX}" DESTINATION ${_destination}) if(UNIX AND NOT APPLE ) install(CODE "file(RPATH_REMOVE FILE \"\${CMAKE_INSTALL_PREFIX}/bin/${_target}${PYTHON_LIB_SUFFIX}\")") endif() list(APPEND _python_libs "${_target}${PYTHON_LIB_SUFFIX}") endforeach() # install vtk python. This folder contains all *.py files for VTK module loading. # glob through all files, NSIS can't use directories file(GLOB_RECURSE item RELATIVE "${VTK_DIR}/Wrapping/Python/vtk" "${VTK_DIR}/Wrapping/Python/vtk/*.py") foreach(f ${item}) get_filename_component(_filepath "${f}" PATH) install(FILES "${VTK_DIR}/Wrapping/Python/vtk/${f}" DESTINATION ${_destination}/Python/vtk/${_filepath}) endforeach() list(APPEND _python_dirs "${VTK_DIR}/lib") # install the python runtime from the superbuild if(NOT MITK_USE_SYSTEM_PYTHON) if(UNIX) set(_python_runtime_dir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) list(APPEND _python_dirs "${Python_DIR}/lib") else() #WIN32 set(_python_runtime_dir Lib) list(APPEND _python_dirs "${Python_DIR}/libs") list(APPEND _python_dirs "${Python_DIR}/bin") endif() file(GLOB_RECURSE item RELATIVE "${Python_DIR}/${_python_runtime_dir}" "${Python_DIR}/${_python_runtime_dir}/*") foreach(f ${item}) get_filename_component(_filepath "${f}" PATH) install(FILES "${Python_DIR}/${_python_runtime_dir}/${f}" DESTINATION ${_destination}/Python/${_python_runtime_dir}/${_filepath}) endforeach() file(GLOB_RECURSE item RELATIVE "${Python_DIR}/include" "${Python_DIR}/include/*") foreach(f ${item}) get_filename_component(_filepath "${f}" PATH) install(FILES "${Python_DIR}/include/${f}" DESTINATION ${_destination}/Python/include/${_filepath}) endforeach() # Numpy is always build in an own runtime if(Numpy_DIR) # glob through all files, NSIS can't use directories file(GLOB_RECURSE item RELATIVE "${Numpy_DIR}/numpy" "${Numpy_DIR}/numpy/*") foreach(f ${item}) get_filename_component(_filepath "${f}" PATH) install(FILES "${Numpy_DIR}/numpy/${f}" DESTINATION ${_destination}/Python/numpy/${_filepath}) endforeach() endif() endif() list(REMOVE_DUPLICATES _python_dirs) -endfunction() +endmacro() diff --git a/CMakeExternals/Numpy.cmake b/CMakeExternals/Numpy.cmake index 55ca78fbe3..ebe5c8017c 100644 --- a/CMakeExternals/Numpy.cmake +++ b/CMakeExternals/Numpy.cmake @@ -1,113 +1,110 @@ #----------------------------------------------------------------------------- # Numpy #----------------------------------------------------------------------------- if( MITK_USE_Python AND NOT MITK_USE_SYSTEM_PYTHON ) # Sanity checks if(DEFINED Numpy_DIR AND NOT EXISTS ${Numpy_DIR}) message(FATAL_ERROR "Numpy_DIR variable is defined but corresponds to non-existing directory") endif() if( NOT DEFINED Numpy_DIR ) set(proj Numpy) set(${proj}_DEPENDENCIES Python) set(Numpy_DEPENDS ${proj}) set(_numpy_env " set(ENV{F77} \"\") set(ENV{F90} \"\") set(ENV{FFLAGS} \"\") set(ENV{ATLAS} \"None\") set(ENV{BLAS} \"None\") set(ENV{LAPACK} \"None\") set(ENV{MKL} \"None\") ") - set(_external_python_project ${CMAKE_BINARY_DIR}/mitkExternalPythonProject.cmake) + set(_external_python_project ${CMAKE_BINARY_DIR}/${proj}-cmake/mitkExternalPythonProject.cmake) file(WRITE ${_external_python_project} " ${_numpy_env} set(ENV{VS_UNICODE_OUTPUT} \"\") set(ENV{CC} \"${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}\") set(ENV{CFLAGS} \"${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}\") set(ENV{CXX} \"${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}\") set(ENV{CXXFLAGS} \"${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}\") set(ENV{LDFLAGS} \"${CMAKE_LINKER_FLAGS} ${CMAKE_LINKER_FLAGS_RELEASE}\") function(MITK_PYTHON_BUILD_STEP proj step) set(_command \${ARGN}) message(\"Running \${proj} \${step}:${PYTHON_EXECUTABLE} \${_command}\") execute_process( COMMAND ${PYTHON_EXECUTABLE} \${_command} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/\${proj}-src RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error ) set(output_file \"${CMAKE_BINARY_DIR}/\${proj}_\${step}_step_output.txt\") file(WRITE \${output_file} \${output}) set(error_file \"${CMAKE_BINARY_DIR}/\${proj}_\${step}_step_error.txt\") file(WRITE \${error_file} \${error}) if(NOT \${result} EQUAL 0) message(FATAL_ERROR \"Error in: \${proj}: \${error}\") endif() endfunction() ") # configure step - set(_configure_step ${CMAKE_BINARY_DIR}/${proj}_configure_step.cmake) + set(_configure_step ${CMAKE_BINARY_DIR}/${proj}-cmake/${proj}_configure_step.cmake) file(WRITE ${_configure_step} "include(\"${_external_python_project}\") file(WRITE \"${CMAKE_BINARY_DIR}/${proj}-src/site.cfg\" \"\") MITK_PYTHON_BUILD_STEP(${proj} configure setup.py config) ") # build step - set(_build_step ${CMAKE_BINARY_DIR}/${proj}_build_step.cmake) + set(_build_step ${CMAKE_BINARY_DIR}/${proj}-cmake/${proj}_build_step.cmake) file(WRITE ${_build_step} "include(\"${_external_python_project}\") MITK_PYTHON_BUILD_STEP(${proj} build setup.py build --fcompiler=none) ") # install step set(_install_dir ${Python_BUILD_DIR}) if(WIN32) STRING(REPLACE "/" "\\\\" _install_dir ${Python_DIR}) endif() - set(_install_step ${CMAKE_BINARY_DIR}/${proj}_install_step.cmake) + set(_install_step ${CMAKE_BINARY_DIR}/${proj}-cmake/${proj}_install_step.cmake) file(WRITE ${_install_step} "include(\"${_external_python_project}\") MITK_PYTHON_BUILD_STEP(${proj} install setup.py install --prefix=${_install_dir}) ") set(Numpy_URL "https://dl.dropboxusercontent.com/u/8367205/ExternalProjects/numpy-1.4.1.tar.gz") set(Numpy_MD5 "5c7b5349dc3161763f7f366ceb96516b") ExternalProject_Add(${proj} URL ${Numpy_URL} URL_MD5 ${Numpy_MD5} SOURCE_DIR ${proj}-src PREFIX ${proj}-cmake BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${_configure_step} BUILD_COMMAND ${CMAKE_COMMAND} -P ${_build_step} INSTALL_COMMAND ${CMAKE_COMMAND} -P ${_install_step} DEPENDS ${${proj}_DEPENDENCIES} ) - if(WIN32) - set(Numpy_DIR ${_install_dir}/Lib/site-packages) - else() - set(Numpy_DIR ${_install_dir}/lib/python2.7/site-packages) - endif() + set(Numpy_DIR ${MITK_PYTHON_SITE_DIR}/numpy) + else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif() endif() diff --git a/CMakeExternals/Python.cmake b/CMakeExternals/Python.cmake index c5ecdc69e2..eb08296e24 100644 --- a/CMakeExternals/Python.cmake +++ b/CMakeExternals/Python.cmake @@ -1,165 +1,165 @@ #---------------------------------------------------------------------- # Python #---------------------------------------------------------------------- if( MITK_USE_Python AND NOT MITK_USE_SYSTEM_PYTHON ) # Sanity checks if(DEFINED Python_DIR AND NOT EXISTS ${Python_DIR}) message(FATAL_ERROR "Python_DIR variable is defined but corresponds to non-existing directory") endif() if(NOT DEFINED Python_DIR) set(proj Python) set(proj_DEPENDENCIES ) set(Python_DEPENDS ${proj}) set(MITK_PYTHON_MAJOR_VERSION 2) set(MITK_PYTHON_MINOR_VERSION 7) set(MITK_PYTHON_PATCH_VERSION 3) set(PYTHON_SOURCE_PACKAGE Python-${MITK_PYTHON_MAJOR_VERSION}.${MITK_PYTHON_MINOR_VERSION}.${MITK_PYTHON_PATCH_VERSION}) set(PYTHON_SOURCE_DIR "${CMAKE_BINARY_DIR}/${PYTHON_SOURCE_PACKAGE}") # patch the VS compiler config if(WIN32) set(PYTHON_PATCH_COMMAND PATCH_COMMAND ${CMAKE_COMMAND} -DPYTHON_SOURCE_DIR:PATH=${PYTHON_SOURCE_DIR} -P ${CMAKE_CURRENT_LIST_DIR}/Patch${proj}.cmake) endif() # download the source code ExternalProject_Add(Python-src URL "https://dl.dropboxusercontent.com/u/8367205/ExternalProjects/${PYTHON_SOURCE_PACKAGE}.tgz" URL_MD5 "2cf641732ac23b18d139be077bd906cd" PREFIX ${CMAKE_BINARY_DIR}/${PYTHON_SOURCE_PACKAGE}-cmake SOURCE_DIR "${PYTHON_SOURCE_DIR}" ${PYTHON_PATCH_COMMAND} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) set(additional_cmake_cache_args ) list(APPEND additional_cmake_cache_args -DBUILTIN_ARRAY:BOOL=ON -DBUILTIN_AUDIOOP:BOOL=ON -DBUILTIN_BINASCII:BOOL=ON -DBUILTIN_BISECT:BOOL=ON -DBUILTIN_BSDB:BOOL=ON -DBUILTIN_BSSDB:BOOL=ON -DBUILTIN_BZ2:BOOL=ON -DBUILTIN_CMATH:BOOL=ON -DBUILTIN_COLLECTIONS:BOOL=ON -DBUILTIN_CODECS_CN:BOOL=ON -DBUILTIN_CODECS_HK:BOOL=ON -DBUILTIN_CODECS_ISO2022:BOOL=ON -DBUILTIN_CODECS_JP:BOOL=ON -DBUILTIN_CODECS_KR:BOOL=ON -DBUILTIN_CODECS_TW:BOOL=ON -DBUILTIN_CPICKLE:BOOL=ON -DBUILTIN_CRYPT:BOOL=ON -DBUILTIN_CSTRINGIO:BOOL=ON -DBUILTIN_CSV:BOOL=ON -DBUILTIN_CTYPES:BOOL=OFF #-DBUILTIN_CTYPES_TEST:BOOL=OFF #-DBUILTIN_CURSES:BOOL=ON -DBUILTIN_DATETIME:BOOL=ON -DBUILTIN_DBM:BOOL=ON -DBUILTIN_ELEMENTTREE:BOOL=ON -DBUILTIN_FCNTL:BOOL=ON -DBUILTIN_FUNCTOOLS:BOOL=ON -DBUILTIN_FUTURE_BUILTINS:BOOL=ON -DBULTIN_GDBM:BOOL=ON -DBUILTIN_GRP:BOOL=ON -DBUILTIN_HASHLIB:BOOL=ON -DBUILTIN_HEAPQ:BOOL=ON -DBUILTIN_HOTSHOT:BOOL=ON -DBUILTIN_IO:BOOL=ON -DBUILTIN_ITERTOOLS:BOOL=ON -DBUILTIN_JSON:BOOL=ON -DBUILTIN_LOCALE:BOOL=ON -DBUILTIN_LSPROF:BOOL=ON -DBUILTIN_MATH:BOOL=ON -DBUILTIN_MMAP:BOOL=ON -DBUILTIN_MULTIBYTECODEC:BOOL=ON -DBUILTIN_MD5:BOOL=ON -DBUILTIN_MULTIPROCESSING:BOOL=ON -DBUILTIN_NIS:BOOL=ON -DBUILTIN_NIT:BOOL=ON -DBUILTIN_OPERATOR:BOOL=ON -DBUILTIN_PARSER:BOOL=ON -DBUILTIN_POSIX:BOOL=ON -DBUILTIN_PWD:BOOL=ON -DBUILTIN_PYEXPAT:BOOL=ON -DBUILTIN_READLINE:BOOL=ON -DBUILTIN_RESOURCE:BOOL=ON -DBULTIN_RANDOM:BOOL=ON -DBUILTIN_SCPROXY:BOOL=OFF -DBUILTIN_SELECT:BOOL=ON -DBUILTIN_SHA:BOOL=ON -DBUILTIN_SHA256:BOOL=ON -DBUILTIN_SHA512:BOOL=ON -DBUILTIN_SOCKET:BOOL=ON -DBUILTIN_SPWD:BOOL=ON -DBUILTIN_SQLITE3:BOOL=OFF -DBUILTIN_SSL:BOOL=ON -DBUILTIN_STROP:BOOL=ON -DBUILTIN_STRUCT:BOOL=ON -DBUILTIN_SUBPROCESS:BOOL=ON -DBUILTIN_SYSLOG:BOOL=ON -DBUILTIN_TERMIOS:BOOL=ON #-DBUILTIN_TESTCAPI:BOOL=OFF -DBUILTIN_TIME:BOOL=ON -DBUILTIN_TKINTER:BOOL=ON -DBUILTIN_UNICODEDATA:BOOL=ON -DBUILTIN_WINREG:BOOL=ON -DBUILTIN_ZLIB:BOOL=ON ) # CMake build environment for python ExternalProject_Add(${proj} URL "https://dl.dropboxusercontent.com/u/8367205/ExternalProjects/python-cmake-buildsystem.tar.gz" URL_MD5 "171090922892acdaf1a155e22765d72d" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}-src PREFIX ${proj}-cmake BINARY_DIR ${proj}-build INSTALL_DIR ${proj}-install CMAKE_ARGS ${ep_common_args} -DCMAKE_INSTALL_PREFIX:PATH= CMAKE_CACHE_ARGS -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} #-DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED:BOOL=ON -DBUILD_STATIC:BOOL=OFF -DUSE_SYSTEM_LIBRARIES:BOOL=ON ${additional_cmake_cache_args} DEPENDS Python-src ${${proj}_DEPENDENCIES} ) set(Python_DIR "${CMAKE_BINARY_DIR}/${proj}-install") set(Python_BUILD_DIR "${CMAKE_BINARY_DIR}/${proj}-build") # use the python executable in the build dir for unix systems. The stripped # ones will cause conflicts if system libraries are present during the build/configure process # of opencv, since they will try to lookup the sys path first if no lib is directly # linked with it s path into the executable if(UNIX) set(PYTHON_EXECUTABLE "${Python_BUILD_DIR}/bin/python${CMAKE_EXECUTABLE_SUFFIX}") set(PYTHON_INCLUDE_DIR "${Python_DIR}/include/python${MITK_PYTHON_MAJOR_VERSION}.${MITK_PYTHON_MINOR_VERSION}") set(PYTHON_LIBRARY "${Python_BUILD_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}python${MITK_PYTHON_MAJOR_VERSION}.${MITK_PYTHON_MINOR_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(ENV{PYTHONHOME} "${Python_BUILD_DIR}") + set(MITK_PYTHON_SITE_DIR "${Python_BUILD_DIR}/lib/python${MITK_PYTHON_MAJOR_VERSION}.${MITK_PYTHON_MINOR_VERSION}/site-packages") else() set(PYTHON_EXECUTABLE "${Python_DIR}/bin/python${CMAKE_EXECUTABLE_SUFFIX}") set(PYTHON_INCLUDE_DIR "${Python_DIR}/include") set(PYTHON_LIBRARY "${Python_DIR}/libs/python${MITK_PYTHON_MAJOR_VERSION}${MITK_PYTHON_MINOR_VERSION}.lib") - set(ENV{PYTHONHOME} "${Python_DIR}") + set(MITK_PYTHON_SITE_DIR "${Python_DIR}/Lib/site-packages") endif() # get the name of the library get_filename_component(PYTHON_LIBRARY_NAME "${PYTHON_LIBRARY}" NAME) else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif() endif() diff --git a/Modules/Python/CMakeLists.txt b/Modules/Python/CMakeLists.txt index ce7157a583..afc64441af 100644 --- a/Modules/Python/CMakeLists.txt +++ b/Modules/Python/CMakeLists.txt @@ -1,21 +1,21 @@ if( MITK_USE_Python ) if(NOT MITK_USE_SYSTEM_PYTHON) add_definitions( -DUSE_MITK_BUILTIN_PYTHON ) - set(NUMPY_INCLUDE_DIR "${Numpy_DIR}/numpy/core/include") + set(NUMPY_INCLUDE_DIR "${Numpy_DIR}/core/include") endif() set(OpenCV_DEP ) if(MITK_USE_OpenCV) set(OpenCV_DEP OpenCV) endif() MITK_CREATE_MODULE( DEPENDS MitkCore EXPORT_DEFINE MITK_PYTHON_EXPORT PACKAGE_DEPENDS Qt4|QtGui CTK|CTKScriptingPythonCore+CTKScriptingPythonWidgets PythonLibs VTK|vtkPython+vtkWrappingPythonCore SimpleITK ${OpenCV_DEP} INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} ) configure_file(PythonPath.h.in "${CMAKE_CURRENT_BINARY_DIR}/PythonPath.h" @ONLY) add_subdirectory(Testing) endif()