diff --git a/yonglin_zhang/C/dep/CMakeLists.txt b/yonglin_zhang/C/dep/CMakeLists.txt index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..77efc20f6bcfe9208bfc5433451dba02f76437ec 100644 --- a/yonglin_zhang/C/dep/CMakeLists.txt +++ b/yonglin_zhang/C/dep/CMakeLists.txt @@ -0,0 +1 @@ +add_library(alg_debg SHARED alg_debug.c) \ No newline at end of file diff --git a/yonglin_zhang/C/dep/alg_debug.c b/yonglin_zhang/C/dep/alg_debug.c new file mode 100644 index 0000000000000000000000000000000000000000..4c19d137ffdae278d103f12c9fad820a735abc2e --- /dev/null +++ b/yonglin_zhang/C/dep/alg_debug.c @@ -0,0 +1,22 @@ +#include +#include +#include "alg_debug.h" + +static char debug_path[256] = { 0 }; + +void set_debug_info_path(char *path) +{ + memcpy(debug_path, path, strlen(path)); +} + +void debug_infpo(char *info) +{ + FILE *debug = NULL; + char filename[270] = { 0 }; + + sprintf(filename, "%s/debug.txt", debug_path); + + debug = fopen(filename, "a"); + fprintf(debug, "%s", info); + fclose(debug); +} \ No newline at end of file diff --git a/yonglin_zhang/C/dep/alg_debug.h b/yonglin_zhang/C/dep/alg_debug.h new file mode 100644 index 0000000000000000000000000000000000000000..1be7e78f3d6e6cf8b72847b4f649389da4f83d8b --- /dev/null +++ b/yonglin_zhang/C/dep/alg_debug.h @@ -0,0 +1,28 @@ +/** + * \file alg_debug.h + * + * \brief debug信息功能 + */ + +#ifndef ALG_DEBUG_H +#define ALG_DEBUG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef DEBUG +#define ALG_DEBUG(X) debug_info(X) +#else +#define ALG_DEBUG(X) +#endif + +void set_debug_info_path(char *path); + +void debug_info(char *info); + +#ifdef __cplusplus +} +#endif + +#endif /* ALG_DEBUG_H */ diff --git a/yonglin_zhang/C/link_list/src/CMakeLists.txt b/yonglin_zhang/C/link_list/src/CMakeLists.txt index 018b8dc1c04cade6c15057588b70f3f6d8f7cfbf..3a44a5141cd63b3619681043de6f0949a42bf29f 100644 --- a/yonglin_zhang/C/link_list/src/CMakeLists.txt +++ b/yonglin_zhang/C/link_list/src/CMakeLists.txt @@ -10,7 +10,16 @@ set(INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../include" "${CMAKE_CURRENT_SOURCE_DIR}/../../dep" ) +#[[ +set(DEP_LIB_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/../../dep" +) +set(DEP_LIBS + alg_debug +) +#]] include_directories(${INCLUDE_DIRS}) +#link_directories(${DEP_LIBS}) add_library(link_list SHARED ${LIB_SOURCES})