diff --git a/cmake/external_libs/pybind11.cmake b/cmake/external_libs/pybind11.cmake index e52de81fdc4e924a84b217a919151016365fcc77..7c7d5e1a27ad3af24c1ccf3759ed1d66301c5349 100644 --- a/cmake/external_libs/pybind11.cmake +++ b/cmake/external_libs/pybind11.cmake @@ -31,8 +31,18 @@ if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported no # Refer to: https://github.com/pybind/pybind11/pull/2701 # And: https://pybind11.readthedocs.io/en/stable/changelog.html#v2-6-2-jan-26-2021 set(PYBIND11_PATCH_FILE "pybind11.patch002") + elseif(PYTHON_VERSION MATCHES "3.12") + set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.13.1.tar.gz") + set(SHA256 "2200dda5c64ece586f537af8fd292103a3042cb40c443dde1b70fd1e419d8cb0") + set(PYBIND_VERSION 2.13.1) + set(PYBIND_DISABLE_GIL_CHECK TRUE) + # This patch reverts a PR introduced in pybind 2.6.2, as it causes many runtime exceptions in mindspore + # due to the type checking introduced in this PR. + # Refer to: https://github.com/pybind/pybind11/pull/2701 + # And: https://pybind11.readthedocs.io/en/stable/changelog.html#v2-6-2-jan-26-2021 + set(PYBIND11_PATCH_FILE "pybind11.patch002") else() - message("Could not find Python versions 3.7 - 3.11") + message("Could not find Python versions 3.7 - 3.12") return() endif() else() @@ -60,8 +70,14 @@ else() set(PYBIND_VERSION 2.13.1) set(PYBIND_DISABLE_GIL_CHECK TRUE) set(PYBIND11_PATCH_FILE "pybind11.patch002") + elseif(PYTHON_VERSION MATCHES "3.12") + set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.13.1.tar.gz") + set(SHA256 "51631e88960a8856f9c497027f55c9f2f9115cafb08c0005439838a05ba17bfc") + set(PYBIND_VERSION 2.13.1) + set(PYBIND_DISABLE_GIL_CHECK TRUE) + set(PYBIND11_PATCH_FILE "pybind11.patch002") else() - message("Could not find Python versions 3.7 - 3.11") + message("Could not find Python versions 3.7 - 3.12") return() endif() endif() diff --git a/mindspore-lite/tools/converter/CMakeLists.txt b/mindspore-lite/tools/converter/CMakeLists.txt index 8594bcc63a82f6ae3abc614308ee02682309684a..449af1e5a963b84fa4288a8e1528baebfbb475de 100644 --- a/mindspore-lite/tools/converter/CMakeLists.txt +++ b/mindspore-lite/tools/converter/CMakeLists.txt @@ -415,7 +415,7 @@ target_link_libraries(mindspore_converter coder_mid mindir_serializer_mid ) -if(PYTHON_VERSION MATCHES "3.11") +if(PYTHON_VERSION MATCHES "3.11" OR PYTHON_VERSION MATCHES "3.12") target_link_libraries(mindspore_converter ${PYTHON_LIBRARIES}) endif()