From 346d9ec245102153271199c7dd5ee77c48b5209f Mon Sep 17 00:00:00 2001 From: huangxin Date: Wed, 14 Dec 2022 10:16:10 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E5=A2=9E=E5=8A=A0=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 +++- prj_config.h.in | 14 ++++++++++++++ srcs/CMakeLists.txt | 1 + srcs/libs/CMakeLists.txt | 16 ++++++++++++---- srcs/libs/database/sqlite3/sqlite3.c | 4 ++-- srcs/libs/init/init.c | 5 ++++- srcs/libs/lib_config.h.in | 14 ++++++++++++++ srcs/vcpe_main.c | 5 +++++ 8 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 prj_config.h.in create mode 100644 srcs/libs/lib_config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 67ee139..2fc4fc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR) -PROJECT(vCPE_project) +PROJECT(vCPE VERSION "1.0.0") + +CONFIGURE_FILE(prj_config.h.in prj_config.h) OPTION(VCPE_AGENT "Enable vCPE agent test application" OFF) OPTION(USED_LWIP "PPPoE of LWIP support for vCPE" OFF) diff --git a/prj_config.h.in b/prj_config.h.in new file mode 100644 index 0000000..138a1a6 --- /dev/null +++ b/prj_config.h.in @@ -0,0 +1,14 @@ +// +// Created by xajhuang on 2022/12/14. +// + +#ifndef VCPE_PRG_CONFIG_H_IN +#define VCPE_PRG_CONFIG_H_IN + +#define VCPE_PROJECT_NAME "@PROJECT_NAME@" +#define VCPE_PROJECT_VER "@PROJECT_VERSION@" +#define VCPE_PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@" +#define VCPE_PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@" +#define VCPE_PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@" + +#endif //VCPE_PRG_CONFIG_H_IN diff --git a/srcs/CMakeLists.txt b/srcs/CMakeLists.txt index bcec5ee..957a782 100644 --- a/srcs/CMakeLists.txt +++ b/srcs/CMakeLists.txt @@ -57,6 +57,7 @@ ENDIF () TARGET_LINK_LIBRARIES(${PROJECT_TARGET} common) TARGET_LINK_LIBRARIES(${PROJECT_TARGET} ${COMMON_LIBS}) +TARGET_INCLUDE_DIRECTORIES(${PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/../) IF (VCPE_AGENT) TARGET_LINK_LIBRARIES(${PROJECT_TARGET_AGENT} common ${COMMON_LIBS}) diff --git a/srcs/libs/CMakeLists.txt b/srcs/libs/CMakeLists.txt index c62635d..07e5c3a 100644 --- a/srcs/libs/CMakeLists.txt +++ b/srcs/libs/CMakeLists.txt @@ -1,11 +1,14 @@ SET(LIB_PROJECT_TARGET common) -PROJECT(${LIB_PROJECT_TARGET}) +PROJECT(${LIB_PROJECT_TARGET} VERSION 1.1.0) + +CONFIGURE_FILE(lib_config.h.in lib_config.h) INCLUDE_DIRECTORIES(include ./ ./include ../lwip/src/include ../lwip/src/arch_linux/include ../include - ../httpserver/include ../httpserver/src/haywire ../httpserver/src/haywire/configuration) -FILE(GLOB C_HEADS include/*.h include/uthash/*.h include/s2j/*.h vector/*.h) + ../httpserver/include ../httpserver/src/haywire ../httpserver/src/haywire/configuration + ${PROJECT_BINARY_DIR}/srcs/libs) +FILE(GLOB C_HEADS include/*.h include/uthash/*.h include/s2j/*.h vector/*.h ${PROJECT_BINARY_DIR}/srcs/libs/*.h) AUX_SOURCE_DIRECTORY(json C_SRC) @@ -54,4 +57,9 @@ LINK_LIBRARIES(${COMMON_LIBS}) ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS}) TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} haywire) -TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd) \ No newline at end of file +TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd) + +#TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC "${PROJECT_BINARY_DIR}/srcs/libs") +TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/) + +MESSAGE(+++++++++++++++++++${PROJECT_BINARY_DIR}) \ No newline at end of file diff --git a/srcs/libs/database/sqlite3/sqlite3.c b/srcs/libs/database/sqlite3/sqlite3.c index 8fa6729..6ffe69d 100644 --- a/srcs/libs/database/sqlite3/sqlite3.c +++ b/srcs/libs/database/sqlite3/sqlite3.c @@ -13210,7 +13210,7 @@ struct fts5_api { ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" +#include "./config.h" #define SQLITECONFIG_H 1 #endif @@ -21062,7 +21062,7 @@ SQLITE_API extern int sqlite3_open_file_count; ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -/* #include "config.h" */ +/* #include "./config.h" */ #define SQLITECONFIG_H 1 #endif diff --git a/srcs/libs/init/init.c b/srcs/libs/init/init.c index f55c6e1..88480ab 100644 --- a/srcs/libs/init/init.c +++ b/srcs/libs/init/init.c @@ -18,6 +18,7 @@ #include "msg_queue.h" #include "http_svr.h" #include "haywire.h" +#include "lib_config.h" #define DEFAULT_CONFIG_FILE ("vcpe.cfg") #define DEFAULT_CONFIG_DIR ("config") @@ -93,7 +94,9 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK return -ERR_CONFIG_INIT; } - dzlog_info("Application information: %s (Build: %s %s GCC Ver:%s) With %lu(bits) OS\n", + dzlog_info("%s library version %s information: %s (Build: %s %s GCC Ver:%s) With %lu(bits) OS\n", + VCPE_LIB_NAME, + VCPE_LIB_VER, BUILD_VERSION, __DATE__, __TIME__, diff --git a/srcs/libs/lib_config.h.in b/srcs/libs/lib_config.h.in new file mode 100644 index 0000000..cb7b510 --- /dev/null +++ b/srcs/libs/lib_config.h.in @@ -0,0 +1,14 @@ +// +// Created by xajhuang on 2022/12/14. +// + +#ifndef VCPE_LIB_CONFIG_H_IN +#define VCPE_LIB_CONFIG_H_IN + +#define VCPE_LIB_NAME "@PROJECT_NAME@" +#define VCPE_LIB_VER "@PROJECT_VERSION@" +#define VCPE_LIB_VER_MAJOR "@PROJECT_VERSION_MAJOR@" +#define VCPE_LIB_VER_MINOR "@PROJECT_VERSION_MINOR@" +#define VCPE_LIB_VER_PATCH "@PROJECT_VERSION_PATCH@" + +#endif //VCPE_LIB_CONFIG_H_IN diff --git a/srcs/vcpe_main.c b/srcs/vcpe_main.c index fe798a0..be1e6fc 100644 --- a/srcs/vcpe_main.c +++ b/srcs/vcpe_main.c @@ -8,6 +8,9 @@ #include "cmdline.h" #include "task_manager.h" #include "init.h" + +#include "prj_config.h" + #if LWIP_ON #include "user_info.h" #include "lwip/tcpip.h" @@ -63,6 +66,8 @@ int main(int argc, char **argv) { #else uv_setup_args(argc, argv); + printf("Application %s version %s\n", VCPE_PROJECT_NAME, VCPE_PROJECT_VER); + setvbuf(stdout, NULL, _IONBF, 0); ret = menu_run(argc, argv);