107 lines
2.9 KiB
CMake
107 lines
2.9 KiB
CMake
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
|
|
|
|
SET(VCPE_VERSION "1.0.1")
|
|
PROJECT(vCPE VERSION "${VCPE_VERSION}")
|
|
|
|
OPTION(VCPE_AGENT "Enable vCPE agent test application" OFF)
|
|
OPTION(USED_LWIP "PPPoE of LWIP support for vCPE" OFF)
|
|
OPTION(USED_OPENDHCPD "DHCP server for vCPE" OFF)
|
|
OPTION(USED_OPENDHCPDDNS "DHCP And DNS server for vCPE" OFF)
|
|
|
|
# 数据库开关
|
|
OPTION(USED_REDIS "Add redis database support for vCPE" OFF)
|
|
OPTION(USED_MYSQL "Add mysql database support for vCPE" OFF)
|
|
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")
|
|
|
|
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 VERSION_GIT_TAG
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_QUIET
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
ENDIF ()
|
|
|
|
IF ("${VERSION_GIT_TAG}" STREQUAL "")
|
|
STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S)
|
|
SET(VERSION_GIT_TAG ${COMPILE_TIME})
|
|
ELSE ()
|
|
SET(VERSION_GIT_TAG ${VERSION_GIT_TAG})
|
|
ENDIF ()
|
|
|
|
CONFIGURE_FILE(prj_config.h.in prj_config.h)
|
|
|
|
MESSAGE("Git Tag: " ${VERSION_GIT_TAG})
|
|
|
|
IF (USED_LWIP)
|
|
LIST(APPEND COMMON_DEFINE "-DLWIP_ON")
|
|
ENDIF ()
|
|
|
|
IF (USED_OPENDHCPD)
|
|
LIST(APPEND COMMON_DEFINE "-DOPENDHCPD_ON")
|
|
ENDIF ()
|
|
|
|
IF (USED_OPENDHCPDDNS)
|
|
LIST(APPEND COMMON_DEFINE "-DOPENDHCPDDNS_ON")
|
|
ENDIF ()
|
|
|
|
IF (VCPE_AGENT)
|
|
MESSAGE("Select Option VCPE_AGENT")
|
|
ENDIF ()
|
|
|
|
IF (USED_LWIP)
|
|
MESSAGE("Select Option USED_LWIP")
|
|
ENDIF ()
|
|
|
|
IF (USED_SQLITE)
|
|
MESSAGE("Select Option USED_SQLITE")
|
|
ENDIF ()
|
|
|
|
IF (USED_OPENDHCPD)
|
|
MESSAGE("Select Option USED_OPENDHCPD")
|
|
ADD_SUBDIRECTORY(srcs/open_dhcp)
|
|
ENDIF ()
|
|
|
|
IF (USED_OPENDHCPDDNS)
|
|
MESSAGE("Select Option USED_OPENDHCPDDNS")
|
|
ADD_SUBDIRECTORY(srcs/dual_server)
|
|
ENDIF ()
|
|
|
|
IF (USED_LWIP OR VCPE_AGENT)
|
|
ADD_SUBDIRECTORY(srcs/lwip)
|
|
ENDIF ()
|
|
|
|
ADD_SUBDIRECTORY(srcs)
|
|
ADD_SUBDIRECTORY(srcs/libs)
|
|
ADD_SUBDIRECTORY(srcs/httpserver) |