diff --git a/CMakeLists.txt b/CMakeLists.txt index bb8fcf0d11c2f3d4ac0ecb2189161ace66d74d08..a8ce4d30d9127f61ccdd5d52feb8f66aed47b883 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ if (ENABLE_OPEN_SRC) # 自研软件包 find_package(securec MODULE REQUIRED) find_package(slog MODULE REQUIRED) + find_package(unified_dlog MODULE REQUIRED) if (NOT (ENABLE_METADEF_UT OR ENABLE_METADEF_ST)) find_package(mmpa MODULE REQUIRED) endif() diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index e553d8b980ce36068281f33ac72b9e85ab3dc8d0..513eeb898f61eb46941b747426a1502dab8bd814 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -57,7 +57,7 @@ target_link_libraries(opp_registry PRIVATE intf_pub c_sec - slog + unified_dlog platform metadef static_mmpa @@ -175,7 +175,7 @@ target_link_libraries(stub_opp_registry slog_headers c_sec_headers c_sec - slog + unified_dlog PUBLIC metadef_headers ) @@ -268,7 +268,7 @@ target_link_libraries(metadef error_manager -Wl,--no-as-needed c_sec - slog + unified_dlog static_mmpa -Wl,--as-needed json @@ -348,7 +348,7 @@ target_link_libraries(stub_metadef slog_headers c_sec_headers c_sec - slog + unified_dlog json PUBLIC metadef_headers @@ -408,7 +408,7 @@ target_link_libraries(exe_graph PRIVATE metadef_headers error_manager c_sec - slog + unified_dlog $<$>:-lrt> -ldl ) diff --git a/base/registry/op_bin_info.cc b/base/registry/op_bin_info.cc index cbfc0d97d981bf455f3401bda3531233aa5a4eb4..fa8294a4c5a0ba9d57d1a615941db8fb8a1b07bf 100644 --- a/base/registry/op_bin_info.cc +++ b/base/registry/op_bin_info.cc @@ -22,7 +22,7 @@ #include #include #include "op_bin_info_utils.h" -#include "toolchain/slog.h" +#include "toolchain/dlog_pub.h" #include "common/ge_common/debug/ge_log.h" namespace ops { diff --git a/cmake/intf_pub_linux.cmake b/cmake/intf_pub_linux.cmake index 39935e86a365810e41f81e126d391126ae740442..073106f09ee6bba42dd7b574497d395d27c69e87 100644 --- a/cmake/intf_pub_linux.cmake +++ b/cmake/intf_pub_linux.cmake @@ -26,7 +26,6 @@ target_compile_definitions(intf_pub_base INTERFACE $<$:CFG_BUILD_NDEBUG> $<$:CFG_BUILD_DEBUG> LINUX=0 - LOG_CPP $<$:SUPPORT_LARGE_MODEL_ENABLE=1> ) diff --git a/cmake/modules/Findunified_dlog.cmake b/cmake/modules/Findunified_dlog.cmake new file mode 100644 index 0000000000000000000000000000000000000000..0998b6f172795d5cb425477f629491d38992232a --- /dev/null +++ b/cmake/modules/Findunified_dlog.cmake @@ -0,0 +1,94 @@ +# Copyright (c) 2025 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. +# ====================================================================================================================== + +if (unified_dlog_FOUND) + message(STATUS "Package unified_dlog has been found.") + return() +endif() + +set(_cmake_targets_defined "") +set(_cmake_targets_not_defined "") +set(_cmake_expected_targets "") +foreach(_cmake_expected_target IN ITEMS unified_dlog unified_dlog_headers) + list(APPEND _cmake_expected_targets "${_cmake_expected_target}") + if(TARGET "${_cmake_expected_target}") + list(APPEND _cmake_targets_defined "${_cmake_expected_target}") + else() + list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") + endif() +endforeach() +unset(_cmake_expected_target) + +if(_cmake_targets_defined STREQUAL _cmake_expected_targets) + unset(_cmake_targets_defined) + unset(_cmake_targets_not_defined) + unset(_cmake_expected_targets) + unset(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() + +if(NOT _cmake_targets_defined STREQUAL "") + string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") + string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") +endif() +unset(_cmake_targets_defined) +unset(_cmake_targets_not_defined) +unset(_cmake_expected_targets) + +find_path(_INCLUDE_DIR + NAMES toolchain/dlog_pub.h + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH) + +find_library(unified_dlog_SHARED_LIBRARY + NAMES libunified_dlog.so + PATH_SUFFIXES lib64 + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(unified_dlog + FOUND_VAR + unified_dlog_FOUND + REQUIRED_VARS + _INCLUDE_DIR + unified_dlog_SHARED_LIBRARY +) + +if(unified_dlog_FOUND) + set(unified_dlog_INCLUDE_DIR "${_INCLUDE_DIR}") + include(CMakePrintHelpers) + message(STATUS "Variables in unified_dlog module:") + cmake_print_variables(unified_dlog_INCLUDE_DIR) + cmake_print_variables(unified_dlog_SHARED_LIBRARY) + + add_library(unified_dlog SHARED IMPORTED) + set_target_properties(unified_dlog PROPERTIES + INTERFACE_LINK_LIBRARIES "unified_dlog_headers" + IMPORTED_LOCATION "${unified_dlog_SHARED_LIBRARY}" + ) + + add_library(unified_dlog_headers INTERFACE IMPORTED) + set_target_properties(unified_dlog_headers PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${unified_dlog_INCLUDE_DIR}" + ) + + include(CMakePrintHelpers) + cmake_print_properties(TARGETS unified_dlog + PROPERTIES INTERFACE_LINK_LIBRARIES IMPORTED_LOCATION + ) + cmake_print_properties(TARGETS unified_dlog_headers + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + ) +endif() + +# Cleanup temporary variables. +set(_INCLUDE_DIR) \ No newline at end of file diff --git a/error_manager/CMakeLists.txt b/error_manager/CMakeLists.txt index ff1fb43adfc3eef0fcc599eb740cd92fb19c7427..5ee172535a72020c71d6b7d952697cb357d1f4b0 100644 --- a/error_manager/CMakeLists.txt +++ b/error_manager/CMakeLists.txt @@ -32,7 +32,7 @@ target_link_libraries(error_manager static_mmpa -Wl,--no-as-needed c_sec - slog + unified_dlog -Wl,--as-needed json $<$>:-lrt> @@ -50,7 +50,6 @@ target_clone(error_manager error_manager_static STATIC) target_compile_definitions(error_manager_static PRIVATE $<$:ONLY_COMPILE_OPEN_SRC> - LOG_CPP ) set_target_properties(error_manager_static PROPERTIES @@ -100,7 +99,7 @@ target_link_libraries(stub_error_manager PRIVATE intf_pub c_sec - slog + unified_dlog json PUBLIC metadef_headers diff --git a/error_manager/error_manager.cc b/error_manager/error_manager.cc index 0bd925cf36a5309d663f7fad480445e76717c37a..916e0c07fc35b2c2ac602cebda4dedc5218c95da 100644 --- a/error_manager/error_manager.cc +++ b/error_manager/error_manager.cc @@ -14,7 +14,7 @@ #include #include #include "mmpa/mmpa_api.h" -#include "toolchain/slog.h" +#include "toolchain/dlog_pub.h" #include "graph/def_types.h" #include "base/err_msg.h" #include "common/util/error_manager/error_manager.h" diff --git a/inc/common/ge_common/debug/ge_log.h b/inc/common/ge_common/debug/ge_log.h index 9cd98350f6314de7bbf90545612fc15684fbf788..2a9358f329f1689af65e89a645753e175326938f 100644 --- a/inc/common/ge_common/debug/ge_log.h +++ b/inc/common/ge_common/debug/ge_log.h @@ -17,7 +17,7 @@ #include "common/ge_common/ge_inner_error_codes.h" #include "common/util/error_manager/error_manager.h" #include "base/err_msg.h" -#include "toolchain/slog.h" +#include "toolchain/dlog_pub.h" #ifdef __GNUC__ #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f963318931ceaed24c76e94f8f9c560795cce46c..7c75503dd7553e48659e1d10a51fdd2a429a5571 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -17,6 +17,7 @@ add_subdirectory(depends/mmpa) add_subdirectory(depends/platform) add_subdirectory(depends/runtime) stub_module(slog slog_stub) +stub_module(unified_dlog slog_stub) stub_module(static_mmpa mmpa_stub) stub_module(mmpa mmpa_stub) stub_module(platform platform_stub) diff --git a/tests/depends/slog/src/slog_stub.cc b/tests/depends/slog/src/slog_stub.cc index 540e334daab3b575cacff39f15b490d075bfd0c6..4e6ee13672f36c030451e02f2513f3805adb8d41 100644 --- a/tests/depends/slog/src/slog_stub.cc +++ b/tests/depends/slog/src/slog_stub.cc @@ -8,7 +8,7 @@ * ===================================================================================================================*/ #include "slog_stub.h" -#include "toolchain/slog.h" +#include "toolchain/dlog_pub.h" #include "toolchain/plog.h" #include diff --git a/tests/ut/base/CMakeLists.txt b/tests/ut/base/CMakeLists.txt index 28a175c721ad9448f3946a10ff91d0ee6fd7a4e7..ddd108f7bee2dfc7a38f2d0b4a28cf69a0c9a195 100644 --- a/tests/ut/base/CMakeLists.txt +++ b/tests/ut/base/CMakeLists.txt @@ -45,6 +45,7 @@ target_compile_definitions(ut_metadef PRIVATE target_link_libraries(ut_metadef PRIVATE intf_pub -lgcov -Wl,--no-as-needed + slog slog_headers metadef_headers metadef opp_registry error_manager GTest::gtest GTest::gtest_main ascend_protobuf slog_stub c_sec json mmpa_stub -lrt -ldl diff --git a/tests/ut/register/CMakeLists.txt b/tests/ut/register/CMakeLists.txt index 8b488a8fca19292400b014b5fb9f64a839a0e5f9..48478600808305ff9b584b2c4e617db1cf76e483 100644 --- a/tests/ut/register/CMakeLists.txt +++ b/tests/ut/register/CMakeLists.txt @@ -37,6 +37,7 @@ target_link_libraries(ut_register intf_pub metadef_headers runtime_headers + slog slog_headers msprof_headers metadef exe_graph mmpa diff --git a/tests/ut/sc_check/CMakeLists.txt b/tests/ut/sc_check/CMakeLists.txt index c06f0bf3bd2578246d0fa4f58b65aff49d956afa..c5e3a93ba34196bec89f43257f964a401bce147b 100644 --- a/tests/ut/sc_check/CMakeLists.txt +++ b/tests/ut/sc_check/CMakeLists.txt @@ -31,5 +31,5 @@ target_link_libraries(ut_sc_check PRIVATE -lgcov -Wl,--no-as-needed -lstdc++fs - GTest::gtest GTest::gtest_main slog_stub slog c_sec json mmpa_stub -lrt -ldl + GTest::gtest GTest::gtest_main slog_stub unified_dlog c_sec json mmpa_stub -lrt -ldl )