2022-05-10 06:43:27 +00:00
|
|
|
SET(LIB_PROJECT_TARGET common)
|
|
|
|
|
2023-04-18 01:02:57 +00:00
|
|
|
PROJECT(${LIB_PROJECT_TARGET} LANGUAGES C VERSION 1.1.0)
|
2022-12-14 02:16:10 +00:00
|
|
|
|
2023-02-16 11:31:19 +00:00
|
|
|
STRING(REPLACE ";" ", " BUILD_CONFIG_INFO "${COMMON_DEFINE}")
|
2022-12-14 02:16:10 +00:00
|
|
|
CONFIGURE_FILE(lib_config.h.in lib_config.h)
|
2022-05-10 06:43:27 +00:00
|
|
|
|
2023-03-29 09:02:21 +00:00
|
|
|
IF (USED_SQLITE_CRYPTO)
|
|
|
|
INCLUDE_DIRECTORIES(include/sqlite3)
|
|
|
|
ENDIF ()
|
|
|
|
|
2023-03-20 02:47:22 +00:00
|
|
|
INCLUDE_DIRECTORIES(include ../opendhcp183 mongoose
|
2023-03-31 06:32:32 +00:00
|
|
|
./ ./include ../lwip/src/include ../lwip/src/arch_linux/include ../include)
|
2023-03-20 02:47:22 +00:00
|
|
|
FILE(GLOB C_HEADS ./include/network/*.h include/*.h include/uthash/*.h include/s2j/*.h vector/*.h ${CMAKE_BINARY_DIR}/*.h ${PROJECT_BINARY_DIR}/*.h)
|
2022-05-10 06:43:27 +00:00
|
|
|
|
|
|
|
AUX_SOURCE_DIRECTORY(json C_SRC)
|
2022-10-28 08:46:55 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(args C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(init C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(misc C_SRC)
|
2023-04-07 07:56:38 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(bitset C_SRC)
|
2022-10-28 08:46:55 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(banner C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(configure C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(network C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(task C_SRC)
|
2023-03-29 09:02:21 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(ipaddr C_SRC)
|
2023-03-13 09:03:02 +00:00
|
|
|
IF (USED_ZMQ)
|
|
|
|
AUX_SOURCE_DIRECTORY(mq C_SRC)
|
|
|
|
ENDIF ()
|
2022-10-28 08:46:55 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(cmdline C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(crypto C_SRC)
|
|
|
|
AUX_SOURCE_DIRECTORY(hardware C_SRC)
|
2022-12-03 08:46:52 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(protocol C_SRC)
|
2023-02-10 01:03:01 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(fs_watch C_SRC)
|
2023-02-06 07:10:02 +00:00
|
|
|
AUX_SOURCE_DIRECTORY(zlog_module C_SRC)
|
2023-02-27 06:10:36 +00:00
|
|
|
|
|
|
|
IF (USED_JSON_VALIDATE)
|
|
|
|
ADD_SUBDIRECTORY(./json/json_schema)
|
|
|
|
ENDIF ()
|
|
|
|
|
2023-02-21 07:17:49 +00:00
|
|
|
IF (USED_HTTP_SVR)
|
|
|
|
AUX_SOURCE_DIRECTORY(mongoose C_SRC)
|
|
|
|
ENDIF ()
|
2022-11-28 09:57:57 +00:00
|
|
|
|
2022-12-02 02:51:51 +00:00
|
|
|
IF (USED_SQLITE)
|
2023-03-31 06:32:32 +00:00
|
|
|
LIST(APPEND C_SRC database/database.c)
|
2023-03-29 09:02:21 +00:00
|
|
|
IF (SQLITE_CRYPTO_ON)
|
|
|
|
AUX_SOURCE_DIRECTORY(database/sqlite3 C_SRC)
|
|
|
|
ENDIF ()
|
2022-12-02 02:51:51 +00:00
|
|
|
ENDIF ()
|
2022-11-28 09:57:57 +00:00
|
|
|
|
2022-05-10 06:43:27 +00:00
|
|
|
SET(CMAKE_C_STANDARD 99)
|
|
|
|
|
2022-11-23 02:41:05 +00:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(misc/zvector.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -flto")
|
2023-02-21 07:17:49 +00:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(mongoose/mongoose.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -w")
|
|
|
|
|
2023-03-29 09:02:21 +00:00
|
|
|
IF (USED_SQLITE_CRYPTO)
|
2022-11-29 10:17:25 +00:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(database/sqlite3/sqlite3.c PROPERTIES
|
2023-03-31 06:32:32 +00:00
|
|
|
COMPILE_FLAGS "-DSQLITE_HAS_CODEC \
|
2022-11-28 09:57:57 +00:00
|
|
|
-DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 \
|
|
|
|
-D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 \
|
|
|
|
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
|
|
|
|
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
|
|
|
|
-DSQLITE_HAVE_ZLIB=1 -DSQLITE_TEMP_STORE=2")
|
2022-12-02 02:51:51 +00:00
|
|
|
ENDIF ()
|
2022-11-17 07:27:32 +00:00
|
|
|
|
2023-03-31 06:32:32 +00:00
|
|
|
ADD_DEFINITIONS(${COMMON_DEFINE})
|
|
|
|
|
|
|
|
IF (USED_HTTP_SVR)
|
|
|
|
ADD_DEFINITIONS(-DMG_ARCH=MG_ARCH_UNIX -DMG_ENABLE_OPENSSL=1)
|
|
|
|
ENDIF ()
|
2022-11-16 02:36:28 +00:00
|
|
|
|
2022-11-07 06:21:24 +00:00
|
|
|
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
|
|
|
|
|
2023-02-16 10:44:01 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} ${COMMON_LIBS})
|
|
|
|
|
2023-02-27 06:10:36 +00:00
|
|
|
IF (USED_JSON_VALIDATE)
|
|
|
|
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} jsoncdac)
|
|
|
|
ENDIF ()
|
2023-02-27 02:34:43 +00:00
|
|
|
|
2022-12-15 08:26:39 +00:00
|
|
|
IF (USED_OPENDHCPD)
|
2023-05-18 02:09:17 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd)
|
|
|
|
ENDIF ()
|
|
|
|
|
|
|
|
IF (USED_DHCPSERVER)
|
2023-03-17 07:42:15 +00:00
|
|
|
#TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd)
|
2023-05-18 02:09:17 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} dhcpd)
|
2023-01-31 09:49:22 +00:00
|
|
|
ENDIF ()
|
|
|
|
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/ ${CMAKE_BINARY_DIR}/)
|