parent
85deb1ae4a
commit
c7c4975983
|
@ -1,8 +1,7 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
PROJECT(vCPE VERSION "1.0.0")
|
||||
|
||||
CONFIGURE_FILE(prj_config.h.in prj_config.h)
|
||||
SET(VCPE_VERSION "1.0.0")
|
||||
PROJECT(vCPE VERSION "${VCPE_VERSION}")
|
||||
|
||||
OPTION(VCPE_AGENT "Enable vCPE agent test application" OFF)
|
||||
OPTION(USED_LWIP "PPPoE of LWIP support for vCPE" OFF)
|
||||
|
@ -17,18 +16,54 @@ OPTION(USED_SQLITE "Add sqlite3 database support for vCPE" OFF)
|
|||
SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
|
||||
SET(URI_HOME "${CMAKE_SOURCE_DIR}/libs")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND git describe --tags --always --dirty=-dev
|
||||
OUTPUT_VARIABLE GIT_TAG)
|
||||
SET(VERSION_GIT_TAG "")
|
||||
SET(VERSION_GIT_HASH "")
|
||||
SET(VERSION_GIT_HASH_SHORT "")
|
||||
SET(VERSION_GIT_BRANCH "")
|
||||
|
||||
FIND_PACKAGE(Git QUIET)
|
||||
IF (GIT_FOUND)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
OUTPUT_VARIABLE VERSION_GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
|
||||
OUTPUT_VARIABLE VERSION_GIT_HASH_SHORT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} symbolic-ref --short -q HEAD
|
||||
OUTPUT_VARIABLE VERSION_GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty=-dev
|
||||
OUTPUT_VARIABLE GIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
IF ("${GIT_TAG}" STREQUAL "")
|
||||
STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S)
|
||||
SET(GIT_VERSION ${COMPILE_TIME})
|
||||
SET(VERSION_GIT_TAG ${COMPILE_TIME})
|
||||
ELSE ()
|
||||
STRING(REGEX REPLACE "\n$" "" GIT_TAG ${GIT_TAG})
|
||||
SET(GIT_VERSION ${GIT_TAG})
|
||||
SET(VERSION_GIT_TAG ${GIT_TAG})
|
||||
ENDIF ()
|
||||
|
||||
MESSAGE("Version: " ${GIT_VERSION})
|
||||
CONFIGURE_FILE(prj_config.h.in prj_config.h)
|
||||
|
||||
MESSAGE("Version: " ${VERSION_GIT_TAG})
|
||||
|
||||
IF (USED_LWIP)
|
||||
LIST(APPEND COMMON_DEFINE "-DLWIP_ON")
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#ifndef VCPE_PRG_CONFIG_H_IN
|
||||
#define VCPE_PRG_CONFIG_H_IN
|
||||
|
||||
#define VCPE_GIT_VERSION "@VERSION_GIT_TAG@"
|
||||
#define VCPE_GIT_HASH "@VERSION_GIT_HASH@"
|
||||
#define VCPE_GIT_HASH_SHORT "@VERSION_GIT_HASH_SHORT@"
|
||||
#define VCPE_GIT_BRANCH "@VERSION_GIT_BRANCH@"
|
||||
#define VCPE_PROJECT_NAME "@PROJECT_NAME@"
|
||||
#define VCPE_PROJECT_VER "@PROJECT_VERSION@"
|
||||
#define VCPE_PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
||||
|
|
|
@ -69,13 +69,19 @@ ENDIF ()
|
|||
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_TARGET}
|
||||
POST_BUILD
|
||||
COMMENT "!!!!!! Notice: Automatic upgreade configuration files after build project."
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
make_directory "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
make_directory "${CMAKE_CURRENT_BINARY_DIR}/log/"
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy_if_different "${PROJECT_SOURCE_DIR}/../config/vcpe.cfg" "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy_if_different "${PROJECT_SOURCE_DIR}/../config/zlog.conf" "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy_if_different "${PROJECT_SOURCE_DIR}/../config/banner.txt" "${CMAKE_CURRENT_BINARY_DIR}/config/")
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/log/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/../config/vcpe.cfg" "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/../config/zlog.conf" "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/../config/banner.txt" "${CMAKE_CURRENT_BINARY_DIR}/config/")
|
||||
|
||||
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install/")
|
||||
install(FILES ../config/vcpe.cfg ../config/vcpe.service ../config/banner.txt ../config/zlog.conf
|
||||
DESTINATION config)
|
||||
INSTALL(TARGETS ${PROJECT_TARGET}
|
||||
RUNTIME PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
RUNTIME DESTINATION bin)
|
||||
|
||||
SET(CPACK_GENERATOR "TGZ")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "vCPE-${VCPE_VERSION}-linux-amd64_${VERSION_GIT_HASH_SHORT}")
|
||||
INCLUDE(CPack)
|
|
@ -6,9 +6,8 @@ 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
|
||||
${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)
|
||||
../httpserver/include ../httpserver/src/haywire ../httpserver/src/haywire/configuration)
|
||||
FILE(GLOB C_HEADS include/*.h include/uthash/*.h include/s2j/*.h vector/*.h ${CMAKE_BINARY_DIR}/*.h)
|
||||
|
||||
AUX_SOURCE_DIRECTORY(json C_SRC)
|
||||
|
||||
|
@ -51,7 +50,7 @@ IF (USED_SQLITE)
|
|||
-DSQLITE_HAVE_ZLIB=1 -DSQLITE_TEMP_STORE=2")
|
||||
ENDIF ()
|
||||
|
||||
ADD_DEFINITIONS(-DBUILD_VERSION="${GIT_VERSION}" ${COMMON_DEFINE})
|
||||
ADD_DEFINITIONS(${COMMON_DEFINE})
|
||||
|
||||
LINK_LIBRARIES(${COMMON_LIBS})
|
||||
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
|
||||
|
@ -62,4 +61,4 @@ IF (USED_OPENDHCPD)
|
|||
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd)
|
||||
ENDIF()
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/)
|
||||
TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/ ${CMAKE_BINARY_DIR}/)
|
|
@ -20,6 +20,7 @@
|
|||
#include "s2j/s2j.h"
|
||||
#include "msg_queue.h"
|
||||
#include "../../open_dhcp/dhcpd.h"
|
||||
#include "prj_config.h"
|
||||
|
||||
#define REG_ICASE (ARG_REX_ICASE)
|
||||
|
||||
|
@ -436,7 +437,7 @@ static int on_cmd_(void *pTbl[], const char *pName, void *pInfo) {
|
|||
show_help(pName);
|
||||
} else {
|
||||
printf("Application information: %s (Build: %s %s GCC Ver:%s) With %lu(bits) OS\n",
|
||||
BUILD_VERSION,
|
||||
VCPE_GIT_VERSION,
|
||||
__DATE__,
|
||||
__TIME__,
|
||||
__VERSION__,
|
||||
|
@ -547,7 +548,7 @@ int menu_run(int argc, char **argv) {
|
|||
void *pArgTbl6[] = {cmd6, keyGen, helpCmd6, end6};
|
||||
int errCode6 = 0;
|
||||
|
||||
#if OPENDHCPD_ON
|
||||
#ifdef OPENDHCPD_ON
|
||||
arg_rex_t *cmd7 = arg_rex1(NULL, NULL, "dhcpd", NULL, REG_ICASE, NULL);
|
||||
arg_lit_t *operate7 = arg_lit0("m", "mode", "\tService works on verbatim mode.");
|
||||
arg_file_t *cfgfile7 = arg_file1("c", "config", "<file>", "\tSpecify the current application configuration file path");
|
||||
|
@ -573,7 +574,7 @@ int menu_run(int argc, char **argv) {
|
|||
|
||||
ARG_TBL_INFO argTblInfo[] = {
|
||||
{pArgTbl1, ARRAY_SIZE(pArgTbl1), &errCode1, on_cmd1, cmdn_help, "\r \033[1;4;36mstart\033[0m: \033[1mRun agent service normally.\033[0m\n"},
|
||||
#if OPENDHCPD_ON
|
||||
#ifdef OPENDHCPD_ON
|
||||
{pArgTbl7, ARRAY_SIZE(pArgTbl7), &errCode7, on_cmd7, cmdn_help, "\n \033[1;4;36mdhcpd\033[0m: \033[1mRun DHCP service normally.\033[0m\n"},
|
||||
#endif
|
||||
{pArgTbl2, ARRAY_SIZE(pArgTbl2), &errCode2, on_cmd2, cmd2_help, "\n \033[1;4;36mif\033[0m: \033[1mRun agent interface tools.\033[0m\n"},
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "http_svr.h"
|
||||
#include "haywire.h"
|
||||
#include "lib_config.h"
|
||||
#include "prj_config.h"
|
||||
|
||||
#define DEFAULT_CONFIG_FILE ("vcpe.cfg")
|
||||
#define DEFAULT_CONFIG_DIR ("config")
|
||||
|
@ -97,7 +98,7 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK
|
|||
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,
|
||||
VCPE_GIT_VERSION,
|
||||
__DATE__,
|
||||
__TIME__,
|
||||
__VERSION__,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#endif
|
||||
|
||||
#ifdef OPENDHCPD_ON
|
||||
#include "user_errno.h"
|
||||
#include "proto.h"
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue