已合并
依赖工程公共仓 #177
sinat_31531339创建于 4月18日
依赖工程公共仓 #177
已合并
共 28 个文件变更+113-424
| @@ -15,9 +15,11 @@ | |||
| 15 | # ---------------------------------------------------------------------------- | 15 | # ---------------------------------------------------------------------------- |
| 16 | 16 | ||
| 17 | cmake_minimum_required(VERSION 3.15) | 17 | cmake_minimum_required(VERSION 3.15) |
| 18 | +include(cmake/fetch_cann_cmake.cmake) | ||
| 18 | set(PKG_NAME oam) | 19 | set(PKG_NAME oam) |
| 19 | project(Oam-Tools) | 20 | project(Oam-Tools) |
| 20 | 21 | ||
| 22 | +init_cann_project() | ||
| 21 | set(CMAKE_C_FLAGS_RELEASE "") | 23 | set(CMAKE_C_FLAGS_RELEASE "") |
| 22 | set(CMAKE_CXX_FLAGS_RELEASE "") | 24 | set(CMAKE_CXX_FLAGS_RELEASE "") |
| 23 | 25 | ||
| @@ -46,8 +48,8 @@ set(ASCEND_CANN_PACKAGE_PATH ${ASCEND_DIR}) | |||
| 46 | 48 | ||
| 47 | include(cmake/func.cmake) | 49 | include(cmake/func.cmake) |
| 48 | include(version.cmake) | 50 | include(version.cmake) |
| 49 | -check_pkg_build_deps("oam-tools") | 51 | +check_cann_pkg_build_deps("oam-tools") |
| 50 | -add_version_info_targets() | 52 | +add_cann_version_info_targets() |
| 51 | 53 | ||
| 52 | set(ASCEND_COMPUTE_UNIT | 54 | set(ASCEND_COMPUTE_UNIT |
| 53 | "ascend910b" | 55 | "ascend910b" |
| @@ -38,6 +38,8 @@ usage() { | |||
| 38 | echo " --build-type=<TYPE>" | 38 | echo " --build-type=<TYPE>" |
| 39 | echo " Specify build type (TYPE options: Release/Debug), default is Release" | 39 | echo " Specify build type (TYPE options: Release/Debug), default is Release" |
| 40 | echo " --pkg Build run package" | 40 | echo " --pkg Build run package" |
| 41 | + echo " --ascend_install_path=<PATH>" | ||
| 42 | + echo " Set ascend package install path, default /usr/local/Ascend/cann" | ||
| 41 | echo " --cann_3rd_lib_path=<PATH>" | 43 | echo " --cann_3rd_lib_path=<PATH>" |
| 42 | echo " Set ascend third_party package install path, default ./third_party" | 44 | echo " Set ascend third_party package install path, default ./third_party" |
| 43 | echo "Test Options:" | 45 | echo "Test Options:" |
| @@ -66,6 +68,7 @@ checkopts() { | |||
| 66 | TEST_COMPONENT="all" | 68 | TEST_COMPONENT="all" |
| 67 | RUN_UT_ONLY="off" | 69 | RUN_UT_ONLY="off" |
| 68 | RUN_ST_ONLY="off" | 70 | RUN_ST_ONLY="off" |
| 71 | + | ||
| 69 | if [[ -n "${ASCEND_HOME_PATH}" ]]; then | 72 | if [[ -n "${ASCEND_HOME_PATH}" ]]; then |
| 70 | echo "env exists ASCEND_HOME_PATH : ${ASCEND_HOME_PATH}" | 73 | echo "env exists ASCEND_HOME_PATH : ${ASCEND_HOME_PATH}" |
| 71 | elif [ $UID -eq 0 ]; then | 74 | elif [ $UID -eq 0 ]; then |
| @@ -73,10 +76,11 @@ checkopts() { | |||
| 73 | else | 76 | else |
| 74 | export ASCEND_HOME_PATH=~/Ascend/latest | 77 | export ASCEND_HOME_PATH=~/Ascend/latest |
| 75 | fi | 78 | fi |
| 79 | + ASCEND_INSTALL_PATH="${ASCEND_HOME_PATH}" | ||
| 76 | CANN_3RD_LIB_PATH="$BASEPATH/third_party" | 80 | CANN_3RD_LIB_PATH="$BASEPATH/third_party" |
| 77 | 81 | ||
| 78 | # Process the options | 82 | # Process the options |
| 79 | - parsed_args=$(getopt -a -o j:hvuO: -l help,verbose,cov,make_clean,build-type:,noexec,pkg,asan,cann_3rd_lib_path:,component:,ut,st -- "$@") || { | 83 | + parsed_args=$(getopt -a -o j:hvuO: -l help,verbose,cov,make_clean,build-type:,noexec,ascend_install_path:,pkg,asan,cann_3rd_lib_path:,component:,ut,st -- "$@") || { |
| 80 | usage | 84 | usage |
| 81 | exit 1 | 85 | exit 1 |
| 82 | } | 86 | } |
| @@ -122,6 +126,10 @@ checkopts() { | |||
| 122 | EXEC_TEST="off" | 126 | EXEC_TEST="off" |
| 123 | shift | 127 | shift |
| 124 | ;; | 128 | ;; |
| 129 | + --ascend_install_path) | ||
| 130 | + ASCEND_HOME_PATH="$(realpath $2)" | ||
| 131 | + shift 2 | ||
| 132 | + ;; | ||
| 125 | --cann_3rd_lib_path) | 133 | --cann_3rd_lib_path) |
| 126 | CANN_3RD_LIB_PATH="$(realpath $2)" | 134 | CANN_3RD_LIB_PATH="$(realpath $2)" |
| 127 | shift 2 | 135 | shift 2 |
| @@ -230,7 +238,12 @@ cmake_generate_make() { | |||
| 230 | local cmake_args="$2" | 238 | local cmake_args="$2" |
| 231 | if [[ "${MAKE_CLEAN_ALL}" == "on" ]];then | 239 | if [[ "${MAKE_CLEAN_ALL}" == "on" ]];then |
| 232 | echo "clear all files in build directory" | 240 | echo "clear all files in build directory" |
| 233 | - [ -d "${build_path}" ] && rm -rf "${build_path}" | 241 | + # makeself_built_in.cmake 末尾会把 _CPack_Packages/makeself_staging 目录树 |
| 242 | + # chmod 到 0550,rm -rf 进不去这些目录,先恢复 owner 写位再删 | ||
| 243 | + if [ -d "${build_path}" ]; then | ||
| 244 | + chmod -R u+w "${build_path}" 2>/dev/null | ||
| 245 | + rm -rf "${build_path}" | ||
| 246 | + fi | ||
| 234 | fi | 247 | fi |
| 235 | mk_dir "${build_path}" | 248 | mk_dir "${build_path}" |
| 236 | cd "${build_path}" | 249 | cd "${build_path}" |
| @@ -291,6 +304,7 @@ build_oam_tools() { | |||
| 291 | -DCMAKE_INSTALL_PREFIX=${BUILD_PATH} \ | 304 | -DCMAKE_INSTALL_PREFIX=${BUILD_PATH} \ |
| 292 | -DENABLE_UT=${ENABLE_UT} \ | 305 | -DENABLE_UT=${ENABLE_UT} \ |
| 293 | -DBUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG=ON \ | 306 | -DBUILD_WITH_INSTALLED_DEPENDENCY_CANN_PKG=ON \ |
| 307 | + -DASCEND_INSTALL_PATH=${ASCEND_INSTALL_PATH} \ | ||
| 294 | -DCANN_3RD_LIB_PATH=${CANN_3RD_LIB_PATH} \ | 308 | -DCANN_3RD_LIB_PATH=${CANN_3RD_LIB_PATH} \ |
| 295 | -DPRODUCT_SIDE=device \ | 309 | -DPRODUCT_SIDE=device \ |
| 296 | -DDCMAKE_WGET_FLAGS='--no-check-certificate' \ | 310 | -DDCMAKE_WGET_FLAGS='--no-check-certificate' \ |
Dcmake/Third_Party_Open_Source_Software_List.yaml+0-21
| @@ -1,21 +0,0 @@ | |||
| 1 | -observability: | ||
| 2 | - googletest: | ||
| 3 | - cpeName: googletest | ||
| 4 | - groupId: | ||
| 5 | - url: https://github.com/google/googletest.git | ||
| 6 | - version: v1.14.0 | ||
| 7 | - eigen: | ||
| 8 | - cpeName: eigen | ||
| 9 | - groupId: | ||
| 10 | - url: https://github.com/libeigen/eigen.git | ||
| 11 | - version: 3.4.0 | ||
| 12 | - makeself: | ||
| 13 | - cpeName: makeself | ||
| 14 | - groupId: | ||
| 15 | - url: https://github.com/megastep/makeself.git | ||
| 16 | - version: release-2.5.0-patch1 | ||
| 17 | - json: | ||
| 18 | - cpeName: json | ||
| 19 | - groupId: | ||
| 20 | - url: https://github.com/nlohmann/json.git | ||
| 21 | - version: v3.11.3 | ||
| @@ -0,0 +1,27 @@ | |||
| 1 | +if(NOT PROJECT_SOURCE_DIR) | ||
| 2 | + if(CANN_3RD_LIB_PATH AND IS_DIRECTORY "${CANN_3RD_LIB_PATH}/cann-cmake") | ||
| 3 | + include("${CANN_3RD_LIB_PATH}/cann-cmake/function/prepare.cmake") | ||
| 4 | + else() | ||
| 5 | + include(FetchContent) | ||
| 6 | + | ||
| 7 | + set(CANN_CMAKE_TAG "master-001") | ||
| 8 | + if(CANN_3RD_LIB_PATH AND EXISTS "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz") | ||
| 9 | + FetchContent_Declare( | ||
| 10 | + cann-cmake | ||
| 11 | + URL "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz" | ||
| 12 | + ) | ||
| 13 | + else() | ||
| 14 | + FetchContent_Declare( | ||
| 15 | + cann-cmake | ||
| 16 | + GIT_REPOSITORY https://gitcode.com/cann/cmake.git | ||
| 17 | + GIT_TAG ${CANN_CMAKE_TAG} | ||
| 18 | + GIT_SHALLOW TRUE | ||
| 19 | + ) | ||
| 20 | + endif() | ||
| 21 | + FetchContent_GetProperties(cann-cmake) | ||
| 22 | + if(NOT cann-cmake_POPULATED) | ||
| 23 | + FetchContent_Populate(cann-cmake) | ||
| 24 | + endif() | ||
| 25 | + include("${cann-cmake_SOURCE_DIR}/function/prepare.cmake") | ||
| 26 | + endif() | ||
| 27 | +endif() | ||
| @@ -12,85 +12,4 @@ | |||
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and | 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | -# ---------------------------------------------------------------------------- | 15 | +# ---------------------------------------------------------------------------- |
| 16 | - | ||
| 17 | -macro(replace_cur_major_minor_ver) | ||
| 18 | - string(REPLACE CUR_MAJOR_MINOR_VER "${CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_VERSION_MAJOR_MINOR}" depend "${depend}") | ||
| 19 | -endmacro() | ||
| 20 | - | ||
| 21 | -# 设置包和版本号 | ||
| 22 | -function(set_package name) | ||
| 23 | - cmake_parse_arguments(VERSION "" "VERSION" "" ${ARGN}) | ||
| 24 | - set(VERSION "${VERSION_VERSION}") | ||
| 25 | - if(NOT name) | ||
| 26 | - message(FATAL_ERROR "The name parameter is not set in set_package.") | ||
| 27 | - endif() | ||
| 28 | - if(NOT VERSION) | ||
| 29 | - message(FATAL_ERROR "The VERSION parameter is not set in set_package(${name}).") | ||
| 30 | - endif() | ||
| 31 | - string(REGEX MATCH "^([0-9]+\\.[0-9]+)" VERSION_MAJOR_MINOR "${VERSION}") | ||
| 32 | - list(APPEND CANN_VERSION_PACKAGES "${name}") | ||
| 33 | - set(CANN_VERSION_PACKAGES "${CANN_VERSION_PACKAGES}" PARENT_SCOPE) | ||
| 34 | - set(CANN_VERSION_CURRENT_PACKAGE "${name}" PARENT_SCOPE) | ||
| 35 | - set(CANN_VERSION_${name}_VERSION "${VERSION}" PARENT_SCOPE) | ||
| 36 | - set(CANN_VERSION_${name}_VERSION_MAJOR_MINOR "${VERSION_MAJOR_MINOR}" PARENT_SCOPE) | ||
| 37 | - set(CANN_VERSION_${name}_BUILD_DEPS PARENT_SCOPE) | ||
| 38 | - set(CANN_VERSION_${name}_RUN_DEPS PARENT_SCOPE) | ||
| 39 | -endfunction() | ||
| 40 | - | ||
| 41 | -# 设置构建依赖 | ||
| 42 | -function(set_build_dependencies pkg_name depend) | ||
| 43 | - if(NOT CANN_VERSION_CURRENT_PACKAGE) | ||
| 44 | - message(FATAL_ERROR "The set_package must be invoked first.") | ||
| 45 | - endif() | ||
| 46 | - if(NOT pkg_name) | ||
| 47 | - message(FATAL_ERROR "The pkg_name parameter is not set in set_build_dependencies.") | ||
| 48 | - endif() | ||
| 49 | - if(NOT depend) | ||
| 50 | - message(FATAL_ERROR "The depend parameter is not set in set_build_dependencies.") | ||
| 51 | - endif() | ||
| 52 | - replace_cur_major_minor_ver() | ||
| 53 | - list(APPEND CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_BUILD_DEPS "${pkg_name}" "${depend}") | ||
| 54 | - set(CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_BUILD_DEPS "${CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_BUILD_DEPS}" PARENT_SCOPE) | ||
| 55 | -endfunction() | ||
| 56 | - | ||
| 57 | -# 设置运行依赖 | ||
| 58 | -function(set_run_dependencies pkg_name depend) | ||
| 59 | - if(NOT CANN_VERSION_CURRENT_PACKAGE) | ||
| 60 | - message(FATAL_ERROR "The set_package must be invoked first.") | ||
| 61 | - endif() | ||
| 62 | - if(NOT pkg_name) | ||
| 63 | - message(FATAL_ERROR "The pkg_name parameter is not set in set_run_dependencies.") | ||
| 64 | - endif() | ||
| 65 | - if(NOT depend) | ||
| 66 | - message(FATAL_ERROR "The depend parameter is not set in set_run_dependencies.") | ||
| 67 | - endif() | ||
| 68 | - replace_cur_major_minor_ver() | ||
| 69 | - list(APPEND CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_RUN_DEPS "${pkg_name}" "${depend}") | ||
| 70 | - set(CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_RUN_DEPS "${CANN_VERSION_${CANN_VERSION_CURRENT_PACKAGE}_RUN_DEPS}" PARENT_SCOPE) | ||
| 71 | -endfunction() | ||
| 72 | - | ||
| 73 | -# 检查构建依赖 | ||
| 74 | -function(check_pkg_build_deps pkg_name) | ||
| 75 | - execute_process( | ||
| 76 | - COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/check_build_dependencies.py "${ASCEND_CANN_PACKAGE_PATH}" ${CANN_VERSION_${pkg_name}_BUILD_DEPS} | ||
| 77 | - RESULT_VARIABLE result | ||
| 78 | - ) | ||
| 79 | - if(result) | ||
| 80 | - message(FATAL_ERROR "Check ${pkg_name} build dependencies failed!") | ||
| 81 | - endif() | ||
| 82 | -endfunction() | ||
| 83 | - | ||
| 84 | -# 添加生成version.info的目标 | ||
| 85 | -# 目标名格式为:version_${包名}_info | ||
| 86 | -function(add_version_info_targets) | ||
| 87 | - foreach(pkg_name ${CANN_VERSION_PACKAGES}) | ||
| 88 | - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/version.${pkg_name}.info | ||
| 89 | - COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_version_info.py --output ${CMAKE_BINARY_DIR}/version.${pkg_name}.info | ||
| 90 | - "${CANN_VERSION_${pkg_name}_VERSION}" ${CANN_VERSION_${pkg_name}_RUN_DEPS} | ||
| 91 | - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_version_info.py | ||
| 92 | - VERBATIM | ||
| 93 | - ) | ||
| 94 | - add_custom_target(version_${pkg_name}_info ALL DEPENDS ${CMAKE_BINARY_DIR}/version.${pkg_name}.info) | ||
| 95 | - endforeach() | ||
| 96 | -endfunction() | ||
| @@ -29,7 +29,7 @@ file(MAKE_DIRECTORY "${STAGING_DIR}") | |||
| 29 | 29 | ||
| 30 | # 执行安装到临时目录 | 30 | # 执行安装到临时目录 |
| 31 | execute_process( | 31 | execute_process( |
| 32 | - COMMAND "${CMAKE_COMMAND}" --install "${CPACK_CMAKE_BINARY_DIR}" --prefix "${STAGING_DIR}" | 32 | + COMMAND "${CMAKE_COMMAND}" --install "${CPACK_CMAKE_BINARY_DIR}" --prefix "${STAGING_DIR}" --component oam-tools |
| 33 | RESULT_VARIABLE INSTALL_RESULT | 33 | RESULT_VARIABLE INSTALL_RESULT |
| 34 | ) | 34 | ) |
| 35 | 35 | ||
| @@ -84,6 +84,7 @@ function(pack_built_in) | |||
| 84 | OWNER_READ OWNER_WRITE OWNER_EXECUTE # 目录权限 | 84 | OWNER_READ OWNER_WRITE OWNER_EXECUTE # 目录权限 |
| 85 | GROUP_READ GROUP_EXECUTE | 85 | GROUP_READ GROUP_EXECUTE |
| 86 | WORLD_READ WORLD_EXECUTE | 86 | WORLD_READ WORLD_EXECUTE |
| 87 | + COMPONENT oam-tools | ||
| 87 | ) | 88 | ) |
| 88 | 89 | ||
| 89 | set(SCRIPTS_FILES | 90 | set(SCRIPTS_FILES |
| @@ -97,6 +98,7 @@ function(pack_built_in) | |||
| 97 | 98 | ||
| 98 | install(FILES ${SCRIPTS_FILES} | 99 | install(FILES ${SCRIPTS_FILES} |
| 99 | DESTINATION share/info/oam_tools/script | 100 | DESTINATION share/info/oam_tools/script |
| 101 | + COMPONENT oam-tools | ||
| 100 | ) | 102 | ) |
| 101 | set(COMMON_FILES | 103 | set(COMMON_FILES |
| 102 | ${CMAKE_SOURCE_DIR}/scripts/package/common/sh/install_common_parser.sh | 104 | ${CMAKE_SOURCE_DIR}/scripts/package/common/sh/install_common_parser.sh |
| @@ -122,12 +124,15 @@ function(pack_built_in) | |||
| 122 | install(FILES ${CMAKE_BINARY_DIR}/version.oam-tools.info | 124 | install(FILES ${CMAKE_BINARY_DIR}/version.oam-tools.info |
| 123 | DESTINATION share/info/oam_tools | 125 | DESTINATION share/info/oam_tools |
| 124 | RENAME version.info | 126 | RENAME version.info |
| 127 | + COMPONENT oam-tools | ||
| 125 | ) | 128 | ) |
| 126 | install(FILES ${CONF_FILES} | 129 | install(FILES ${CONF_FILES} |
| 127 | DESTINATION ${CMAKE_SYSTEM_PROCESSOR}-linux/conf | 130 | DESTINATION ${CMAKE_SYSTEM_PROCESSOR}-linux/conf |
| 131 | + COMPONENT oam-tools | ||
| 128 | ) | 132 | ) |
| 129 | install(FILES ${PACKAGE_FILES} | 133 | install(FILES ${PACKAGE_FILES} |
| 130 | DESTINATION share/info/oam_tools/script | 134 | DESTINATION share/info/oam_tools/script |
| 135 | + COMPONENT oam-tools | ||
| 131 | ) | 136 | ) |
| 132 | 137 | ||
| 133 | string(FIND "${ASCEND_COMPUTE_UNIT}" ";" SEMICOLON_INDEX) | 138 | string(FIND "${ASCEND_COMPUTE_UNIT}" ";" SEMICOLON_INDEX) |
| @@ -61,15 +61,15 @@ set_target_properties(ascend_hal_stub | |||
| 61 | set(PKG_NAME ascend_hal) | 61 | set(PKG_NAME ascend_hal) |
| 62 | install(TARGETS ascend_hal_stub ascend_hal_headers | 62 | install(TARGETS ascend_hal_stub ascend_hal_headers |
| 63 | EXPORT ${PKG_NAME}-targets | 63 | EXPORT ${PKG_NAME}-targets |
| 64 | - LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub OPTIONAL COMPONENT opensdk | 64 | + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub |
| 65 | ) | 65 | ) |
| 66 | message("INSTALL_LIBRARY_DIR : ${INSTALL_LIBRARY_DIR}") | 66 | message("INSTALL_LIBRARY_DIR : ${INSTALL_LIBRARY_DIR}") |
| 67 | install(TARGETS ascend_hal_stub ascend_hal_headers | 67 | install(TARGETS ascend_hal_stub ascend_hal_headers |
| 68 | - LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub OPTIONAL COMPONENT opensdk | 68 | + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub |
| 69 | ) | 69 | ) |
| 70 | install(FILES ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_define.h | 70 | install(FILES ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_define.h |
| 71 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_error.h | 71 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_error.h |
| 72 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal.h | 72 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal.h |
| 73 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_external.h | 73 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ascend_hal_external.h |
| 74 | - DESTINATION ${INSTALL_INCLUDE_DIR}/ascend_hal/driver COMPONENT opensdk EXCLUDE_FROM_ALL | 74 | + DESTINATION ${INSTALL_INCLUDE_DIR}/ascend_hal/driver EXCLUDE_FROM_ALL |
| 75 | ) | 75 | ) |
| @@ -237,6 +237,7 @@ mkdir -p ${third_party_path} | |||
| 237 | |---|---|---| | 237 | |---|---|---| |
| 238 | |msprobe|master|https://gitcode.com/Ascend/msprobe| | 238 | |msprobe|master|https://gitcode.com/Ascend/msprobe| |
| 239 | |msprof|master|https://gitcode.com/Ascend/msprof| | 239 | |msprof|master|https://gitcode.com/Ascend/msprof| |
| 240 | +|cann-cmake|master-001|[cmake-master-001.tar.gz](https://cann-3rd.obs.cn-north-4.myhuaweicloud.com/cmake/cmake-master-001.tar.gz) | | ||
| 240 | 241 | ||
| 241 | ## 环境验证 | 242 | ## 环境验证 |
| 242 | 243 | ||
Dscripts/check_build_dependencies.py+0-200
| @@ -1,200 +0,0 @@ | |||
| 1 | -#!/usr/bin/env python3 | ||
| 2 | -# -*- coding: utf-8 -*- | ||
| 3 | -# ---------------------------------------------------------------------------- | ||
| 4 | -# Copyright (c) 2025 Huawei Technologies Co., Ltd. | ||
| 5 | -# | ||
| 6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | -# you may not use this file except in compliance with the License. | ||
| 8 | -# You may obtain a copy of the License at | ||
| 9 | -# | ||
| 10 | -# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | -# | ||
| 12 | -# Unless required by applicable law or agreed to in writing, software | ||
| 13 | -# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | -# See the License for the specific language governing permissions and | ||
| 16 | -# limitations under the License. | ||
| 17 | -# ---------------------------------------------------------------------------- | ||
| 18 | - | ||
| 19 | -"""检查构建依赖。""" | ||
| 20 | - | ||
| 21 | -import argparse | ||
| 22 | -import logging | ||
| 23 | -import os | ||
| 24 | -import sys | ||
| 25 | -from typing import Iterator, List, NamedTuple, Optional | ||
| 26 | - | ||
| 27 | - | ||
| 28 | -class Receiver(NamedTuple): | ||
| 29 | - """消息接收器。""" | ||
| 30 | - warn_msgs: List[str] | ||
| 31 | - err_msgs: List[str] | ||
| 32 | - | ||
| 33 | - | ||
| 34 | -def parse_version_line(line: str) -> str: | ||
| 35 | - """解析版本行。""" | ||
| 36 | - version = line.strip().split('=', maxsplit=1)[1] | ||
| 37 | - return version.split('-')[0] | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -def read_pkg_version(recv: Receiver, ascend_install_path: str, name: str) -> Optional[str]: | ||
| 41 | - """读取包版本。""" | ||
| 42 | - filepath = os.path.join(ascend_install_path, 'share', 'info', name, 'version.info') | ||
| 43 | - if not os.path.isfile(filepath): | ||
| 44 | - recv.err_msgs.append(f'{filepath} does not exist in read_pkg_version!') | ||
| 45 | - return None | ||
| 46 | - | ||
| 47 | - with open(filepath, encoding='utf-8') as file: | ||
| 48 | - for line in file: | ||
| 49 | - if line.startswith('Version='): | ||
| 50 | - return parse_version_line(line) | ||
| 51 | - | ||
| 52 | - recv.err_msgs.append(f'The version field was not found in {filepath} in read_pkg_version!') | ||
| 53 | - return None | ||
| 54 | - | ||
| 55 | - | ||
| 56 | -def check_build_dep_item(version: str, dep: str) -> bool: | ||
| 57 | - """检查构建依赖项。""" | ||
| 58 | - def split_version(version: str) -> List[int]: | ||
| 59 | - return [int(num) for num in version.split('.')] | ||
| 60 | - | ||
| 61 | - def check_ge() -> bool: | ||
| 62 | - for req, rel in zip(dep_parts, version_parts): | ||
| 63 | - if req > rel: | ||
| 64 | - return False | ||
| 65 | - if rel > req: | ||
| 66 | - return True | ||
| 67 | - return True | ||
| 68 | - | ||
| 69 | - def check_gt() -> bool: | ||
| 70 | - for req, rel in zip(dep_parts, version_parts): | ||
| 71 | - if req > rel: | ||
| 72 | - return False | ||
| 73 | - if rel > req: | ||
| 74 | - return True | ||
| 75 | - return False | ||
| 76 | - | ||
| 77 | - def check_le() -> bool: | ||
| 78 | - for req, rel in zip(dep_parts, version_parts): | ||
| 79 | - if rel > req: | ||
| 80 | - return False | ||
| 81 | - if req > rel: | ||
| 82 | - return True | ||
| 83 | - return True | ||
| 84 | - | ||
| 85 | - def check_lt() -> bool: | ||
| 86 | - for req, rel in zip(dep_parts, version_parts): | ||
| 87 | - if rel > req: | ||
| 88 | - return False | ||
| 89 | - if req > rel: | ||
| 90 | - return True | ||
| 91 | - return False | ||
| 92 | - | ||
| 93 | - def check_eq() -> bool: | ||
| 94 | - for req, rel in zip(dep_parts, version_parts): | ||
| 95 | - if req != rel: | ||
| 96 | - return False | ||
| 97 | - return True | ||
| 98 | - | ||
| 99 | - version_parts = split_version(version) | ||
| 100 | - | ||
| 101 | - if dep.startswith('>='): | ||
| 102 | - dep = dep[2:] | ||
| 103 | - check_func = check_ge | ||
| 104 | - elif dep.startswith('>'): | ||
| 105 | - dep = dep[1:] | ||
| 106 | - check_func = check_gt | ||
| 107 | - elif dep.startswith('<='): | ||
| 108 | - dep = dep[2:] | ||
| 109 | - check_func = check_le | ||
| 110 | - elif dep.startswith('<'): | ||
| 111 | - dep = dep[1:] | ||
| 112 | - check_func = check_lt | ||
| 113 | - else: | ||
| 114 | - check_func = check_eq | ||
| 115 | - | ||
| 116 | - dep_parts = split_version(dep) | ||
| 117 | - | ||
| 118 | - if check_func is check_eq: | ||
| 119 | - return check_func() | ||
| 120 | - | ||
| 121 | - if len(dep_parts) < len(version_parts): | ||
| 122 | - dep_parts.extend([0] * (len(version_parts) - len(dep_parts))) | ||
| 123 | - elif len(dep_parts) > len(version_parts): | ||
| 124 | - version_parts.extend([0] * (len(dep_parts) - len(version_parts))) | ||
| 125 | - | ||
| 126 | - return check_func() | ||
| 127 | - | ||
| 128 | - | ||
| 129 | -def check_build_dep(version: str, dep_info: str) -> bool: | ||
| 130 | - """检查构建依赖。""" | ||
| 131 | - def check_range(dep: str, deps_iter: Iterator[str]) -> bool: | ||
| 132 | - result = check_build_dep_item(version, dep) | ||
| 133 | - for dep in deps_iter: | ||
| 134 | - if dep.startswith('<') or dep.startswith('<='): | ||
| 135 | - return result and check_build_dep_item(version, dep) | ||
| 136 | - result &= check_build_dep_item(version, dep) | ||
| 137 | - return result | ||
| 138 | - | ||
| 139 | - deps = [dep.strip() for dep in dep_info.split(',')] | ||
| 140 | - deps_iter = iter(deps) | ||
| 141 | - | ||
| 142 | - for dep in deps_iter: | ||
| 143 | - if dep.startswith('>=') or dep.startswith('>'): | ||
| 144 | - result = check_range(dep, deps_iter) | ||
| 145 | - else: | ||
| 146 | - result = check_build_dep_item(version, dep) | ||
| 147 | - if result: | ||
| 148 | - return True | ||
| 149 | - return False | ||
| 150 | - | ||
| 151 | - | ||
| 152 | - | ||
| 153 | -def check_build_deps(recv: Receiver, ascend_install_path: str, deps: list): | ||
| 154 | - """检查构建依赖。""" | ||
| 155 | - deps_iter = iter(deps) | ||
| 156 | - for dep_pkg in deps_iter: | ||
| 157 | - dep_info = next(deps_iter) | ||
| 158 | - version = read_pkg_version(recv, ascend_install_path, dep_pkg) | ||
| 159 | - if not version: | ||
| 160 | - continue | ||
| 161 | - try: | ||
| 162 | - if not check_build_dep(version, dep_info): | ||
| 163 | - warn_msg = 'Check build dependency failed! ' \ | ||
| 164 | - f'Required {dep_pkg} version is {dep_info}, but {dep_pkg} version is {version}.' | ||
| 165 | - recv.warn_msgs.append(warn_msg) | ||
| 166 | - except ValueError: | ||
| 167 | - err_msg = f'Check build dependency error! version is {version}, dep_info is {dep_info}.' | ||
| 168 | - recv.err_msgs.append(err_msg) | ||
| 169 | - | ||
| 170 | - | ||
| 171 | -def main(): | ||
| 172 | - """主流程。""" | ||
| 173 | - parser = argparse.ArgumentParser() | ||
| 174 | - parser.add_argument('ascend_install_path', help='Ascend install path.') | ||
| 175 | - parser.add_argument('deps', nargs='*', help='Dependency informations.') | ||
| 176 | - args = parser.parse_args() | ||
| 177 | - | ||
| 178 | - logging.basicConfig(format=f'{os.path.basename(__file__)}: %(levelname)s: %(message)s') | ||
| 179 | - if len(args.deps) % 2 != 0: | ||
| 180 | - logging.error('The deps argument must contain an even number of elements!') | ||
| 181 | - return False | ||
| 182 | - | ||
| 183 | - recv = Receiver([], []) | ||
| 184 | - check_build_deps(recv, args.ascend_install_path, args.deps) | ||
| 185 | - | ||
| 186 | - if recv.warn_msgs: | ||
| 187 | - for warn_msg in recv.warn_msgs: | ||
| 188 | - logging.warning(warn_msg) | ||
| 189 | - | ||
| 190 | - if recv.err_msgs: | ||
| 191 | - for err_msg in recv.err_msgs: | ||
| 192 | - logging.error(err_msg) | ||
| 193 | - return False | ||
| 194 | - | ||
| 195 | - return True | ||
| 196 | - | ||
| 197 | - | ||
| 198 | -if __name__ == '__main__': | ||
| 199 | - if not main(): | ||
| 200 | - sys.exit(1) | ||
Dscripts/generate_version_info.py+0-69
| @@ -1,69 +0,0 @@ | |||
| 1 | -#!/usr/bin/env python3 | ||
| 2 | -# -*- coding: utf-8 -*- | ||
| 3 | -# ---------------------------------------------------------------------------- | ||
| 4 | -# Copyright (c) 2025 Huawei Technologies Co., Ltd. | ||
| 5 | -# | ||
| 6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | -# you may not use this file except in compliance with the License. | ||
| 8 | -# You may obtain a copy of the License at | ||
| 9 | -# | ||
| 10 | -# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | -# | ||
| 12 | -# Unless required by applicable law or agreed to in writing, software | ||
| 13 | -# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | -# See the License for the specific language governing permissions and | ||
| 16 | -# limitations under the License. | ||
| 17 | -# ---------------------------------------------------------------------------- | ||
| 18 | - | ||
| 19 | -"""生成version.info文件。""" | ||
| 20 | - | ||
| 21 | -import argparse | ||
| 22 | -import logging | ||
| 23 | -import os | ||
| 24 | -import sys | ||
| 25 | -from datetime import datetime, timedelta, timezone | ||
| 26 | -from typing import Iterable, Iterator | ||
| 27 | - | ||
| 28 | - | ||
| 29 | -def gen_version_info_content(version: str, deps: Iterable[str]) -> Iterator[str]: | ||
| 30 | - """生成version.info文件内容。""" | ||
| 31 | - yield f'Version={version}' | ||
| 32 | - yield 'version_dir=cann' | ||
| 33 | - deps_iter = iter(deps) | ||
| 34 | - for dep_pkg in deps_iter: | ||
| 35 | - dep_info = next(deps_iter) | ||
| 36 | - yield f'required_package_{dep_pkg}_version="{dep_info}"' | ||
| 37 | - if os.environ.get('tagInfo'): | ||
| 38 | - tag_info = os.environ.get('tagInfo') | ||
| 39 | - timestamp = '_'.join(tag_info.split('_')[-3:-1]) | ||
| 40 | - else: | ||
| 41 | - timestamp = datetime.now(timezone(timedelta(hours=8))).strftime('%Y%m%d_%H%M%S%f')[:-3] | ||
| 42 | - yield f'timestamp={timestamp}' | ||
| 43 | - yield '' # for last \n | ||
| 44 | - | ||
| 45 | - | ||
| 46 | -def main(): | ||
| 47 | - """主流程。""" | ||
| 48 | - parser = argparse.ArgumentParser() | ||
| 49 | - parser.add_argument('version', help='Version number.') | ||
| 50 | - parser.add_argument('deps', nargs='*', help='Dependency informations.') | ||
| 51 | - parser.add_argument('--output', required=True, help='Output file path.') | ||
| 52 | - args = parser.parse_args() | ||
| 53 | - | ||
| 54 | - logging.basicConfig(format=f'{os.path.basename(__file__)}: %(levelname)s: %(message)s') | ||
| 55 | - | ||
| 56 | - if len(args.deps) % 2 != 0: | ||
| 57 | - logging.error('The deps argument must contain an even number of elements!') | ||
| 58 | - return False | ||
| 59 | - | ||
| 60 | - content = '\n'.join(gen_version_info_content(args.version, args.deps)) | ||
| 61 | - with open(args.output, 'w', encoding='utf-8') as file: | ||
| 62 | - file.write(content) | ||
| 63 | - | ||
| 64 | - return True | ||
| 65 | - | ||
| 66 | - | ||
| 67 | -if __name__ == '__main__': | ||
| 68 | - if not main(): | ||
| 69 | - sys.exit(1) | ||
| @@ -8,5 +8,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/asys.cmake) | |||
| 8 | 8 | ||
| 9 | install(DIRECTORY | 9 | install(DIRECTORY |
| 10 | ${ASYS_DIR} | 10 | ${ASYS_DIR} |
| 11 | - DESTINATION ${INSTALL_LIBRARY_DIR}/tools/ascend_system_advisor OPTIONAL | 11 | + DESTINATION ${INSTALL_LIBRARY_DIR}/tools/ascend_system_advisor |
| 12 | + COMPONENT oam-tools | ||
| 12 | ) | 13 | ) |
| @@ -49,11 +49,4 @@ configure_file( | |||
| 49 | ${CMAKE_CURRENT_LIST_DIR}/common/chip_handler.py.in # 输入模板路径 | 49 | ${CMAKE_CURRENT_LIST_DIR}/common/chip_handler.py.in # 输入模板路径 |
| 50 | ${CMAKE_CURRENT_LIST_DIR}/common/chip_handler.py # 输出文件路径 | 50 | ${CMAKE_CURRENT_LIST_DIR}/common/chip_handler.py # 输出文件路径 |
| 51 | @ONLY # 只替换 @变量@ 格式的占位符 | 51 | @ONLY # 只替换 @变量@ 格式的占位符 |
| 52 | -) | 52 | +) |
| 53 | - | ||
| 54 | -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/chip_handler.py | ||
| 55 | - COMMAND cp -f ${CMAKE_CURRENT_LIST_DIR}/common/chip_handler.py ${CMAKE_CURRENT_BINARY_DIR}/chip_handler.py | ||
| 56 | -) | ||
| 57 | -add_custom_target(chip_handler DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/chip_handler.py) | ||
| 58 | - | ||
| 59 | -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chip_handler.py DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL) | ||
| @@ -22,5 +22,7 @@ set(HCCL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | |||
| 22 | 22 | ||
| 23 | install(DIRECTORY | 23 | install(DIRECTORY |
| 24 | ${HCCL_TEST_DIR} | 24 | ${HCCL_TEST_DIR} |
| 25 | - DESTINATION ${INSTALL_LIBRARY_DIR}/tools OPTIONAL | 25 | + DESTINATION ${INSTALL_LIBRARY_DIR}/tools |
| 26 | + ${INSTALL_OPTIONAL} | ||
| 27 | + COMPONENT oam-tools | ||
| 26 | ) | 28 | ) |
| @@ -42,4 +42,6 @@ add_custom_command(OUTPUT ${MS_AIC_ERR_NAME} | |||
| 42 | 42 | ||
| 43 | install(DIRECTORY | 43 | install(DIRECTORY |
| 44 | ${MSAICERR_DIR}/ | 44 | ${MSAICERR_DIR}/ |
| 45 | - DESTINATION ${INSTALL_LIBRARY_DIR}/tools/msaicerr OPTIONAL) | 45 | + DESTINATION ${INSTALL_LIBRARY_DIR}/tools/msaicerr |
| 46 | + COMPONENT oam-tools | ||
| 47 | +) | ||
| @@ -61,6 +61,7 @@ target_link_options(ascend_dump_parser PRIVATE | |||
| 61 | -Wl,--exclude-libs,ALL | 61 | -Wl,--exclude-libs,ALL |
| 62 | ) | 62 | ) |
| 63 | 63 | ||
| 64 | -install(TARGETS ascend_dump_parser OPTIONAL | 64 | +install(TARGETS ascend_dump_parser |
| 65 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}-linux/lib64 | 65 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}-linux/lib64 |
| 66 | + COMPONENT oam-tools | ||
| 66 | ) | 67 | ) |
| @@ -110,21 +110,21 @@ macro(install_package) | |||
| 110 | 110 | ||
| 111 | install(TARGETS ${TARGET_LIST} | 111 | install(TARGETS ${TARGET_LIST} |
| 112 | EXPORT ${PKG_NAME}-targets | 112 | EXPORT ${PKG_NAME}-targets |
| 113 | - LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk | 113 | + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 114 | - ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} OPTIONAL COMPONENT opensdk | 114 | + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} |
| 115 | - RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} OPTIONAL COMPONENT opensdk | 115 | + RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} |
| 116 | ) | 116 | ) |
| 117 | 117 | ||
| 118 | if (file_count GREATER 0) | 118 | if (file_count GREATER 0) |
| 119 | foreach(i RANGE 1 ${file_count}) | 119 | foreach(i RANGE 1 ${file_count}) |
| 120 | - install(FILES ${FILES_${i}} DESTINATION ${FILES_DESTINATION_${i}} COMPONENT opensdk EXCLUDE_FROM_ALL) | 120 | + install(FILES ${FILES_${i}} DESTINATION ${FILES_DESTINATION_${i}} EXCLUDE_FROM_ALL) |
| 121 | endforeach() | 121 | endforeach() |
| 122 | endif() | 122 | endif() |
| 123 | 123 | ||
| 124 | if (directory_count GREATER 0) | 124 | if (directory_count GREATER 0) |
| 125 | foreach(i RANGE 1 ${directory_count}) | 125 | foreach(i RANGE 1 ${directory_count}) |
| 126 | install(DIRECTORY ${DIRECTORY_${i}} DESTINATION ${DIRECTORY_DESTINATION_${i}} | 126 | install(DIRECTORY ${DIRECTORY_${i}} DESTINATION ${DIRECTORY_DESTINATION_${i}} |
| 127 | - COMPONENT opensdk EXCLUDE_FROM_ALL | 127 | + EXCLUDE_FROM_ALL |
| 128 | FILES_MATCHING | 128 | FILES_MATCHING |
| 129 | PATTERN "*.h" | 129 | PATTERN "*.h" |
| 130 | PATTERN "*.cppm") | 130 | PATTERN "*.cppm") |
| @@ -133,7 +133,7 @@ macro(install_package) | |||
| 133 | 133 | ||
| 134 | if (PACKAGE STREQUAL "opensdk") | 134 | if (PACKAGE STREQUAL "opensdk") |
| 135 | install(EXPORT ${PKG_NAME}-targets DESTINATION ${INSTALL_CONFIG_DIR} | 135 | install(EXPORT ${PKG_NAME}-targets DESTINATION ${INSTALL_CONFIG_DIR} |
| 136 | - FILE ${PKG_NAME}-targets.cmake COMPONENT opensdk EXCLUDE_FROM_ALL | 136 | + FILE ${PKG_NAME}-targets.cmake EXCLUDE_FROM_ALL |
| 137 | ) | 137 | ) |
| 138 | configure_package_config_file(${TOP_DIR}/cmake/config/pkg_config_template.cmake.in | 138 | configure_package_config_file(${TOP_DIR}/cmake/config/pkg_config_template.cmake.in |
| 139 | ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-config.cmake | 139 | ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-config.cmake |
| @@ -142,7 +142,7 @@ macro(install_package) | |||
| 142 | INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} | 142 | INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} |
| 143 | ) | 143 | ) |
| 144 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-config.cmake | 144 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-config.cmake |
| 145 | - DESTINATION ${INSTALL_CONFIG_DIR} COMPONENT opensdk EXCLUDE_FROM_ALL | 145 | + DESTINATION ${INSTALL_CONFIG_DIR} EXCLUDE_FROM_ALL |
| 146 | ) | 146 | ) |
| 147 | endif() | 147 | endif() |
| 148 | 148 | ||
| @@ -193,5 +193,6 @@ install(DIRECTORY | |||
| 193 | ${MSPROF_INSTALL_CONFIG_DIR}/profiling # install_config_dir is a relative path, must Splicing it while install | 193 | ${MSPROF_INSTALL_CONFIG_DIR}/profiling # install_config_dir is a relative path, must Splicing it while install |
| 194 | DESTINATION | 194 | DESTINATION |
| 195 | ${MSPROF_INSTALL_LIBRARY_DIR} | 195 | ${MSPROF_INSTALL_LIBRARY_DIR} |
| 196 | - OPTIONAL | 196 | + ${INSTALL_OPTIONAL} |
| 197 | + COMPONENT oam-tools | ||
| 197 | ) | 198 | ) |
| @@ -273,7 +273,7 @@ target_link_libraries(profimpl_fwk_share PRIVATE | |||
| 273 | -Wl,--as-needed | 273 | -Wl,--as-needed |
| 274 | ) | 274 | ) |
| 275 | 275 | ||
| 276 | -install(TARGETS profimpl_fwk_share OPTIONAL | 276 | +install(TARGETS profimpl_fwk_share ${INSTALL_OPTIONAL} |
| 277 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 277 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 278 | ) | 278 | ) |
| 279 | ####################### libprofimpl.so ########################### | 279 | ####################### libprofimpl.so ########################### |
| @@ -189,8 +189,9 @@ set_target_properties(acp | |||
| 189 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ | 189 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ |
| 190 | ) | 190 | ) |
| 191 | 191 | ||
| 192 | -install(TARGETS acp OPTIONAL | 192 | +install(TARGETS acp ${INSTALL_OPTIONAL} |
| 193 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/bin | 193 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/bin |
| 194 | + COMPONENT oam-tools | ||
| 194 | ) | 195 | ) |
| 195 | 196 | ||
| 196 | ####################### acp end ####################### | 197 | ####################### acp end ####################### |
| @@ -334,8 +335,9 @@ target_link_libraries(profinj PRIVATE | |||
| 334 | ascend_hal | 335 | ascend_hal |
| 335 | ) | 336 | ) |
| 336 | 337 | ||
| 337 | -install(TARGETS profinj OPTIONAL | 338 | +install(TARGETS profinj ${INSTALL_OPTIONAL} |
| 338 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/lib64 | 339 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/lib64 |
| 340 | + COMPONENT oam-tools | ||
| 339 | ) | 341 | ) |
| 340 | 342 | ||
| 341 | add_dependencies(profinj profiler_proto) | 343 | add_dependencies(profinj profiler_proto) |
| @@ -104,7 +104,7 @@ set_target_properties(adprof | |||
| 104 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ | 104 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ |
| 105 | ) | 105 | ) |
| 106 | 106 | ||
| 107 | -install(TARGETS adprof OPTIONAL | 107 | +install(TARGETS adprof ${INSTALL_OPTIONAL} |
| 108 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 108 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 109 | ) | 109 | ) |
| 110 | 110 | ||
| @@ -195,8 +195,9 @@ target_link_libraries(ascend_devprof PRIVATE | |||
| 195 | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:log> | 195 | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Android>:log> |
| 196 | ) | 196 | ) |
| 197 | 197 | ||
| 198 | -install(TARGETS ascend_devprof OPTIONAL | 198 | +install(TARGETS ascend_devprof ${INSTALL_OPTIONAL} |
| 199 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 199 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 200 | + COMPONENT oam-tools | ||
| 200 | ) | 201 | ) |
| 201 | 202 | ||
| 202 | add_dependencies(ascend_devprof profiler_proto) | 203 | add_dependencies(ascend_devprof profiler_proto) |
| @@ -236,16 +236,19 @@ set_target_properties(msprofbin | |||
| 236 | ) | 236 | ) |
| 237 | 237 | ||
| 238 | if (DEFINED PKG_NAME AND PKG_NAME STREQUAL "oam") | 238 | if (DEFINED PKG_NAME AND PKG_NAME STREQUAL "oam") |
| 239 | - install(TARGETS msprofbin OPTIONAL | 239 | + install(TARGETS msprofbin ${INSTALL_OPTIONAL} |
| 240 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/bin | 240 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/bin |
| 241 | + COMPONENT oam-tools | ||
| 241 | ) | 242 | ) |
| 242 | else() | 243 | else() |
| 243 | - install(TARGETS msprofbin OPTIONAL | 244 | + install(TARGETS msprofbin ${INSTALL_OPTIONAL} |
| 244 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/profiler/bin | 245 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/profiler/bin |
| 246 | + COMPONENT oam-tools | ||
| 245 | ) | 247 | ) |
| 246 | 248 | ||
| 247 | - install(TARGETS msprofbin OPTIONAL | 249 | + install(TARGETS msprofbin ${INSTALL_OPTIONAL} |
| 248 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/profiler/bin | 250 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/profiler/bin |
| 251 | + COMPONENT oam-tools | ||
| 249 | ) | 252 | ) |
| 250 | endif() | 253 | endif() |
| 251 | 254 | ||
| @@ -270,5 +273,7 @@ set(msprof_whl | |||
| 270 | ${CMAKE_CURRENT_SOURCE_DIR}/../msprof-0.0.1-py3-none-any.whl | 273 | ${CMAKE_CURRENT_SOURCE_DIR}/../msprof-0.0.1-py3-none-any.whl |
| 271 | ) | 274 | ) |
| 272 | install(PROGRAMS ${msprof_whl} | 275 | install(PROGRAMS ${msprof_whl} |
| 273 | - DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/profiler_tool OPTIONAL | 276 | + DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/profiler_tool |
| 277 | + ${INSTALL_OPTIONAL} | ||
| 278 | + COMPONENT oam-tools | ||
| 274 | ) | 279 | ) |
| @@ -232,8 +232,9 @@ set_target_properties(msprofbin | |||
| 232 | LIBRARY_OUTPUT_DIRECTORY ${INSTALL_LIBRARY_DIR}/msprof | 232 | LIBRARY_OUTPUT_DIRECTORY ${INSTALL_LIBRARY_DIR}/msprof |
| 233 | ) | 233 | ) |
| 234 | 234 | ||
| 235 | -install(TARGETS msprofbin OPTIONAL | 235 | +install(TARGETS msprofbin ${INSTALL_OPTIONAL} |
| 236 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/msprof/bin | 236 | RUNTIME DESTINATION ${INSTALL_LIBRARY_DIR}/msprof/bin |
| 237 | + COMPONENT oam-tools | ||
| 237 | ) | 238 | ) |
| 238 | 239 | ||
| 239 | ### onetrack target interface | 240 | ### onetrack target interface |
| @@ -257,5 +258,7 @@ set(msprof_whl | |||
| 257 | ${CMAKE_CURRENT_SOURCE_DIR}/../msprof-0.0.1-py3-none-any.whl | 258 | ${CMAKE_CURRENT_SOURCE_DIR}/../msprof-0.0.1-py3-none-any.whl |
| 258 | ) | 259 | ) |
| 259 | install(PROGRAMS ${msprof_whl} | 260 | install(PROGRAMS ${msprof_whl} |
| 260 | - DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/profiler_tool OPTIONAL | 261 | + DESTINATION ${INSTALL_LIBRARY_DIR}/tools/profiler/profiler_tool |
| 262 | + ${INSTALL_OPTIONAL} | ||
| 263 | + COMPONENT oam-tools | ||
| 261 | ) | 264 | ) |
| @@ -212,7 +212,7 @@ target_link_libraries(msprofiler_fwk_lite_share | |||
| 212 | msprof_headers | 212 | msprof_headers |
| 213 | ) | 213 | ) |
| 214 | 214 | ||
| 215 | -install(TARGETS msprofiler_fwk_lite_share OPTIONAL | 215 | +install(TARGETS msprofiler_fwk_lite_share ${INSTALL_OPTIONAL} |
| 216 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/lib | 216 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/lib |
| 217 | ) | 217 | ) |
| 218 | ####################### libmsprofiler_lite.so ######################### | 218 | ####################### libmsprofiler_lite.so ######################### |
| @@ -286,7 +286,7 @@ target_link_libraries(msprofiler PRIVATE | |||
| 286 | -Wl,--as-needed | 286 | -Wl,--as-needed |
| 287 | ) | 287 | ) |
| 288 | 288 | ||
| 289 | -install(TARGETS msprofiler OPTIONAL | 289 | +install(TARGETS msprofiler ${INSTALL_OPTIONAL} |
| 290 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 290 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 291 | ) | 291 | ) |
| 292 | endif() | 292 | endif() |
| @@ -357,7 +357,7 @@ target_link_libraries(stub_msprofiler PRIVATE | |||
| 357 | $<BUILD_INTERFACE:runtime_headers> | 357 | $<BUILD_INTERFACE:runtime_headers> |
| 358 | ) | 358 | ) |
| 359 | 359 | ||
| 360 | -install(TARGETS stub_msprofiler OPTIONAL | 360 | +install(TARGETS stub_msprofiler ${INSTALL_OPTIONAL} |
| 361 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub | 361 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub |
| 362 | ) | 362 | ) |
| 363 | ###################### stub/libmsprofiler.so ####################### | 363 | ###################### stub/libmsprofiler.so ####################### |
| @@ -101,7 +101,7 @@ target_link_libraries(profapi_stub PRIVATE | |||
| 101 | -Wl,--as-needed | 101 | -Wl,--as-needed |
| 102 | ) | 102 | ) |
| 103 | 103 | ||
| 104 | -install(TARGETS profapi_stub OPTIONAL | 104 | +install(TARGETS profapi_stub ${INSTALL_OPTIONAL} |
| 105 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 105 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 106 | ) | 106 | ) |
| 107 | ####################### libprofapi static lib for windows end ########################### | 107 | ####################### libprofapi static lib for windows end ########################### |
| @@ -213,7 +213,7 @@ target_link_libraries(profapi_lite_share | |||
| 213 | msprof_headers | 213 | msprof_headers |
| 214 | ) | 214 | ) |
| 215 | 215 | ||
| 216 | -install(TARGETS profapi_lite_share OPTIONAL | 216 | +install(TARGETS profapi_lite_share ${INSTALL_OPTIONAL} |
| 217 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/lib | 217 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/lib |
| 218 | ) | 218 | ) |
| 219 | 219 | ||
| @@ -138,7 +138,7 @@ target_link_libraries(ascendprof_fwk_share PRIVATE | |||
| 138 | -Wl,--as-needed | 138 | -Wl,--as-needed |
| 139 | ) | 139 | ) |
| 140 | 140 | ||
| 141 | -install(TARGETS ascendprof_fwk_share OPTIONAL | 141 | +install(TARGETS ascendprof_fwk_share ${INSTALL_OPTIONAL} |
| 142 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | 142 | LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} |
| 143 | ) | 143 | ) |
| 144 | 144 | ||
| @@ -30,9 +30,9 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/msaccucmp) | |||
| 30 | COMMAND mv ${DEST_MSACCUCMP_DIR}/${CMP_TAR_NAME} ${OPERATOR_CMP_DIR} && tar zxvf ${OPERATOR_CMP_DIR}/${CMP_TAR_NAME} -C ${OPERATOR_CMP_DIR} | 30 | COMMAND mv ${DEST_MSACCUCMP_DIR}/${CMP_TAR_NAME} ${OPERATOR_CMP_DIR} && tar zxvf ${OPERATOR_CMP_DIR}/${CMP_TAR_NAME} -C ${OPERATOR_CMP_DIR} |
| 31 | COMMAND rm -rf ${OPERATOR_CMP_DIR}/${CMP_TAR_NAME} | 31 | COMMAND rm -rf ${OPERATOR_CMP_DIR}/${CMP_TAR_NAME} |
| 32 | ) | 32 | ) |
| 33 | - install(DIRECTORY ${OPERATOR_CMP_DIR} DESTINATION ${INSTALL_LIBRARY_DIR}/tools OPTIONAL) | 33 | + install(DIRECTORY ${OPERATOR_CMP_DIR} DESTINATION ${INSTALL_LIBRARY_DIR}/tools ${INSTALL_OPTIONAL} COMPONENT oam-tools) |
| 34 | else() | 34 | else() |
| 35 | set(OPERATOR_CMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/operator_cmp) | 35 | set(OPERATOR_CMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/operator_cmp) |
| 36 | file(MAKE_DIRECTORY ${OPERATOR_CMP_DIR}) | 36 | file(MAKE_DIRECTORY ${OPERATOR_CMP_DIR}) |
| 37 | - install(DIRECTORY ${OPERATOR_CMP_DIR} DESTINATION ${INSTALL_LIBRARY_DIR}/tools OPTIONAL) | 37 | + install(DIRECTORY ${OPERATOR_CMP_DIR} DESTINATION ${INSTALL_LIBRARY_DIR}/tools ${INSTALL_OPTIONAL} COMPONENT oam-tools) |
| 38 | endif() | 38 | endif() |
| @@ -8,10 +8,10 @@ | |||
| 8 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 9 | # ----------------------------------------------------------------------------------------------------------- | 9 | # ----------------------------------------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | -set_package(oam-tools VERSION "9.0.0") | 11 | +set_cann_package(oam-tools VERSION "9.0.0") |
| 12 | 12 | ||
| 13 | -set_build_dependencies(metadef "9.0") | 13 | +set_cann_build_dependencies(metadef "9.0") |
| 14 | -set_build_dependencies(runtime "9.0") | 14 | +set_cann_build_dependencies(runtime "9.0") |
| 15 | 15 | ||
| 16 | -set_run_dependencies(metadef "9.0") | 16 | +set_cann_run_dependencies(metadef "9.0") |
| 17 | -set_run_dependencies(runtime "9.0") | 17 | +set_cann_run_dependencies(runtime "9.0") |