FindMLU.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # ==============================================
  2. # Try to find Cambricon Neuware libraries:
  3. # - cnrt
  4. # - cndrv
  5. # - ion (required on mlu220 edge)
  6. # - cncodec
  7. # - cncv
  8. # - magicmind_runtime
  9. #
  10. # SET NEUWARE_INCLUDE_DIR with neuware include directory
  11. # SET CNRT_LIBS with cnrt path and cndrv path
  12. # SET CNCODEC_LIBS with cncodec path and ion(if has) path
  13. # ==============================================
  14. if(NEUWARE_HOME)
  15. get_filename_component(NEUWARE_HOME ${NEUWARE_HOME} ABSOLUTE)
  16. message(STATUS "NEUWARE_HOME: ${NEUWARE_HOME}")
  17. elseif(DEFINED ENV{NEUWARE_HOME})
  18. get_filename_component(NEUWARE_HOME $ENV{NEUWARE_HOME} ABSOLUTE)
  19. message(STATUS "ENV{NEUWARE_HOME}: ${NEUWARE_HOME}")
  20. else()
  21. set(NEUWARE_HOME "/usr/local/neuware")
  22. message(STATUS "Default NEUWARE_HOME: ${NEUWARE_HOME}")
  23. endif()
  24. if((NOT EXISTS ${NEUWARE_HOME}) OR (NOT EXISTS ${NEUWARE_HOME}/include) OR (NOT EXISTS ${NEUWARE_HOME}/lib64))
  25. message(FATAL_ERROR "NEUWARE_HOME: ${NEUWARE_HOME} not exists!")
  26. else()
  27. set(NEUWARE_INCLUDE_DIR ${NEUWARE_HOME}/include)
  28. endif()
  29. # ---[ cnrt
  30. find_library(CNRT_LIBS
  31. NAMES cnrt
  32. PATHS ${NEUWARE_HOME}/lib64
  33. NO_CMAKE_FIND_ROOT_PATH
  34. NO_CMAKE_PATH
  35. NO_DEFAULT_PATH
  36. NO_CMAKE_SYSTEM_PATH)
  37. find_library(CNDRV_LIBS
  38. NAMES cndrv
  39. PATHS ${NEUWARE_HOME}/lib64
  40. NO_CMAKE_FIND_ROOT_PATH
  41. NO_CMAKE_PATH
  42. NO_DEFAULT_PATH
  43. NO_CMAKE_SYSTEM_PATH)
  44. # ---[ cncodec
  45. find_library(CNCODEC_LIBS
  46. NAMES cncodec
  47. PATHS ${NEUWARE_HOME}/lib64
  48. NO_CMAKE_FIND_ROOT_PATH
  49. NO_CMAKE_PATH
  50. NO_DEFAULT_PATH
  51. NO_CMAKE_SYSTEM_PATH)
  52. find_library(ION_LIBS
  53. NAMES ion
  54. PATHS ${NEUWARE_HOME}/lib64
  55. NO_CMAKE_FIND_ROOT_PATH
  56. NO_CMAKE_PATH
  57. NO_DEFAULT_PATH
  58. NO_CMAKE_SYSTEM_PATH)
  59. if(ION_LIBS)
  60. list(APPEND CNCODEC_LIBS ${ION_LIBS})
  61. endif()
  62. # ---[ cncv
  63. find_library(CNCV_LIBS
  64. NAMES cncv
  65. PATHS ${NEUWARE_HOME}/lib64
  66. NO_CMAKE_FIND_ROOT_PATH
  67. NO_CMAKE_PATH
  68. NO_DEFAULT_PATH
  69. NO_CMAKE_SYSTEM_PATH)
  70. if(CNCV_LIBS)
  71. message(STATUS "Found CNCV: ${CNCV_LIBS}")
  72. endif()
  73. # ---[ magicmind
  74. find_library(MAGICMIND_RUNTIME_LIBS
  75. NAMES magicmind_runtime
  76. PATHS ${NEUWARE_HOME}/lib64
  77. NO_CMAKE_FIND_ROOT_PATH
  78. NO_CMAKE_PATH
  79. NO_DEFAULT_PATH
  80. NO_CMAKE_SYSTEM_PATH)
  81. if(MAGICMIND_RUNTIME_LIBS)
  82. message(STATUS "Found MAGICMIND_RUNTIME: ${MAGICMIND_RUNTIME_LIBS}")
  83. endif()