!25894 Fix windows python3.9 compile
Merge pull request !25894 from zhoufeng/find-python-path
This commit is contained in:
commit
411d3bb015
|
@ -17,6 +17,10 @@ endfunction()
|
|||
|
||||
|
||||
## find python, quit if the found python is static
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
set(Python3_FIND_REGISTRY LAST)
|
||||
set(Python3_FIND_STRATEGY LOCATION)
|
||||
endif()
|
||||
set(Python3_USE_STATIC_LIBS FALSE)
|
||||
set(Python3_FIND_VIRTUALENV ONLY)
|
||||
find_package(Python3 COMPONENTS Interpreter Development)
|
||||
|
|
|
@ -14,6 +14,9 @@ set(CPACK_PACK_ROOT_DIR ${BUILD_PATH}/package/)
|
|||
set(CPACK_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(CPACK_ENABLE_SYM_FILE ${ENABLE_SYM_FILE})
|
||||
set(CPACK_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||
set(CPACK_PYTHON_EXE ${Python3_EXECUTABLE})
|
||||
set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
||||
|
||||
if(ENABLE_GE)
|
||||
set(CPACK_MS_BACKEND "ge")
|
||||
set(CPACK_MS_TARGET "ascend or cpu")
|
||||
|
|
|
@ -1,16 +1,4 @@
|
|||
# find exec
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
if(NOT Python3_FOUND)
|
||||
message(FATAL_ERROR "No python3 found.")
|
||||
endif()
|
||||
|
||||
set(PYTHON ${Python3_EXECUTABLE})
|
||||
set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
||||
|
||||
if(NOT (PYTHON_VERSION MATCHES "3.9" OR PYTHON_VERSION MATCHES "3.8" OR PYTHON_VERSION MATCHES "3.7"))
|
||||
message(FATAL_ERROR "FIND PYTHON VERSION ${PYTHON_VERSION} BUT CAN NOT MATCH PYTHON VERSION 3.9 OR 3.8 OR 3.7")
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
if(NOT GIT_FOUND)
|
||||
message("No git found.")
|
||||
|
@ -22,6 +10,13 @@ set(GIT ${GIT_EXECUTABLE})
|
|||
set(MS_ROOT_DIR ${CPACK_CMAKE_SOURCE_DIR})
|
||||
set(MS_PACK_ROOT_DIR ${CPACK_PACK_ROOT_DIR})
|
||||
|
||||
set(PYTHON ${CPACK_PYTHON_EXE})
|
||||
set(PYTHON_VERSION ${CPACK_PYTHON_VERSION})
|
||||
|
||||
if(NOT (PYTHON_VERSION MATCHES "3.9" OR PYTHON_VERSION MATCHES "3.8" OR PYTHON_VERSION MATCHES "3.7"))
|
||||
message(FATAL_ERROR "FIND PYTHON VERSION ${PYTHON_VERSION} BUT CAN NOT MATCH PYTHON VERSION 3.9 OR 3.8 OR 3.7")
|
||||
endif()
|
||||
|
||||
# set package file name
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if(PYTHON_VERSION MATCHES "3.9")
|
||||
|
|
|
@ -12,6 +12,8 @@ set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_SOURCE_DIR}/build/package/mindspor
|
|||
set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${CMAKE_SOURCE_DIR}/build/package/mindspore)
|
||||
set(CPACK_PACK_ROOT_DIR ${BUILD_PATH}/package/)
|
||||
set(CPACK_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(CPACK_PYTHON_EXE ${Python3_EXECUTABLE})
|
||||
set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
||||
|
||||
if(ENABLE_GPU)
|
||||
set(CPACK_MS_BACKEND "ms")
|
||||
|
|
Loading…
Reference in New Issue