numpy.cmake 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. if(MSVC)
  19. if(BUILD_MODE STREQUAL Debug)
  20. set(NUMPY_DIR_POSTFIX -pydebug)
  21. set(NUMPY_ARCHIVE_POSTFIX d)
  22. set(NUMPY_BUILD_OPTION --debug)
  23. else()
  24. set(NUMPY_DIR_POSTFIX)
  25. set(NUMPY_ARCHIVE_POSTFIX)
  26. set(NUMPY_BUILD_OPTION)
  27. endif()
  28. endif()
  29. set(NUMPY_POSTFIX)
  30. if(WIN32)
  31. set(NUMPY_INSTALL
  32. ${CMAKE_COMMAND} -E copy_directory "${BUILD_DIR}/python/src/external_python/run/lib/site-packages/numpy/core/include/numpy" "${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/numpy" &&
  33. ${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-${PYTHON_SHORT_VERSION}${NUMPY_DIR_POSTFIX}"
  34. ${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "."
  35. )
  36. else()
  37. set(NUMPY_INSTALL echo .)
  38. set(NUMPY_PATCH echo .)
  39. endif()
  40. ExternalProject_Add(external_numpy
  41. URL ${NUMPY_URI}
  42. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  43. URL_HASH MD5=${NUMPY_HASH}
  44. PREFIX ${BUILD_DIR}/numpy
  45. PATCH_COMMAND ${NUMPY_PATCH}
  46. CONFIGURE_COMMAND ""
  47. LOG_BUILD 1
  48. BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable
  49. INSTALL_COMMAND ${NUMPY_INSTALL}
  50. )
  51. if(WIN32)
  52. ExternalProject_Add_Step(external_numpy after_install
  53. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz ${HARVEST_TARGET}/Release/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz
  54. DEPENDEES install
  55. )
  56. endif()
  57. add_dependencies(
  58. external_numpy
  59. Make_Python_Environment
  60. )