From 690522256ad24b86f36cb0f28763b6bb95291857 Mon Sep 17 00:00:00 2001 From: fancy <258828110.@qq.com> Date: Fri, 22 Sep 2023 08:51:13 -0700 Subject: [PATCH] Improve build for log. --- application/CMakeLists.txt | 1 + application/MissionManager/CMakeLists.txt | 2 +- application/main/CMakeLists.txt | 57 ++++++++++++++++++ application/main/main.cpp | 24 ++++++++ application/main/src/MainThread.cpp | 65 +++++++++++++++++++++ application/main/src/MainThread.h | 39 +++++++++++++ build/cmake/toolchain/linux.toolchain.cmake | 2 +- build/global_config.cmake | 31 +++++++++- build/sdk_config.cmake | 2 +- middleware/DeviceManager/CMakeLists.txt | 2 +- middleware/IpcConfig/CMakeLists.txt | 2 +- middleware/StateMachine/CMakeLists.txt | 2 +- test/all/CMakeLists.txt | 2 +- test/hal/CMakeLists.txt | 2 +- test/middleware/IpcConfig/CMakeLists.txt | 5 +- test/utils/Config/CMakeLists.txt | 2 +- test/utils/Log/CMakeLists.txt | 2 +- test/utils/LogC/CMakeLists.txt | 2 +- test/utils/ReturnCode/CMakeLists.txt | 2 +- utils/Config/CMakeLists.txt | 4 +- utils/Log/include/ILog.h | 24 ++++++-- utils/Log/src/Log.cpp | 2 +- utils/StatusCode/CMakeLists.txt | 3 +- 23 files changed, 255 insertions(+), 24 deletions(-) create mode 100644 application/main/CMakeLists.txt create mode 100644 application/main/main.cpp create mode 100644 application/main/src/MainThread.cpp create mode 100644 application/main/src/MainThread.h diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index a18ab47..a165827 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory(main) add_subdirectory(MissionManager) \ No newline at end of file diff --git a/application/MissionManager/CMakeLists.txt b/application/MissionManager/CMakeLists.txt index 67c231f..25748eb 100644 --- a/application/MissionManager/CMakeLists.txt +++ b/application/MissionManager/CMakeLists.txt @@ -1,5 +1,5 @@ -include(${CMAKE_SOURCE_DIR}/build/global_config.cmake) +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) diff --git a/application/main/CMakeLists.txt b/application/main/CMakeLists.txt new file mode 100644 index 0000000..e467e6e --- /dev/null +++ b/application/main/CMakeLists.txt @@ -0,0 +1,57 @@ +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) +set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) +set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) + + +set(MAIN_INCLUDE_PATH "${APPLICATION_SOURCE_PATH}/main/src" CACHE STRING INTERNAL FORCE) +set(MAIN_INCLUDE_PATH "${MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/StatusCode/include" CACHE STRING INTERNAL FORCE) +set(MAIN_INCLUDE_PATH "${MAIN_INCLUDE_PATH};${UTILS_SOURCE_PATH}/Log/include" CACHE STRING INTERNAL FORCE) +include_directories(${MAIN_INCLUDE_PATH}) + +link_directories( + ${LIBS_OUTPUT_PATH} +) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +aux_source_directory(./ SRC_FILES) +# aux_source_directory(./src SRC_FILES) + +# Mark src files for test. +file(GLOB_RECURSE MAIN_SRC_FILE_THIS src/*.cpp src/*.c) +set(MAIN_SRC_FILE "${MAIN_SRC_FILE_THIS}" CACHE STRING INTERNAL FORCE) + + +set(TARGET_LIB MainLib) +add_library(${TARGET_LIB} STATIC ${MAIN_SRC_FILE_THIS}) +set(TARGET_NAME ipc_x86) +add_executable(${TARGET_NAME} ${SRC_FILES}) + +set(LINK_LIB StatusCode Log pthread dl) +set(MAIN_LINK_LIB "${LINK_LIB}" CACHE STRING INTERNAL FORCE) +target_link_libraries(${TARGET_LIB} ${MAIN_LINK_LIB}) +target_link_libraries(${TARGET_NAME} ${TARGET_LIB}) +if(${TEST_COVERAGE} MATCHES "true") + target_link_libraries(${TARGET_NAME} gcov) +endif() + +if ("${CLANG_TIDY_SUPPORT}" MATCHES "true") +add_custom_target( + ipc_x86_code_check + COMMAND ${CLANG_TIDY_EXE} + -checks='${CLANG_TIDY_CHECKS}' + --header-filter=.* + --system-headers=false + ${MAIN_SRC_FILE_THIS} + ${CLANG_TIDY_CONFIG} + -p ${CMAKE_SOURCE_DIR_IPCSDK}/cmake-shell + WORKING_DIRECTORY ${APPLICATION_SOURCE_PATH}/main +) +add_custom_command( + TARGET ${TARGET_NAME} + PRE_BUILD + COMMAND make ipc_x86_code_check + WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell/ +) +endif() diff --git a/application/main/main.cpp b/application/main/main.cpp new file mode 100644 index 0000000..b937fac --- /dev/null +++ b/application/main/main.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 Fancy Code. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "MainThread.h" +#include "ILog.h" +#include +int main(int argc, char *argv[]) +{ + MainThread::GetInstance()->Init(); + MainThread::GetInstance()->Runing(); + MainThread::GetInstance()->UnInit(); + return 0; +} \ No newline at end of file diff --git a/application/main/src/MainThread.cpp b/application/main/src/MainThread.cpp new file mode 100644 index 0000000..fbef8c4 --- /dev/null +++ b/application/main/src/MainThread.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023 Fancy Code. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "MainThread.h" +#include "ILog.h" +#include +MainThread::MainThread() +{ + mMainThreadRuning = false; +} +std::shared_ptr &MainThread::GetInstance(std::shared_ptr *impl) +{ + static auto instance = std::make_shared(); + if (impl) + { + if (instance.use_count() == 1) + { + LogInfo("Instance changed succeed.\n"); + instance = *impl; + } + else + { + LogError("Can't changing the instance becase of using by some one.\n"); + } + } + return instance; +} +StatusCode MainThread::Init(void) +{ + mMainThreadRuning = true; + return CreateStatusCode(STATUS_CODE_OK); +} +StatusCode MainThread::UnInit(void) +{ + DestoryAllModules(); + return CreateStatusCode(STATUS_CODE_OK); +} +StatusCode MainThread::CreateAllModules(void) +{ + return CreateStatusCode(STATUS_CODE_OK); +} +void MainThread::DestoryAllModules(void) +{ +} +void MainThread::ResetAllPtrMaker(void) +{ +} +void MainThread::Runing(void) +{ + while (mMainThreadRuning) + { + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + } +} \ No newline at end of file diff --git a/application/main/src/MainThread.h b/application/main/src/MainThread.h new file mode 100644 index 0000000..4ced64c --- /dev/null +++ b/application/main/src/MainThread.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Fancy Code. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MAIN_THREAD_H +#define MAIN_THREAD_H +#include "StatusCode.h" +#include +class MainThread +{ +public: + MainThread(); + virtual ~MainThread() = default; + static std::shared_ptr &GetInstance(std::shared_ptr *impl = nullptr); + virtual StatusCode Init(void); + virtual StatusCode UnInit(void); + void Runing(void); + void Exit(void) { mMainThreadRuning = false; } + virtual void CustomizationInit(void) {} + +private: + StatusCode CreateAllModules(void); + void DestoryAllModules(void); + void ResetAllPtrMaker(void); + +private: + bool mMainThreadRuning; +}; +#endif // !MAIN_THREAD_H \ No newline at end of file diff --git a/build/cmake/toolchain/linux.toolchain.cmake b/build/cmake/toolchain/linux.toolchain.cmake index 3e7d57c..4a22fb5 100755 --- a/build/cmake/toolchain/linux.toolchain.cmake +++ b/build/cmake/toolchain/linux.toolchain.cmake @@ -32,7 +32,7 @@ set(TOOLCHAIN_NAME arm-linux-gnueabihf) set(TARGET_PLATFORM "linux") set(SUBMODULE_PATH_OF_IPCSDK "") set(PLATFORM_PATH "${CMAKE_CURRENT_SOURCE_DIR}") -set(COVERAGE_ON "true") +set(TEST_COVERAGE "true") # ------------ build curl + openssl ------------ start set(CURL_OPENSSL_LIB_SHARED_ENABLE "false") diff --git a/build/global_config.cmake b/build/global_config.cmake index 37c4c84..ccd18c8 100755 --- a/build/global_config.cmake +++ b/build/global_config.cmake @@ -13,6 +13,7 @@ set(HAL_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/hal") set(TEST_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/test") set(EXTERNAL_SOURCE_PATH "${CMAKE_SOURCE_DIR_IPCSDK}/external") +# -------------------------- clang-tidy tools -------------------------- # set(CLANG_TIDY_CHECKS "-*,\ llvm-else-after-return,\ -llvm-include-order,\ @@ -43,4 +44,32 @@ readability-identifier-naming") set(CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS},-clang-diagnostic-error") set(CLANG_TIDY_CONFIG "-header-filter=\'.*\'") -set(CLANG_TIDY_CONFIG "${CLANG_TIDY_CONFIG} -p ${CMAKE_SOURCE_DIR_IPCSDK}/cmake-shell") \ No newline at end of file +set(CLANG_TIDY_CONFIG "${CLANG_TIDY_CONFIG} -p ${CMAKE_SOURCE_DIR_IPCSDK}/cmake-shell") +# -------------------------- clang-tidy tools end -------------------------- # + +# -------------------------- log setting -------------------------- # +function(define_file_name target) + get_target_property(source_files "${target}" SOURCES) + foreach(source_file ${source_files}) + get_property(defs SOURCE "${source_file}" + PROPERTY COMPILE_DEFINITIONS) + get_filename_component(file_name "${source_file}" NAME) + list(APPEND defs "__F_FILE__=\"${file_name}\"") + set_property( + SOURCE "${source_file}" + PROPERTY COMPILE_DEFINITIONS ${defs}) + endforeach() +endfunction() +function(log_disable target) + get_target_property(source_files "${target}" SOURCES) + foreach(source_file ${source_files}) + get_property(defs SOURCE "${source_file}" + PROPERTY COMPILE_DEFINITIONS) + get_filename_component(file_name "${source_file}" NAME) + list(APPEND defs "LOG_DISABLE") + set_property( + SOURCE "${source_file}" + PROPERTY COMPILE_DEFINITIONS ${defs}) + endforeach() +endfunction() +# -------------------------- log setting end -------------------------- # \ No newline at end of file diff --git a/build/sdk_config.cmake b/build/sdk_config.cmake index f0268b3..97fda6f 100755 --- a/build/sdk_config.cmake +++ b/build/sdk_config.cmake @@ -15,7 +15,7 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os") endif() -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") message("you choose to build gcno file") add_definitions("-fprofile-arcs") add_definitions("-ftest-coverage") diff --git a/middleware/DeviceManager/CMakeLists.txt b/middleware/DeviceManager/CMakeLists.txt index ba8dbb0..82d8e8b 100644 --- a/middleware/DeviceManager/CMakeLists.txt +++ b/middleware/DeviceManager/CMakeLists.txt @@ -1,5 +1,5 @@ -include(${CMAKE_SOURCE_DIR}/build/global_config.cmake) +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) diff --git a/middleware/IpcConfig/CMakeLists.txt b/middleware/IpcConfig/CMakeLists.txt index 7acd452..b4af528 100644 --- a/middleware/IpcConfig/CMakeLists.txt +++ b/middleware/IpcConfig/CMakeLists.txt @@ -1,5 +1,5 @@ -include(${CMAKE_SOURCE_DIR}/build/global_config.cmake) +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) diff --git a/middleware/StateMachine/CMakeLists.txt b/middleware/StateMachine/CMakeLists.txt index 425150c..d37241f 100644 --- a/middleware/StateMachine/CMakeLists.txt +++ b/middleware/StateMachine/CMakeLists.txt @@ -1,5 +1,5 @@ -include(${CMAKE_SOURCE_DIR}/build/global_config.cmake) +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) diff --git a/test/all/CMakeLists.txt b/test/all/CMakeLists.txt index 87f423a..63cabff 100644 --- a/test/all/CMakeLists.txt +++ b/test/all/CMakeLists.txt @@ -30,6 +30,6 @@ aux_source_directory(${TEST_SOURCE_PATH}/middleware/IpcConfig/src SRC_FILES) set(TARGET_NAME AllTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() \ No newline at end of file diff --git a/test/hal/CMakeLists.txt b/test/hal/CMakeLists.txt index b8f09bd..0a53359 100644 --- a/test/hal/CMakeLists.txt +++ b/test/hal/CMakeLists.txt @@ -27,6 +27,6 @@ aux_source_directory(./src SRC_FILES) set(TARGET_NAME IHalTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} gtest gmock pthread Hal) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() \ No newline at end of file diff --git a/test/middleware/IpcConfig/CMakeLists.txt b/test/middleware/IpcConfig/CMakeLists.txt index f2e587e..ad9d940 100644 --- a/test/middleware/IpcConfig/CMakeLists.txt +++ b/test/middleware/IpcConfig/CMakeLists.txt @@ -31,7 +31,7 @@ aux_source_directory(./src SRC_FILES) set(TARGET_NAME IpcConfigTest) add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() if ("${CLANG_TIDY_SUPPORT}" MATCHES "true") @@ -54,4 +54,5 @@ add_custom_command( COMMAND make IpcConfigTest_code_check WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell/ ) -endif() \ No newline at end of file +endif() +define_file_name(${TARGET_NAME}) \ No newline at end of file diff --git a/test/utils/Config/CMakeLists.txt b/test/utils/Config/CMakeLists.txt index 815b1d8..dedb677 100644 --- a/test/utils/Config/CMakeLists.txt +++ b/test/utils/Config/CMakeLists.txt @@ -32,7 +32,7 @@ aux_source_directory(./src SRC_FILES) set(TARGET_NAME ConfigTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} Config gtest gmock pthread) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() if ("${CLANG_TIDY_SUPPORT}" MATCHES "true") diff --git a/test/utils/Log/CMakeLists.txt b/test/utils/Log/CMakeLists.txt index b1e6d2b..bc1b402 100644 --- a/test/utils/Log/CMakeLists.txt +++ b/test/utils/Log/CMakeLists.txt @@ -29,7 +29,7 @@ aux_source_directory(./src SRC_FILES) set(TARGET_NAME LogTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} Log gtest gmock pthread) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() if ("${CLANG_TIDY_SUPPORT}" MATCHES "true") diff --git a/test/utils/LogC/CMakeLists.txt b/test/utils/LogC/CMakeLists.txt index 8d0b328..2b82d2b 100644 --- a/test/utils/LogC/CMakeLists.txt +++ b/test/utils/LogC/CMakeLists.txt @@ -29,6 +29,6 @@ set(TARGET_NAME LogCTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} gtest gmock pthread ReturnCode LogCAbstract) # target_link_libraries(${TARGET_NAME} gtest gmock pthread ReturnCode LogCAbstract LogCUb) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() \ No newline at end of file diff --git a/test/utils/ReturnCode/CMakeLists.txt b/test/utils/ReturnCode/CMakeLists.txt index 88a8cb0..8cd9594 100644 --- a/test/utils/ReturnCode/CMakeLists.txt +++ b/test/utils/ReturnCode/CMakeLists.txt @@ -27,6 +27,6 @@ aux_source_directory(./src SRC_FILES) set(TARGET_NAME ReturnCodeTest) add_executable(${TARGET_NAME} ${SRC_FILES}) target_link_libraries(${TARGET_NAME} gtest gmock pthread Log) -if(${COVERAGE_ON} MATCHES "true") +if(${TEST_COVERAGE} MATCHES "true") target_link_libraries(${TARGET_NAME} gcov) endif() \ No newline at end of file diff --git a/utils/Config/CMakeLists.txt b/utils/Config/CMakeLists.txt index 0c8b7c6..64adf7f 100644 --- a/utils/Config/CMakeLists.txt +++ b/utils/Config/CMakeLists.txt @@ -60,4 +60,6 @@ add_custom_command( PRE_BUILD COMMAND make compile_libconfig WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell -) \ No newline at end of file +) + +define_file_name(${TARGET_NAME}) \ No newline at end of file diff --git a/utils/Log/include/ILog.h b/utils/Log/include/ILog.h index 7995b16..239e5cc 100644 --- a/utils/Log/include/ILog.h +++ b/utils/Log/include/ILog.h @@ -26,12 +26,24 @@ extern "C" LOG_EASYLOGGING, // for easylogging++. LOG_INSTANCE_TYPE_END }; -#define LogVerbose(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_VERBOSE, __VA_ARGS__) -#define LogDebug(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_DEBUG, __VA_ARGS__) -#define LogInfo(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_INFORMATION, __VA_ARGS__) -#define LogWarning(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_WARNING, __VA_ARGS__) -#define LogError(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_ERROR, __VA_ARGS__) -#define LogTrace(...) GetLogIntance()->printf(GetLogIntance(), __FUNCTION__, __LINE__, LOG_TYPE_TRACE, __VA_ARGS__) +#ifndef __F_FILE__ +#define __F_FILE__ "fancy" +#endif +#ifndef LOG_DISABLE +#define LogVerbose(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_VERBOSE, __VA_ARGS__) +#define LogDebug(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_DEBUG, __VA_ARGS__) +#define LogInfo(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_INFORMATION, __VA_ARGS__) +#define LogWarning(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_WARNING, __VA_ARGS__) +#define LogError(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_ERROR, __VA_ARGS__) +#define LogTrace(...) GetLogIntance()->printf(GetLogIntance(), __F_FILE__, __LINE__, LOG_TYPE_TRACE, __VA_ARGS__) +#else +#define LogVerbose(...) +#define LogDebug(...) +#define LogInfo(...) +#define LogWarning(...) +#define LogError(...) +#define LogTrace(...) +#endif #if 1 // For OpenHarmony log, should delete finally.// TODO: #define LOGD(...) #define LOGI(...) diff --git a/utils/Log/src/Log.cpp b/utils/Log/src/Log.cpp index b080378..55d2c83 100644 --- a/utils/Log/src/Log.cpp +++ b/utils/Log/src/Log.cpp @@ -19,7 +19,7 @@ static int LogPrintf(ILog *object, const char *function, const int line, const e // LogTypeToString(type); constexpr int SEND_TRACE_BUFF_SIZE = 2048; char buff[SEND_TRACE_BUFF_SIZE] = {0}; - snprintf(buff, SEND_TRACE_BUFF_SIZE, "[%s][line:%d]:", function, line); + snprintf(buff, SEND_TRACE_BUFF_SIZE, "[%s:%d]:", function, line); // ILog::GetInstance()->Log(buff); const int headLen = strlen(buff); va_list vargs; diff --git a/utils/StatusCode/CMakeLists.txt b/utils/StatusCode/CMakeLists.txt index c3f45fd..7dca222 100644 --- a/utils/StatusCode/CMakeLists.txt +++ b/utils/StatusCode/CMakeLists.txt @@ -40,4 +40,5 @@ add_custom_command( COMMAND make StatusCode_code_check WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell/ ) -endif() \ No newline at end of file +endif() +define_file_name(${TARGET_NAME}) \ No newline at end of file