Improve libconfig compile.
This commit is contained in:
parent
f008337684
commit
882af7f6b0
0
external/libconfig/build_libconfig.sh
vendored
Normal file → Executable file
0
external/libconfig/build_libconfig.sh
vendored
Normal file → Executable file
|
@ -4,7 +4,7 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
namespace ConfigTest
|
namespace ConfigTest
|
||||||
{
|
{
|
||||||
// ../output_files/test/bin/LogTest --gtest_filter=ConfigTest.Demo
|
// ../output_files/test/bin/ConfigTest --gtest_filter=ConfigTest.Demo
|
||||||
TEST(ConfigTest, Demo)
|
TEST(ConfigTest, Demo)
|
||||||
{
|
{
|
||||||
CreateLogModule();
|
CreateLogModule();
|
||||||
|
|
|
@ -21,7 +21,7 @@ aux_source_directory(./src SRC_FILES)
|
||||||
|
|
||||||
set(TARGET_NAME ConfigBase)
|
set(TARGET_NAME ConfigBase)
|
||||||
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
|
||||||
target_link_libraries(${TARGET_NAME} StatusCode Log config)
|
target_link_libraries(${TARGET_NAME} StatusCode Log config++)
|
||||||
|
|
||||||
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
|
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
|
@ -45,15 +45,15 @@ endif()
|
||||||
|
|
||||||
# build libconfig before make libConfig.a
|
# build libconfig before make libConfig.a
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
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 echo "Build libconfig-1.7.3. CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}"
|
||||||
# COMMAND tar zxvf libconfig-1.7.3.tar.gz
|
# COMMAND tar zxvf libconfig-1.7.3.tar.gz
|
||||||
COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${CROSS_COMPILER_PATH} ${CMAKE_C_COMPILER}
|
COMMAND sh build_libconfig.sh ${TARGET_PLATFORM} ${CROSS_COMPILER_PATH} ${CMAKE_C_COMPILER}
|
||||||
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig
|
WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/libconfig
|
||||||
)
|
)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
config
|
config++
|
||||||
DEPENDS ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig.a
|
DEPENDS ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs/libconfig++.a
|
||||||
)
|
)
|
||||||
|
|
||||||
# add_custom_command(
|
# add_custom_command(
|
||||||
|
|
|
@ -16,24 +16,24 @@
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "SharedDataCode.h"
|
#include "SharedDataCode.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
static const char *SHARED_DATA_NAME = "shared_data";
|
static const char *SHARED_DATA_NAME = "shared_data";
|
||||||
constexpr short THERE_TWO_USER_DATA_HEADER = 2;
|
constexpr short THERE_TWO_USER_DATA_HEADER = 2;
|
||||||
SharedDataCpp::SharedDataCpp(const SHARER_NAME &sharerName, const char *path, const int &projectId)
|
SharedDataCpp::SharedDataCpp(const SHARER_NAME &sharerName, const char *path, const int &projectId)
|
||||||
: SharedMemory(path, projectId), mSharerName(sharerName)
|
: SharedMemory(path, projectId), mSharerName(sharerName)
|
||||||
{
|
{
|
||||||
mPrimaryReadSize = 0;
|
mPrimaryReadSize = 0;
|
||||||
mMinorReadSize = 0;
|
mMinorReadSize = 0;
|
||||||
mSharedMemeory = nullptr;
|
mSharedMemeory = nullptr;
|
||||||
}
|
}
|
||||||
void SharedDataCpp::MakeSharedMemory(const unsigned int readableSize, const unsigned int writableSize)
|
void SharedDataCpp::MakeSharedMemory(const unsigned int readableSize, const unsigned int writableSize)
|
||||||
{
|
{
|
||||||
if (SHARER_NAME_PRIMARY == mSharerName) {
|
if (SHARER_NAME_PRIMARY == mSharerName) {
|
||||||
mPrimaryReadSize = readableSize;
|
mPrimaryReadSize = readableSize;
|
||||||
mMinorReadSize = writableSize;
|
mMinorReadSize = writableSize;
|
||||||
}
|
}
|
||||||
else if (SHARER_NAME_MINOR == mSharerName) {
|
else if (SHARER_NAME_MINOR == mSharerName) {
|
||||||
mPrimaryReadSize = writableSize;
|
mPrimaryReadSize = writableSize;
|
||||||
mMinorReadSize = readableSize;
|
mMinorReadSize = readableSize;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogError("Make shared memory failed.\n");
|
LogError("Make shared memory failed.\n");
|
||||||
|
@ -170,11 +170,11 @@ SharedData *NewSharedDataImpl(const SHARER_NAME &name, const char *path, const i
|
||||||
SharedDataImpl *impl = (SharedDataImpl *)malloc(sizeof(SharedDataImpl));
|
SharedDataImpl *impl = (SharedDataImpl *)malloc(sizeof(SharedDataImpl));
|
||||||
SharedDataImpl tmp;
|
SharedDataImpl tmp;
|
||||||
memcpy((void *)impl, (void *)&tmp, sizeof(SharedDataImpl));
|
memcpy((void *)impl, (void *)&tmp, sizeof(SharedDataImpl));
|
||||||
impl->mHeader.mCheckName = SHARED_DATA_NAME;
|
impl->mHeader.mCheckName = SHARED_DATA_NAME;
|
||||||
impl->mBase.mMakeSharedData = MakeSharedData;
|
impl->mBase.mMakeSharedData = MakeSharedData;
|
||||||
impl->mBase.mGetReadableData = GetSharedReadableMemory;
|
impl->mBase.mGetReadableData = GetSharedReadableMemory;
|
||||||
impl->mBase.mSetWritableData = SetSharedWritableMemory;
|
impl->mBase.mSetWritableData = SetSharedWritableMemory;
|
||||||
impl->mBase.mFree = SharedDataImplFree;
|
impl->mBase.mFree = SharedDataImplFree;
|
||||||
impl->mSharedData = std::make_shared<SharedDataCpp>(name, path, projectId);
|
impl->mSharedData = std::make_shared<SharedDataCpp>(name, path, projectId);
|
||||||
return (SharedData *)(((char *)impl) + sizeof(SharedDataHeader));
|
return (SharedData *)(((char *)impl) + sizeof(SharedDataHeader));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user