From e83033409669e2befa36714eced67f0640993d00 Mon Sep 17 00:00:00 2001 From: Fancy code <258828110.@qq.com> Date: Thu, 25 Apr 2024 11:40:16 +0800 Subject: [PATCH] Backup. --- CMakeLists.txt | 16 ++++- application/MissionManager/src/AppMonitor.cpp | 1 + external/openssl/build_openssl.sh | 2 +- middleware/CMakeLists.txt | 3 +- middleware/StorageManager/CMakeLists.txt | 64 +++++++++++++++++++ .../StorageManager/include/IStorageManager.h | 18 ++++++ .../StorageManager/src/IStorageManager.cpp | 15 +++++ 7 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 middleware/StorageManager/CMakeLists.txt create mode 100644 middleware/StorageManager/include/IStorageManager.h create mode 100644 middleware/StorageManager/src/IStorageManager.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f54d44..96cb97b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,13 @@ endif() # 添加编译目录 add_subdirectory(external) -add_subdirectory(application) +# 检查子目录 application 是否存在,存在再添加 +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + message(STATUS "application exists, add application to project.") + add_subdirectory(application) +else() + message(STATUS "application not exists.") +endif() add_subdirectory(middleware) add_subdirectory(utils) add_subdirectory(hal) @@ -181,6 +187,12 @@ endif() message("MAIN_INCLUDE_PATH = ${MAIN_INCLUDE_PATH}") message("MAIN_SRC_FILE = ${MAIN_SRC_FILE}") message("MAIN_LINK_LIB = ${MAIN_LINK_LIB}") -add_subdirectory(test) +# 检查子目录 test 是否存在,存在再添加 +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + message(STATUS "test exists, add test to project.") + add_subdirectory(test) +else() + message(STATUS "test not exists.") +endif() # include(build/global_config.cmake) \ No newline at end of file diff --git a/application/MissionManager/src/AppMonitor.cpp b/application/MissionManager/src/AppMonitor.cpp index 9ede473..a36b49a 100644 --- a/application/MissionManager/src/AppMonitor.cpp +++ b/application/MissionManager/src/AppMonitor.cpp @@ -14,6 +14,7 @@ */ #include "AppMonitor.h" #include "ILog.h" +#include StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m) { LogInfo("AppMonitor::GetProductInfo.\n"); diff --git a/external/openssl/build_openssl.sh b/external/openssl/build_openssl.sh index cbdfb84..e5049b1 100755 --- a/external/openssl/build_openssl.sh +++ b/external/openssl/build_openssl.sh @@ -2,7 +2,7 @@ #编译curl库 platform=$1 CMAKE_SOURCE_DIR=$2 -echo "Compile curl, platform = $platform, cmake source dir = $CMAKE_SOURCE_DIR." +echo "Compile openssl, platform = $platform, cmake source dir = $CMAKE_SOURCE_DIR." export ROOT_PATH=$PWD # if [ ! -d "./openssl-3.1.0" ];then diff --git a/middleware/CMakeLists.txt b/middleware/CMakeLists.txt index b8baeee..ddf905a 100644 --- a/middleware/CMakeLists.txt +++ b/middleware/CMakeLists.txt @@ -4,4 +4,5 @@ add_subdirectory(DeviceManager) add_subdirectory(McuManager) add_subdirectory(McuAskBase) add_subdirectory(MediaManager) -add_subdirectory(AppManager) \ No newline at end of file +add_subdirectory(AppManager) +add_subdirectory(StorageManager) \ No newline at end of file diff --git a/middleware/StorageManager/CMakeLists.txt b/middleware/StorageManager/CMakeLists.txt new file mode 100644 index 0000000..6ea9cc1 --- /dev/null +++ b/middleware/StorageManager/CMakeLists.txt @@ -0,0 +1,64 @@ + +include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) +set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) +set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) + +include_directories( + ./src + ./include + ${MIDDLEWARE_SOURCE_PATH}/McuAskBase/include + ${UTILS_SOURCE_PATH}/StatusCode/include + ${UTILS_SOURCE_PATH}/Log/include + ${UTILS_SOURCE_PATH}/McuProtocol/include + ${UTILS_SOURCE_PATH}/UartDevice/include +) +#do not rely on any other library +#link_directories( +#) + +aux_source_directory(./src SRC_FILES) + +set(TARGET_NAME StorageManager) +add_library(${TARGET_NAME} STATIC ${SRC_FILES}) + +target_link_libraries(${TARGET_NAME} StatusCode Log) + +if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true") +add_custom_target( + StorageManager_code_check + COMMAND ${CLANG_TIDY_EXE} + -checks='${CLANG_TIDY_CHECKS}' + --header-filter=.* + --system-headers=false + ${SRC_FILES} + ${CLANG_TIDY_CONFIG} + -p ${PLATFORM_PATH}/cmake-shell + WORKING_DIRECTORY ${MIDDLEWARE_SOURCE_PATH}/StorageManager +) +add_custom_command( + TARGET ${TARGET_NAME} + PRE_BUILD + COMMAND make StorageManager_code_check + WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/ +) +file(GLOB_RECURSE HEADER_FILES *.h) +add_custom_target( + StorageManager_code_format + COMMAND ${CLANG_FORMAT_EXE} + -style=file + -i ${SRC_FILES} ${HEADER_FILES} + WORKING_DIRECTORY ${MIDDLEWARE_SOURCE_PATH}/StorageManager +) +add_custom_command( + TARGET ${TARGET_NAME} + PRE_BUILD + COMMAND make StorageManager_code_check + COMMAND make StorageManager_code_format + WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/ +) +endif() + +define_file_name(${TARGET_NAME}) + +file(GLOB_RECURSE INSTALL_HEADER_FILES include/*.h) +install(FILES ${INSTALL_HEADER_FILES} DESTINATION include) \ No newline at end of file diff --git a/middleware/StorageManager/include/IStorageManager.h b/middleware/StorageManager/include/IStorageManager.h new file mode 100644 index 0000000..e188e5e --- /dev/null +++ b/middleware/StorageManager/include/IStorageManager.h @@ -0,0 +1,18 @@ +/* + * 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 I_STORAGE_MANAGER_H +#define I_STORAGE_MANAGER_H + +#endif \ No newline at end of file diff --git a/middleware/StorageManager/src/IStorageManager.cpp b/middleware/StorageManager/src/IStorageManager.cpp new file mode 100644 index 0000000..bdfbe0d --- /dev/null +++ b/middleware/StorageManager/src/IStorageManager.cpp @@ -0,0 +1,15 @@ +/* + * 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 "IStorageManager.h" \ No newline at end of file