From: Joonbum Ko Date: Tue, 24 Aug 2021 03:23:08 +0000 (+0900) Subject: Exclude dlog dependency when dlog disabled. X-Git-Tag: submit/tizen/20220218.025831~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db770f877433d55305929d277ef1180a9ee57e21;p=platform%2Fhal%2Fapi%2Ftdm.git Exclude dlog dependency when dlog disabled. Change-Id: I725f9eca80f65cf0016f971259168851e88945a2 Signed-off-by: Joonbum Ko --- diff --git a/CMakeLists.txt b/CMakeLists.txt index be4abf3..fdcda79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,11 +17,21 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -SET(PKG_MODULES - hal-api-common - dlog - libtbm -) +if (${DEFAULT_LOG_DLOG}) + SET(PKG_MODULES + hal-api-common + dlog + libtbm + ) + ADD_DEFINITIONS("-DENABLE_DLOG=1") +else() + SET(PKG_MODULES + hal-api-common + libtbm + ) + ADD_DEFINITIONS("-DENABLE_DLOG=0") +endif() + INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED ${PKG_MODULES}) @@ -37,11 +47,6 @@ SET(CMAKE_EXE_LINKER_FLAGS "-pie") ADD_DEFINITIONS("-DLOG_TAG=\"HALAPI_TDM\"") -if (${DEFAULT_LOG_DLOG}) - ADD_DEFINITIONS("-DENABLE_DLOG=1") -else() - ADD_DEFINITIONS("-DENABLE_DLOG=0") -endif() SET(SRCS src/hal-api-tdm.c diff --git a/src/common.h b/src/common.h index 35daf13..9e84730 100644 --- a/src/common.h +++ b/src/common.h @@ -37,7 +37,9 @@ #include #include +#if ENABLE_DLOG #include +#endif /* log level */ void hal_tdm_log_print(int level, const char *fmt, ...); diff --git a/src/hal-api-tdm.c b/src/hal-api-tdm.c index 728a337..3ecc1ce 100644 --- a/src/hal-api-tdm.c +++ b/src/hal-api-tdm.c @@ -36,8 +36,9 @@ #include #include #include +#if ENABLE_DLOG #include - +#endif #include #include "hal-tdm.h" #include "hal-tdm-interface.h" diff --git a/src/hal-tdm-log.c b/src/hal-tdm-log.c index 54729cc..d2d1f47 100644 --- a/src/hal-tdm-log.c +++ b/src/hal-tdm-log.c @@ -1,5 +1,4 @@ #include -#include #include "hal-tdm-types.h" #include "common.h" @@ -11,8 +10,10 @@ #define COLOR_RESET "\x1b[0m" #if ENABLE_DLOG +#include static unsigned int dlog_enable = 1; #else +#include static unsigned int dlog_enable = 0; #endif static unsigned int color_enable = 1; @@ -39,6 +40,7 @@ _tdm_log_vprint_stdout(int level, const char *fmt, va_list arg) printf("\n"); } +#if ENABLE_DLOG static void _tdm_log_dlog_print(int level, const char *fmt, va_list arg) { @@ -62,6 +64,7 @@ _tdm_log_dlog_print(int level, const char *fmt, va_list arg) } __dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmt, arg); } +#endif void hal_tdm_log_print(int level, const char *fmt, ...) @@ -71,11 +74,15 @@ hal_tdm_log_print(int level, const char *fmt, ...) if (level > tdm_log_debug_level) return; +#if ENABLE_DLOG if (dlog_enable) { va_start(arg, fmt); _tdm_log_dlog_print(level, fmt, arg); va_end(arg); - } else { + } + else +#endif + { va_start(arg, fmt); _tdm_log_vprint_stdout(level, fmt, arg); va_end(arg);