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.

pybind11.cmake 1.5 kB

5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
  2. if(ENABLE_GITEE)
  3. if(PYTHON_VERSION MATCHES "3.8")
  4. set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz")
  5. set(MD5 "dcbb02cc2da9653ec91860bb0594c91d")
  6. elseif(PYTHON_VERSION MATCHES "3.7")
  7. set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.4.3.tar.gz")
  8. set(MD5 "b473a37987ce456ea8cc7aab3f9486f9")
  9. else()
  10. message("Could not find 'Python 3.8' or 'Python 3.7'")
  11. return()
  12. endif()
  13. else()
  14. if(PYTHON_VERSION MATCHES "3.8")
  15. set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz")
  16. set(MD5 "32a7811f3db423df4ebfc731a28e5901")
  17. elseif(PYTHON_VERSION MATCHES "3.7")
  18. set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz")
  19. set(MD5 "62254c40f89925bb894be421fe4cdef2")
  20. else()
  21. message("Could not find 'Python 3.8' or 'Python 3.7'")
  22. return()
  23. endif()
  24. endif()
  25. set(pybind11_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
  26. set(pybind11_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
  27. mindspore_add_pkg(pybind11
  28. VER 2.4.3
  29. URL ${REQ_URL}
  30. MD5 ${MD5}
  31. CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
  32. )
  33. include_directories(${pybind11_INC})
  34. find_package(pybind11 REQUIRED)
  35. set_property(TARGET pybind11::module PROPERTY IMPORTED_GLOBAL TRUE)
  36. add_library(mindspore::pybind11_module ALIAS pybind11::module)