From d8518455d4aee1631bf193badbea7f0fc6c84cfc Mon Sep 17 00:00:00 2001 From: bear <1248825327@qq.com> Date: Wed, 13 Mar 2024 11:28:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=8C=E6=88=90debug=E5=92=8Crelease?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=AF=91=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a218334..f348302 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,18 @@ set(LIB_STATIC "${SDK_NAME}_static") # 配置编译宏定义 +## release或debug +if(NOT CMAKE_BUILD_TYPE) + message("BUILD TYPE: DEBUG") + message("DEFINATION: \"DEBUG\"") + set(CMAKE_BUILD_TYPE "Debug") + add_definitions(-DDEBUG) +else(NOT CMAKE_BUILD_TYPE) + message("BUILD TYPE: RELEASE") + message("DEFINATION: \"RELEASE\"") + add_definitions(-DRELEASE) +endif(NOT CMAKE_BUILD_TYPE) + ## 平台相关接口 if(WIN32) message("WINDOWS PLATFORM") -- Gitee From e489fe3e62569067cf484ae67b437a37e15e5ee2 Mon Sep 17 00:00:00 2001 From: bear <1248825327@qq.com> Date: Wed, 13 Mar 2024 11:30:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E6=88=90debug=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common_interface.c | 1 + src/internal_common.c | 15 +++++++++++++++ src/internal_common.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/internal_common.c create mode 100644 src/internal_common.h diff --git a/src/common_interface.c b/src/common_interface.c index 3da2995..8a7b903 100644 --- a/src/common_interface.c +++ b/src/common_interface.c @@ -3,6 +3,7 @@ */ #include "common_interface.h" #include "common_errno.h" +#include "internal_common.h" #include #include #include diff --git a/src/internal_common.c b/src/internal_common.c new file mode 100644 index 0000000..f980ab3 --- /dev/null +++ b/src/internal_common.c @@ -0,0 +1,15 @@ +#include +#include + +#include "internal_common.h" + +#ifdef DEBUG + +void _internal_debug(const char *format, ...) { + va_list args; + va_start(args, format); + vprintf(format, args); + va_end(args); +} + +#endif \ No newline at end of file diff --git a/src/internal_common.h b/src/internal_common.h new file mode 100644 index 0000000..f763f88 --- /dev/null +++ b/src/internal_common.h @@ -0,0 +1,34 @@ +/** + * @file internal_common.h + * @author bear + * @brief 内部通用接口 + * @version 0.1 + * @date 2024-03-13 + * + * @copyright Copyright (c) 2024 + * + */ + +#include + +#ifndef INTERNAL_COMMON_H +#define INTERNAL_COMMON_H + +#ifdef DEBUG + +void _internal_debug(const char *format, ...); +#define internal_debug(x, ...) do \ +{ \ + printf("\033[32m%s:%d, function: %s, [debug] ", __FILE__, __LINE__, __FUNCTION__); \ + _internal_debug(x, ##__VA_ARGS__); \ + printf("\033[0m\n"); \ +} while (0); + +#else + +#define internal_debug(x, ...) + +#endif + + +#endif -- Gitee From 42ec0ec7eb0c9076b0bab9979dd955690dee6bee Mon Sep 17 00:00:00 2001 From: bear <1248825327@qq.com> Date: Wed, 13 Mar 2024 11:31:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BC=96=E8=AF=91=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BF=AE=E6=94=B9,=E9=85=8D=E5=90=88CICD?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=97=B6=E9=BB=98=E8=AE=A4=E7=BC=96=E8=AF=91?= =?UTF-8?q?release=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 327dcbc..e334b40 100755 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ echo -e "========================== info end ==========================\n\n" echo -e "=======================cmake build info=======================" cd $root_dir/build -cmake -DUNIT_TEST=1 -DCOMPILE_LIST=true .. +cmake -DUNIT_TEST=1 -DCOMPILE_LIST=true -DCMAKE_BUILD_TYPE=Release .. make echo -e "========================== info end ==========================\n\n" -- Gitee