Add libconfig.
This commit is contained in:
parent
1930349f6e
commit
01e9deaa77
1
Makefile
1
Makefile
|
@ -38,5 +38,6 @@ clean:
|
|||
external/openssl/openssl-1.1.1s \
|
||||
external/openssl/build \
|
||||
external/curl/curl-8.1.2 \
|
||||
external/libconfig/libconfig-1.7.3 \
|
||||
out \
|
||||
cmake-shell
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
set(CMAKE_CXX_COMPILER g++)
|
||||
set(CROSS_COMPILE_PREFIX "")
|
||||
set(CMAKE_C_COMPILER "${CROSS_COMPILE_PREFIX}gcc")
|
||||
set(CMAKE_CXX_COMPILER "${CROSS_COMPILE_PREFIX}g++")
|
||||
|
||||
# path to compiler and utilities
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
@ -34,7 +35,6 @@ set(PLATFORM_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
|||
set(COVERAGE_ON "true")
|
||||
|
||||
# ------------ build curl + openssl ------------ start
|
||||
set(CROSS_COMPILE_PREFIX "")
|
||||
set(CURL_OPENSSL_LIB_SHARED_ENABLE "false")
|
||||
# ------------ build curl + openssl ------------ end
|
||||
# ------------ build clang-tidy ------------ start
|
||||
|
|
3
external/README.md
vendored
Normal file
3
external/README.md
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# 1. 第三方库
|
||||
|
||||
   该目录存放仓库依赖的三方库源码。
|
34
external/libconfig/build_libconfig.sh
vendored
Normal file
34
external/libconfig/build_libconfig.sh
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#compile libconfig to a library
|
||||
platform=$1
|
||||
CROSS_COMPILER_PATH=$2
|
||||
CROSS_COMPILER=$3
|
||||
echo "Compile libconfig, platform = $platform."
|
||||
# echo "CROSS_COMPILER_PATH = $CROSS_COMPILER_PATH"
|
||||
echo "CROSS_COMPILER = $CROSS_COMPILER"
|
||||
echo "Start to compile libconfig."
|
||||
export ROOT_PATH=$PWD
|
||||
# export PATH=$CROSS_COMPILER_PATH:$PATH
|
||||
if [ ! -d "./libconfig-1.7.3" ];then
|
||||
echo "tar zxvf libconfig-1.7.3.tar.gz"
|
||||
tar zxvf libconfig-1.7.3.tar.gz
|
||||
fi
|
||||
if [ ! -f "./libconfig-1.7.3/lib/.libs/libconfig++.a" ] || [ ! -f "./libconfig-1.7.3/lib/.libs/libconfig.a" ];then
|
||||
echo "make libconfig++.a"
|
||||
cd ./libconfig-1.7.3
|
||||
# ./configure
|
||||
# make
|
||||
case $platform in
|
||||
"linux")
|
||||
echo "==Compile linux."
|
||||
./configure
|
||||
make
|
||||
;;
|
||||
*)
|
||||
echo "==Compile cross compile."
|
||||
./configure --host=$CROSS_COMPILER
|
||||
make
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
cd $ROOT_PATH
|
BIN
external/libconfig/libconfig-1.7.3.tar.gz
vendored
Normal file
BIN
external/libconfig/libconfig-1.7.3.tar.gz
vendored
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
|
||||
# cmake_minimum_required(VERSION 2.8.0)
|
||||
# add_subdirectory(ReturnCode)
|
||||
add_subdirectory(Config)
|
||||
add_subdirectory(StatusCode)
|
||||
add_subdirectory(Log)
|
||||
|
|
62
utils/Config/CMakeLists.txt
Normal file
62
utils/Config/CMakeLists.txt
Normal file
|
@ -0,0 +1,62 @@
|
|||
|
||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||
|
||||
include_directories(
|
||||
./src
|
||||
./include
|
||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||
${UTILS_SOURCE_PATH}/Log/include
|
||||
)
|
||||
#do not rely on any other library
|
||||
#link_directories(
|
||||
#)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(./src SRC_FILES)
|
||||
|
||||
set(TARGET_NAME Config)
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} Log)
|
||||
|
||||
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
|
||||
add_custom_target(
|
||||
Config_code_check
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-checks='${CLANG_TIDY_CHECKS}'
|
||||
--header-filter=.*
|
||||
--system-headers=false
|
||||
${SRC_FILES}
|
||||
${CLANG_TIDY_CONFIG}
|
||||
-p ${CMAKE_SOURCE_DIR_IPCSDK}/cmake-shell
|
||||
WORKING_DIRECTORY ${UTILS_SOURCE_PATH}/Config
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make Config_code_check
|
||||
WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell/
|
||||
)
|
||||
endif()
|
||||
|
||||
# build libconfig before make libConfig.a
|
||||
add_custom_command(
|
||||
OUTPUT ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
||||
COMMAND echo "Build libconfig-1.7.3. CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}"
|
||||
# COMMAND tar zxvf libconfig-1.7.3.tar.gz
|
||||
COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${CROSS_COMPILER_PATH} ${CMAKE_C_COMPILER}
|
||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig
|
||||
)
|
||||
add_custom_target(
|
||||
compile_libconfig
|
||||
DEPENDS ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make compile_libconfig
|
||||
WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell
|
||||
)
|
0
utils/Config/README.md
Normal file
0
utils/Config/README.md
Normal file
13
utils/Config/include/Config.h
Normal file
13
utils/Config/include/Config.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
#include "StatusCode.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
const StatusCode ConfigInit(void);
|
||||
const StatusCode ConfigUnInit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
7
utils/Config/src/Config.c
Normal file
7
utils/Config/src/Config.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "Config.h"
|
||||
const StatusCode ConfigInit(void)
|
||||
{
|
||||
}
|
||||
const StatusCode ConfigUnInit(void)
|
||||
{
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
include(${CMAKE_SOURCE_DIR}/build/global_config.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||
|
||||
include_directories(
|
||||
./src
|
||||
./include
|
||||
)
|
||||
#do not rely on any other library
|
||||
#link_directories(
|
||||
#)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(./src SRC_FILES)
|
||||
|
||||
set(TARGET_NAME IpcConfig)
|
||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
|
@ -36,7 +36,6 @@ add_custom_target(
|
|||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
# TARGET ${ABSTRACT_TARGET}
|
||||
PRE_BUILD
|
||||
COMMAND make StatusCode_code_check
|
||||
WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell/
|
||||
|
|
Loading…
Reference in New Issue
Block a user