1 #! CMake function that runs a python build step from a setup.py script,
2 #! e.g. python setup.py build. This is used to build external python
3 #! libraries like numpy. The function takes the necessary build steps,
4 #! python executable etc. as arguments. The specific build command executed
5 #! by the runtime is passed as ARGN.
8 #! proj - The name of the project
9 #! step - Buildstep used to label the generated outputs, e.g. configure;build;install
10 #! _python_executable - The python executable
11 #! _bin_dir - The current binary from where commands are executed relative to it
12 #! ARGN - Python command that will be run in the _bin_dir/proj-src folder
13 #! e.g. setup.py build --someflags
17 # the specific python build command run by
this step
20 message(
"Running ${proj} ${step}: ${_python_executable} ${_command}")
22 set(_workdir
"${_bin_dir}/ep/src/${proj}")
23 set(_prefixdir "${_bin_dir}/ep/tmp
")
24 set(_python "${_python_executable}
")
26 foreach(_dir "${_workdir}
" "${_prefixdir}
")
27 if(NOT EXISTS "${_dir}
")
28 message(SEND_ERROR "The directory ${_dir} does not exist
")
34 STRING(REPLACE " " "\
" _workdir ${_workdir})
35 STRING(REPLACE " " "\
" _prefixdir ${_prefixdir})
36 STRING(REPLACE " " "\
" _python ${_python})
40 COMMAND ${_python} ${_command}
41 WORKING_DIRECTORY ${_workdir}
42 RESULT_VARIABLE result
45 OUTPUT_VARIABLE output
49 if(NOT ${result} EQUAL 0)
50 message("Error in: ${proj}: ${error}
")
51 message("Output
in: ${proj}: ${output}
")
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
mitkFunctionExternalPythonBuildStep(proj, step, _python_executable, _bin_dir)