代码拉取完成,页面将自动刷新
同步操作将从 Ascend/metadef 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# Copyright (c) 2024 Huawei Technologies Co., Ltd.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================
cmake_minimum_required(VERSION 3.14)
project (MetaDef[CXX])
if (NOT DEFINED CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/cmake/modules
${ASCEND_3RD_LIB_PATH}/cmake/modules
)
endif()
if (NOT DEFINED CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH
${ASCEND_3RD_LIB_PATH}/json
${ASCEND_3RD_LIB_PATH}/openssl
${ASCEND_3RD_LIB_PATH}/protoc
${ASCEND_3RD_LIB_PATH}/protoc_grpc
${ASCEND_3RD_LIB_PATH}/grpc
${ASCEND_3RD_LIB_PATH}/protobuf_static
${ASCEND_3RD_LIB_PATH}/ascend_protobuf
${ASCEND_3RD_LIB_PATH}/ascend_protobuf_static
${ASCEND_3RD_LIB_PATH}/gtest_shared/lib64/cmake/GTest
${ASCEND_3RD_LIB_PATH}/benchmark
${ASCEND_3RD_LIB_PATH}/pybind11
${ASCEND_3RD_LIB_PATH}/symengine/lib/cmake/symengine
${ASCEND_3RD_LIB_PATH}/boost/lib/cmake/Boost-1.82.0
${ASCEND_INSTALL_PATH}
)
endif()
include(CMakePrintHelpers)
message(STATUS "Variables in metadef project:")
cmake_print_variables(ASCEND_INSTALL_PATH)
cmake_print_variables(ASCEND_3RD_LIB_PATH)
cmake_print_variables(CMAKE_SYSTEM_PROCESSOR)
cmake_print_variables(CMAKE_BUILD_TYPE)
cmake_print_variables(CMAKE_INSTALL_PREFIX)
cmake_print_variables(CMAKE_PREFIX_PATH)
cmake_print_variables(CMAKE_MODULE_PATH)
cmake_print_variables(ENABLE_OPEN_SRC ENABLE_METADEF_UT ENABLE_METADEF_ST ENABLE_METADEF_COV ENABLE_BENCHMARK GE_ONLY)
set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)
set(INSTALL_RUNTIME_DIR bin)
set(INSTALL_INCLUDE_DIR include)
set(INSTALL_CONFIG_DIR cmake)
include(CMakePackageConfigHelpers)
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR})
option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)
if (ENABLE_OPEN_SRC)
set(HI_PYTHON python3)
include(cmake/test_funcs.cmake)
include(cmake/intf_pub_linux.cmake)
# 开源软件包
find_package(ascend_protobuf_shared MODULE REQUIRED)
find_package(ascend_protobuf_static MODULE REQUIRED)
find_package(protoc MODULE REQUIRED)
find_package(json MODULE REQUIRED)
find_package(GTest CONFIG REQUIRED)
# 自研软件包
find_package(securec MODULE REQUIRED)
find_package(slog MODULE REQUIRED)
if (NOT (ENABLE_METADEF_UT OR ENABLE_METADEF_ST))
find_package(mmpa MODULE REQUIRED)
endif()
find_package(cce MODULE REQUIRED)
find_package(msprof MODULE REQUIRED)
find_package(runtime MODULE REQUIRED)
find_package(platform MODULE REQUIRED)
find_package(SymEngine CONFIG REQUIRED)
find_package(Boost CONFIG REQUIRED)
endif()
include(cmake/common_funcs.cmake)
add_subdirectory(inc)
add_subdirectory(proto)
add_subdirectory(graph)
add_subdirectory(exe_graph)
add_subdirectory(error_manager)
add_subdirectory(register)
if (ENABLE_METADEF_UT OR ENABLE_METADEF_ST OR ENABLE_BENCHMARK)
find_package(benchmark CONFIG REQUIRED)
add_subdirectory(tests)
endif()
install(TARGETS exe_graph error_manager graph graph_base flow_graph register rt2_registry_static metadef_headers
EXPORT metadef-targets
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} OPTIONAL COMPONENT opensdk
)
if ("${PRODUCT}" STREQUAL "ascend031")
install(TARGETS graph_base_static
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL
)
install(TARGETS atc_stub_graph_static stub_exe_graph_static stub_register_static
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub OPTIONAL
)
endif ()
# 下列头文件发布是非法的,需要在后续整改中删掉
# --------------------start------------------------
install(FILES ${METADEF_DIR}/third_party/transformer/inc/axis_util.h
${METADEF_DIR}/third_party/transformer/inc/expand_dimension.h
${METADEF_DIR}/third_party/transformer/inc/transfer_shape_utils.h
${METADEF_DIR}/third_party/transformer/inc/transfer_range_according_to_format.h
${METADEF_DIR}/third_party/transformer/inc/transfer_shape_according_to_format.h
DESTINATION ${INSTALL_INCLUDE_DIR}/metadef/transformer COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${METADEF_DIR}/register/op_tiling/op_tiling_constants.h
${METADEF_DIR}/register/op_tiling/op_compile_info_manager.h
${METADEF_DIR}/register/op_tiling/op_tiling_utils.h
DESTINATION ${INSTALL_INCLUDE_DIR}/metadef/register/op_tiling COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${METADEF_DIR}/graph/normal_graph/operator_impl.h
${METADEF_DIR}/graph/normal_graph/op_io.h
DESTINATION ${INSTALL_INCLUDE_DIR}/metadef/graph COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${METADEF_DIR}/graph/debug/ge_log.h
${METADEF_DIR}/graph/debug/ge_util.h # 被air使用
${METADEF_DIR}/graph/debug/ge_op_types.h # 被parser使用
DESTINATION ${INSTALL_INCLUDE_DIR}/metadef/graph/debug COMPONENT opensdk EXCLUDE_FROM_ALL
)
install(FILES ${METADEF_DIR}/graph/utils/dumper/ge_graph_dumper.h
DESTINATION ${INSTALL_INCLUDE_DIR}/metadef/graph/utils/dumper COMPONENT opensdk EXCLUDE_FROM_ALL
)
# ---------------------end-------------------------
install(DIRECTORY ${METADEF_DIR}/inc/ DESTINATION ${INSTALL_INCLUDE_DIR}/metadef
COMPONENT opensdk EXCLUDE_FROM_ALL FILES_MATCHING PATTERN "*.h"
)
install(DIRECTORY ${METADEF_DIR}/proto/ DESTINATION proto
COMPONENT opensdk EXCLUDE_FROM_ALL FILES_MATCHING PATTERN "*.proto"
)
if (PACKAGE STREQUAL "opensdk")
install(EXPORT metadef-targets DESTINATION ${INSTALL_CONFIG_DIR}
FILE metadef-targets.cmake COMPONENT opensdk EXCLUDE_FROM_ALL
)
set(PKG_NAME metadef)
configure_package_config_file(${TOP_DIR}/cmake/config/pkg_config_template.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/metadef-config.cmake
INSTALL_DESTINATION ${INSTALL_CONFIG_DIR}
PATH_VARS INSTALL_BASE_DIR INSTALL_INCLUDE_DIR INSTALL_LIBRARY_DIR INSTALL_RUNTIME_DIR INSTALL_CONFIG_DIR
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
)
unset(PKG_NAME)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metadef-config.cmake
DESTINATION ${INSTALL_CONFIG_DIR} COMPONENT opensdk EXCLUDE_FROM_ALL
)
endif()
if (ENABLE_OPEN_SRC)
set(ARCH_LINX_PATH "${CMAKE_SYSTEM_PROCESSOR}-linux")
install(TARGETS error_manager
exe_graph
graph
graph_base
register
rt2_registry_static
LIBRARY DESTINATION ${ARCH_LINX_PATH}/lib64 OPTIONAL COMPONENT packages EXCLUDE_FROM_ALL
ARCHIVE DESTINATION ${ARCH_LINX_PATH}/lib64 OPTIONAL COMPONENT packages EXCLUDE_FROM_ALL
RUNTIME DESTINATION ${ARCH_LINX_PATH}/bin OPTIONAL COMPONENT packages EXCLUDE_FROM_ALL
)
set(version_info "${ASCEND_INSTALL_PATH}/runtime/version.info")
set(install_script_dir "${CMAKE_CURRENT_BINARY_DIR}/install_scripts/")
add_custom_target(generate_install_script_metadef ALL
COMMAND rm -rf ${install_script_dir}
COMMAND cp -rf ${ASCEND_INSTALL_PATH}/toolkit/tools/ascend_project/open_install_scripts ${install_script_dir}
COMMAND chmod -R u+w ${install_script_dir}
COMMAND echo "base_package=runtime\;compiler" > ${install_script_dir}/version.info
COMMAND echo "backup_dir=metadef" >> ${install_script_dir}/version.info
COMMAND grep -iE "'^(version|version_dir)='" ${version_info} >> ${install_script_dir}/version.info
)
install(DIRECTORY ${install_script_dir}
DESTINATION . OPTIONAL
FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_READ
COMPONENT . EXCLUDE_FROM_ALL
)
set(CPACK_COMPONENTS_ALL ".;packages")
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION "CPack metadef project")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CPack metadef project")
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/package)
set(CPACK_PACKAGE_FILE_NAME "CANN-metadef-linux.${CMAKE_SYSTEM_PROCESSOR}.run")
set(CPACK_GENERATOR External)
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
set(CPACK_EXTERNAL_ENABLE_STAGING TRUE)
set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${ASCEND_INSTALL_PATH}/toolkit/tools/op_project_templates/ascendc/customize/cmake/makeself.cmake)
set(CPACK_EXTERNAL_BUILT_PACKAGES ${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Linux/External/${CPACK_PACKAGE_FILE_NAME}/${CPACK_PACKAGE_FILE_NAME})
include(CPack)
endif()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。