You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

check_requirements.cmake 2.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ## define customized find fucntions, print customized error messages
  2. function(find_required_package pkg_name)
  3. find_package(${pkg_name})
  4. if (NOT ${pkg_name}_FOUND)
  5. message(FATAL_ERROR "Required package ${pkg_name} not found, please install the package and try building MindSpore again.")
  6. endif()
  7. endfunction()
  8. function(find_required_program prog_name)
  9. find_program(${prog_name}_EXE ${prog_name})
  10. if (NOT ${prog_name}_EXE)
  11. message(FATAL_ERROR "Required program ${prog_name} not found, please install the package and try building MindSpore again.")
  12. endif ()
  13. endfunction()
  14. ## find python, quit if the found python is static
  15. set(Python3_USE_STATIC_LIBS FALSE)
  16. find_package(Python3 COMPONENTS Interpreter Development)
  17. if (Python3_FOUND)
  18. message("Python3 found, version: ${Python3_VERSION}")
  19. message("Python3 library path: ${Python3_LIBRARY_DIRS}")
  20. message("Python3 interpreter: ${Python3_EXECUTABLE}")
  21. else()
  22. message(FATAL_ERROR "Python3 not found, please install Python>=3.7.5, and set --enable-shared "
  23. "if you are building Python locally")
  24. endif ()
  25. ## packages used both on windows and linux
  26. if (DEFINED ENV{MS_PATCH_PATH})
  27. find_program(Patch_EXECUTABLE patch PATHS $ENV{MS_PATCH_PATH})
  28. set(Patch_FOUND ${Patch_EXECUTABLE})
  29. else ()
  30. find_package(Patch)
  31. endif ()
  32. if (NOT Patch_FOUND)
  33. message(FATAL_ERROR "Patch not found, please set environment variable MS_PATCH_PATH to path where Patch is located, "
  34. "usually found in GIT_PATH/usr/bin on Windows")
  35. endif ()
  36. message(PATCH_EXECUTABLE = ${Patch_EXECUTABLE})
  37. find_required_package(Threads)
  38. ## packages used on Linux
  39. if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
  40. if (ENABLE_MINDDATA)
  41. find_required_program(tclsh)
  42. endif ()
  43. if (MS_BUILD_GRPC)
  44. find_required_package(OpenSSL)
  45. endif ()
  46. ## packages used in GPU mode only
  47. if (ENABLE_GPU)
  48. find_library(gmp_LIB gmp)
  49. find_library(gmpxx_LIB gmpxx)
  50. find_file(gmp_HEADER gmp.h)
  51. if (NOT gmp_LIB OR NOT gmpxx_LIB OR NOT gmp_HEADER)
  52. message(FATAL_ERROR "Required package gmp not found, please install gmp and try building MindSpore again.")
  53. endif ()
  54. find_required_program(automake)
  55. find_required_program(autoconf)
  56. find_required_program(libtoolize)
  57. find_required_package(FLEX)
  58. endif()
  59. endif()