diff --git a/CMake/mitkFunctionExternalPythonBuildStep.cmake b/CMake/mitkFunctionExternalPythonBuildStep.cmake index 5ac0e78199..3c96507c61 100644 --- a/CMake/mitkFunctionExternalPythonBuildStep.cmake +++ b/CMake/mitkFunctionExternalPythonBuildStep.cmake @@ -1,51 +1,54 @@ #! CMake function that runs a python build step from a setup.py script, #! e.g. python setup.py build. This is used to build external python #! libraries like numpy. The function takes the necessary build steps, #! python executable etc. as arguments. The specific build command executed #! by the runtime is passed as ARGN. #! #! params: #! proj - The name of the project #! step - Buildstep used to label the generated outputs, e.g. configure;build;install #! _python_executable - The python executable #! _bin_dir - The current binary from where commands are executed relative to it #! ARGN - Python command that will be run in the _bin_dir/proj-src folder #! e.g. setup.py build --someflags #! function(mitkFunctionExternalPythonBuildStep proj step _python_executable _bin_dir) # the specific python build command run by this step set(_command ${ARGN}) message("Running ${proj} ${step}: ${_python_executable} ${_command}") set(_workdir "${_bin_dir}/ep/src/${proj}") set(_prefixdir "${_bin_dir}/ep/tmp") set(_python "${_python_executable}") foreach(_dir "${_workdir}" "${_prefixdir}") if(NOT EXISTS "${_dir}") message(SEND_ERROR "The directory ${_dir} does not exist") endif() endforeach() # escape spaces if(UNIX) STRING(REPLACE " " "\ " _workdir ${_workdir}) STRING(REPLACE " " "\ " _prefixdir ${_prefixdir}) STRING(REPLACE " " "\ " _python ${_python}) endif() execute_process( COMMAND ${_python} ${_command} WORKING_DIRECTORY ${_workdir} RESULT_VARIABLE result - ERROR_QUIET - OUTPUT_QUIET + #ERROR_QUIET + ERROR_VARIABLE error + OUTPUT_VARIABLE output + #OUTPUT_QUIET ) if(NOT ${result} EQUAL 0) - message(FATAL_ERROR "Error in: ${proj}: ${error}") + message("Error in: ${proj}: ${error}") + message("Output in: ${proj}: ${output}") endif() endfunction() diff --git a/CMakeExternals/Numpy.cmake b/CMakeExternals/Numpy.cmake index f495e8d933..80a82e50fa 100644 --- a/CMakeExternals/Numpy.cmake +++ b/CMakeExternals/Numpy.cmake @@ -1,102 +1,109 @@ #----------------------------------------------------------------------------- # 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}) # setup build environment and disable fortran, blas and lapack 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(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} \"${MITK_CXX11_FLAG} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}\") set(ENV{LDFLAGS} \"${CMAKE_LINKER_FLAGS} ${CMAKE_LINKER_FLAGS_RELEASE} ${_install_rpath_linkflag}\") ") set(_numpy_build_step ${MITK_SOURCE_DIR}/CMake/mitkFunctionExternalPythonBuildStep.cmake) set(_configure_step ${ep_prefix}/tmp/${proj}_configure_step.cmake) file(WRITE ${_configure_step} "${_numpy_env} include(\"${_numpy_build_step}\") file(WRITE \"${ep_prefix}/src/${proj}/site.cfg\" \"\") mitkFunctionExternalPythonBuildStep(${proj} configure \"${PYTHON_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}\" setup.py config) ") + set(_numpy_compiler ) + if(WIN32) + set(_numpy_compiler --compiler=msvc) + endif() + # build step set(_build_step ${ep_prefix}/tmp/${proj}_build_step.cmake) file(WRITE ${_build_step} "${_numpy_env} include(\"${_numpy_build_step}\") - mitkFunctionExternalPythonBuildStep(${proj} build \"${PYTHON_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}\" setup.py build --fcompiler=none) + mitkFunctionExternalPythonBuildStep(${proj} build \"${PYTHON_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}\" setup.py build ${_numpy_compiler}) ") # install step set(_install_step ${ep_prefix}/tmp/${proj}_install_step.cmake) file(WRITE ${_install_step} "${_numpy_env} include(\"${_numpy_build_step}\") # escape characters in install path set(_install_dir \"\${CMAKE_INSTALL_PREFIX}\") if(WIN32) string(REPLACE \"/\" \"\\\\\" _install_dir \${_install_dir}) endif() string(REPLACE \" \" \"\\ \" _install_dir \${_install_dir}) mitkFunctionExternalPythonBuildStep(${proj} install \"${PYTHON_EXECUTABLE}\" \"${CMAKE_BINARY_DIR}\" setup.py install --prefix=\${_install_dir}) ") - set(Numpy_URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/numpy-1.4.1.tar.gz) - set(Numpy_MD5 "5c7b5349dc3161763f7f366ceb96516b") + set(Numpy_URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/numpy-1.9.2.tar.gz) + #set(Numpy_URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/numpy-1.4.1.tar.gz) + #set(Numpy_MD5 "5c7b5349dc3161763f7f366ceb96516b") + set(Numpy_MD5 "a1ed53432dbcd256398898d35bc8e645") # escape spaces if(UNIX) STRING(REPLACE " " "\ " _configure_step ${_configure_step}) STRING(REPLACE " " "\ " _build_step ${_build_step}) STRING(REPLACE " " "\ " _install_step ${_install_step}) endif() set(NUMPY_PATCH_COMMAND ) if(WIN32) set(NUMPY_PATCH_COMMAND PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/Numpy-1.4.1-win32.patch) endif() ExternalProject_Add(${proj} LIST_SEPARATOR ${sep} URL ${Numpy_URL} URL_MD5 ${Numpy_MD5} - ${NUMPY_PATCH_COMMAND} + # ${NUMPY_PATCH_COMMAND} BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${_configure_step} BUILD_COMMAND ${CMAKE_COMMAND} -P ${_build_step} INSTALL_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH= -P ${_install_step} DEPENDS ${${proj}_DEPENDENCIES} ) set(Numpy_DIR ${MITK_PYTHON_SITE_DIR}/numpy) install(SCRIPT ${_install_step}) else() mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}") endif() endif() diff --git a/CMakeExternals/Python-2.7.3.patch b/CMakeExternals/Python-2.7.3.patch index 61f1930738..f865570d50 100644 --- a/CMakeExternals/Python-2.7.3.patch +++ b/CMakeExternals/Python-2.7.3.patch @@ -1,26 +1,28 @@ diff -urNb Python-2.7.3/Lib/distutils/cygwinccompiler.py Python-src/Lib/distutils/cygwinccompiler.py --- Python-2.7.3/Lib/distutils/cygwinccompiler.py 2012-04-10 01:07:29.000000000 +0200 +++ Python-src/Lib/distutils/cygwinccompiler.py 2015-01-13 21:03:33.025871739 +0100 -@@ -75,6 +75,10 @@ +@@ -75,6 +75,12 @@ elif msc_ver == '1500': # VS2008 / MSVC 9.0 return ['msvcr90'] + elif msc_ver == '1600': + return ['msvcr100'] + elif msc_ver == '1700': ++ return ['msvcr110'] ++ elif msc_ver == '1800': + return ['msvcr120'] else: raise ValueError("Unknown MS Compiler version %s " % msc_ver) diff -urNb Python-2.7.3/Lib/distutils/msvc9compiler.py Python-src/Lib/distutils/msvc9compiler.py --- Python-2.7.3/Lib/distutils/msvc9compiler.py 2012-04-10 01:07:29.000000000 +0200 +++ Python-src/Lib/distutils/msvc9compiler.py 2015-01-13 21:03:33.021871739 +0100 @@ -658,7 +658,7 @@ # will still consider the DLL up-to-date, but it will not have a # manifest. Maybe we should link to a temp file? OTOH, that # implies a build environment error that shouldn't go undetected. - mfinfo = self.manifest_get_embed_info(target_desc, ld_args) + mfinfo = None if mfinfo is not None: mffilename, mfid = mfinfo out_arg = '-outputresource:%s;%s' % (output_filename, mfid)