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.

CMakeLists.txt 2.3 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. cmake_minimum_required(VERSION 3.14)
  2. project (Parser[CXX])
  3. set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR})
  4. if (DEFINED ENV{D_PKG_SERVER})
  5. set(PARSER_PB_PKG $ENV{D_PKG_SERVER})
  6. endif()
  7. option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)
  8. if (ENABLE_OPEN_SRC)
  9. set(HI_PYTHON python3)
  10. include(cmake/external_libs/protobuf_shared.cmake)
  11. include(cmake/external_libs/protoc.cmake)
  12. include(cmake/external_libs/securec.cmake)
  13. include(cmake/external_libs/json.cmake)
  14. include(cmake/external_libs/gtest.cmake)
  15. include(cmake/FindModule.cmake)
  16. include(cmake/intf_pub_linux.cmake)
  17. if(DEFINED ENV{D_LINK_PATH})
  18. # D_LINK_PATH is set
  19. set(GE_LIB_PATH $ENV{D_LINK_PATH})
  20. set(GE_SYS_ARCH "")
  21. if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  22. # x86 ubuntu
  23. set(GE_SYS_ARCH "x86_64")
  24. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  25. # arm euleros
  26. set(GE_SYS_ARCH "aarch64")
  27. else()
  28. message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
  29. endif()
  30. set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
  31. find_module(slog libalog.so ${GE_LIB_PATH})
  32. find_module(static_mmpa libmmpa.a ${GE_LIB_PATH})
  33. elseif(ENABLE_GE_COV OR ENABLE_GE_UT)
  34. message(STATUS "Runing on llt mode, no need to depend other component")
  35. elseif(ENABLE_PARSER_UT OR ENABLE_PARSER_COV)
  36. add_subdirectory(tests)
  37. else()
  38. if(DEFINED ENV{ASCEND_CUSTOM_PATH})
  39. set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
  40. else()
  41. set(ASCEND_DIR /usr/local/Ascend)
  42. endif()
  43. set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
  44. find_module(slog libalog.so ${ASCEND_ATC_DIR})
  45. find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR})
  46. endif()
  47. if (NOT DEFINED METADEF_DIR)
  48. set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)
  49. add_subdirectory(metadef)
  50. endif()
  51. else()
  52. ####工程tigong
  53. set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/../metadef)
  54. endif()
  55. add_subdirectory(parser)
  56. add_subdirectory(parser/common)
  57. add_subdirectory(parser/func_to_graph)
  58. add_subdirectory(parser/onnx)
  59. add_subdirectory(parser/proto/caffe)