123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- if(DEFINED WEST_PYTHON)
-
- get_filename_component(west_realpath ${WEST_PYTHON} REALPATH)
- get_filename_component(python_realpath ${PYTHON_EXECUTABLE} REALPATH)
-
-
- if(NOT ("${west_realpath}" STREQUAL "${WEST_PYTHON}"))
- set(west_realpath_msg " (real path ${west_realpath})")
- else()
- set(west_realpath_msg "")
- endif()
- if(NOT ("${python_realpath}" STREQUAL "${PYTHON_EXECUTABLE}"))
- set(python_realpath_msg " (real path ${python_realpath})")
- else()
- set(python_realpath_msg "")
- endif()
- endif()
- execute_process(
- COMMAND
- ${PYTHON_EXECUTABLE}
- -c
- "import west.version; print(west.version.__version__, end='')"
- OUTPUT_VARIABLE west_version
- ERROR_VARIABLE west_version_err
- RESULT_VARIABLE west_version_output_result
- )
- if(west_version_output_result)
- if(DEFINED WEST_PYTHON)
- if(NOT (${west_realpath} STREQUAL ${python_realpath}))
- set(PYTHON_EXECUTABLE_OUT_OF_SYNC "\nOr verify these installations:\n\
- The Python version used by west is: ${WEST_PYTHON}${west_realpath_msg}\n\
- The Python version used by CMake is: ${PYTHON_EXECUTABLE}${python_realpath_msg}")
- endif()
- message(FATAL_ERROR "Unable to import west.version from '${PYTHON_EXECUTABLE}':\n${west_version_err}\
- Please install with:\n\
- ${PYTHON_EXECUTABLE} -m pip install west\
- ${PYTHON_EXECUTABLE_OUT_OF_SYNC}")
- else()
-
-
- set(WEST WEST-NOTFOUND CACHE INTERNAL "West")
- endif()
- else()
-
-
- set(MIN_WEST_VERSION 0.7.1)
- if(${west_version} VERSION_LESS ${MIN_WEST_VERSION})
- message(FATAL_ERROR "The detected west version, ${west_version}, is unsupported.\n\
- The minimum supported version is ${MIN_WEST_VERSION}.\n\
- Please upgrade with:\n\
- ${PYTHON_EXECUTABLE} -m pip install --upgrade west\
- ${PYTHON_EXECUTABLE_OUT_OF_SYNC}\n")
- endif()
-
-
-
-
-
- set(WEST_MODULE west)
- if(${west_version} VERSION_LESS 0.8)
-
-
- string(APPEND WEST_MODULE .app.main)
- endif()
-
-
- set(WEST ${PYTHON_EXECUTABLE} -m ${WEST_MODULE} CACHE INTERNAL "West")
-
-
- message(STATUS "Found west (found suitable version \"${west_version}\", minimum required is \"${MIN_WEST_VERSION}\")")
- execute_process(
- COMMAND ${WEST} topdir
- OUTPUT_VARIABLE WEST_TOPDIR
- ERROR_QUIET
- RESULT_VARIABLE west_topdir_result
- OUTPUT_STRIP_TRAILING_WHITESPACE
- WORKING_DIRECTORY ${ZEPHYR_BASE}
- )
- if(west_topdir_result)
-
-
- set(WEST WEST-NOTFOUND CACHE INTERNAL "West")
- endif()
- endif()
|