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.

dependency_graphengine.cmake 1.8 kB

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. message(STATUS "Compiling GraphEngine")
  2. set(GE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/graphengine)
  3. message(STATUS "[ME] build_path: ${BUILD_PATH}")
  4. function(find_submodule_lib module name path)
  5. find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
  6. PATH_SUFFIXES lib
  7. )
  8. if("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
  9. message(FATAL_ERROR "${name} not found in any of following paths: ${path}")
  10. endif()
  11. add_library(${module} SHARED IMPORTED)
  12. set_target_properties(${module} PROPERTIES
  13. IMPORTED_LOCATION ${${module}_LIBRARY_DIR}
  14. )
  15. endfunction()
  16. if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
  17. set(_ge_tmp_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
  18. set(_ge_tmp_ENABLE_GITEE ${ENABLE_GITEE})
  19. set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
  20. set(ENABLE_GITEE ON)
  21. set(CMAKE_INSTALL_PREFIX ${BUILD_PATH}/graphengine)
  22. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"' \
  23. -Wno-builtin-macro-redefined")
  24. if(ENABLE_TESTCASES)
  25. # use slog, error manager, mmpa in non ascend mode, e.g. tests
  26. set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
  27. set(ENABLE_MS_TESTCASES TRUE)
  28. find_submodule_lib(slog libalog.so ${GE_PREBUILD_PATH})
  29. find_submodule_lib(static_mmpa libmmpa.a ${GE_PREBUILD_PATH})
  30. endif()
  31. string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  32. add_subdirectory(${GE_SOURCE_DIR})
  33. set(CMAKE_INSTALL_PREFIX ${_ge_tmp_CMAKE_INSTALL_PREFIX})
  34. set(ENABLE_GITEE ${_ge_tmp_ENABLE_GITEE})
  35. set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
  36. else()
  37. message(FATAL_ERROR "No compile option defined for GraphEngine, exiting")
  38. endif()