vcpe/CMakeLists.txt

106 lines
3.0 KiB
CMake
Raw Normal View History

CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
INCLUDE(depend/system_libs.cmake)
2022-05-10 02:59:51 +00:00
2023-01-11 09:53:51 +00:00
SET(VCPE_VERSION "1.0.1")
PROJECT(vCPE VERSION "${VCPE_VERSION}")
2022-05-10 02:59:51 +00:00
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)
2022-11-28 09:57:57 +00:00
OPTION(USED_OPENDHCPDDNS "DHCP And DNS server for vCPE" OFF)
OPTION(USED_USER_VNI "Support pass user vni id from console command line" OFF)
2022-11-28 09:57:57 +00:00
# 数据库开关
2022-11-28 09:57:57 +00:00
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)
2022-11-28 09:57:57 +00:00
SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
2022-05-10 02:59:51 +00:00
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
2022-12-23 07:08:30 +00:00
OUTPUT_VARIABLE VERSION_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF ()
2022-05-10 02:59:51 +00:00
2022-12-23 07:08:30 +00:00
IF ("${VERSION_GIT_TAG}" STREQUAL "")
2022-05-10 02:59:51 +00:00
STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S)
SET(VERSION_GIT_TAG ${COMPILE_TIME})
2022-12-02 02:51:51 +00:00
ELSE ()
2022-12-23 07:08:30 +00:00
SET(VERSION_GIT_TAG ${VERSION_GIT_TAG})
2022-12-02 02:51:51 +00:00
ENDIF ()
CONFIGURE_FILE(prj_config.h.in prj_config.h)
2022-12-23 07:08:30 +00:00
MESSAGE("Git Tag: " ${VERSION_GIT_TAG})
2022-05-10 02:59:51 +00:00
IF (USED_USER_VNI)
LIST(APPEND COMMON_DEFINE "-DUSER_VNI")
MESSAGE("Select Option USED_USER_VNI")
ENDIF ()
2022-12-02 02:51:51 +00:00
IF (USED_LWIP)
LIST(APPEND COMMON_DEFINE "-DLWIP_ON")
MESSAGE("Select Option USED_LWIP")
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-12-02 02:51:51 +00:00
IF (USED_OPENDHCPD)
LIST(APPEND COMMON_DEFINE "-DOPENDHCPD_ON")
MESSAGE("Select Option USED_OPENDHCPD")
ADD_SUBDIRECTORY(srcs/opendhcp183)
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-12-02 02:51:51 +00:00
IF (USED_OPENDHCPDDNS)
LIST(APPEND COMMON_DEFINE "-DOPENDHCPDDNS_ON")
MESSAGE("Select Option USED_OPENDHCPDDNS")
ADD_SUBDIRECTORY(srcs/dual_server)
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-12-02 02:51:51 +00:00
IF (VCPE_AGENT)
MESSAGE("Select Option VCPE_AGENT")
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-12-02 02:51:51 +00:00
IF (USED_SQLITE)
2022-11-28 09:57:57 +00:00
MESSAGE("Select Option USED_SQLITE")
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-11-28 09:57:57 +00:00
2022-12-02 02:51:51 +00:00
IF (USED_LWIP OR VCPE_AGENT)
ADD_SUBDIRECTORY(srcs/lwip)
2022-12-02 02:51:51 +00:00
ENDIF ()
2022-11-28 09:57:57 +00:00
ADD_SUBDIRECTORY(srcs)
ADD_SUBDIRECTORY(srcs/libs)
ADD_SUBDIRECTORY(srcs/httpserver)