1 #! This CMake macro installs the python runtime with
2 #! all python related libraries and toolkits. Py files are
3 #! searched one by one with a globbing expression to generate a list used
4 #! by the mac and NSIS installer.
7 #! _python_libs Returns a list of the installed libraries. Used to fixup the bundle.
8 #! _app_bundle App bundle name in case of a Apple bundle.
12 # install the python runtime from the superbuild
13 if(NOT MITK_USE_SYSTEM_PYTHON)
15 # find package sets the python version numbers
16 find_package(PythonLibs REQUIRED)
17 find_package(PythonInterp REQUIRED)
22 # set the destination bundle
25 set(_destination ${_app_bundle})
29 list(APPEND _python_dirs "${MITK_EXTERNAL_PROJECT_PREFIX}/lib
")
30 set(PYTHON_LIB_SUFFIX ".so
")
31 set(_py_include_postfix python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/) # add the slash here so windows and unix will work with same code
32 set(_python_runtime_dir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/)
34 list(APPEND _python_dirs "${MITK_EXTERNAL_PROJECT_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/Lib
")
35 #list(APPEND _python_dirs "${Python_DIR}/bin
")
36 set(PYTHON_LIB_SUFFIX .pyd)
37 set(_py_include_postfix )
38 set(_python_runtime_dir )
39 set(_search_path "${MITK_EXTERNAL_PROJECT_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/bin
")
42 file(GLOB_RECURSE item RELATIVE "${_python_dirs}/${_python_runtime_dir}
" "${_python_dirs}/${_python_runtime_dir}*
")
44 get_filename_component(_filepath "${f}
" PATH)
46 #message("filepath:
" ${_filepath})
47 install(FILES "${_python_dirs}/${_python_runtime_dir}${f}
" DESTINATION "${_destination}/Python/lib/${_python_runtime_dir}${_filepath}
")
49 #MESSAGE("in:
" "${_python_dirs}/${_python_runtime_dir}${f}
")
50 #MESSAGE("out:
" "${_destination}/Python/lib/${_python_runtime_dir}${_filepath}
")
51 if(${f} MATCHES "(${PYTHON_LIB_SUFFIX})$
")
52 #MESSAGE("F:
" "Python/lib/${_python_runtime_dir}${f}
")
53 list(APPEND _python_libs "Python/lib/${_python_runtime_dir}${f}
")
54 if(UNIX AND NOT APPLE)
55 install(CODE "file(RPATH_REMOVE
56 FILE \
"\${CMAKE_INSTALL_PREFIX}/bin/Python/lib/${_python_runtime_dir}${f}\")")
61 # config will by read out at runtime
62 install(FILES
"${PYTHON_INCLUDE_DIR}/pyconfig.h" DESTINATION ${_destination}/Python/include/${_py_include_postfix})
64 set(${_python_libs_out} ${_python_libs} PARENT_SCOPE)
65 set(${_search_path_out} ${_search_path} PARENT_SCOPE)
mitkFunctionInstallPython(_python_libs_out, _search_path_out, _app_bundle)
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)