From 8825da88816657a1b4f1604b12a67b9434396fee Mon Sep 17 00:00:00 2001 From: yangwei Date: Mon, 7 Sep 2020 16:26:27 +0800 Subject: [PATCH] =?UTF-8?q?cmake=E6=9B=B4=E6=96=B0=EF=BC=8C=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E4=BB=A3=E7=A0=81=E7=BC=96=E8=AF=91=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E8=AF=81=E5=90=91=E5=89=8D=E5=85=BC=E5=AE=B9=E5=8F=96=E6=B6=88?= =?UTF-8?q?soversion=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 21 +++++---------------- README | 9 ++++++--- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9c6062..7d352ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ set(LIB_MINOR_VERSION 1) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) include(Version) -#SET(CMAKE_C_COMPILER "/usr/bin/g++") set(CMAKE_MACOSX_RPATH 0) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wall) set(CMAKE_INSTALL_PREFIX /opt/MESA) @@ -35,26 +34,21 @@ endif() include_directories(${PROJECT_SOURCE_DIR}/inc/) -file(GLOB SRC - "src/*.c" - "src/*.cpp" -) - # Shared Library Output -add_library(${lib_name}_shared SHARED ${SRC}) +add_library(${lib_name}_shared SHARED src/MESA_handle_logger.c) if(DEFINED MESA_SHARED_INSTALL_DIR) set_target_properties(${lib_name}_shared PROPERTIES OUTPUT_NAME ${lib_name} LIBRARY_OUTPUT_DIRECTORY ${MESA_SHARED_INSTALL_DIR}) else() set_target_properties(${lib_name}_shared PROPERTIES OUTPUT_NAME ${lib_name}) endif() -set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}) -set_target_properties(${lib_name}_shared PROPERTIES SOVERSION ${LIB_MAJOR_VERSION}) +#set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}) +#set_target_properties(${lib_name}_shared PROPERTIES SOVERSION ${LIB_MAJOR_VERSION}) # static Library Output -add_library(${lib_name}_static STATIC ${SRC}) +add_library(${lib_name}_static STATIC src/MESA_handle_logger.c) set_target_properties(${lib_name}_static PROPERTIES OUTPUT_NAME ${lib_name}) set(CMAKE_INSTALL_PREFIX /opt/MESA) @@ -64,12 +58,7 @@ install(FILES inc/${lib_name}.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ME -file(GLOB DEMO - "demo/*.c" - "demo/*.cpp" -) - -add_executable(${lib_name}_demo ${DEMO}) +add_executable(${lib_name}_demo demo/test_handle_logger.c) target_link_libraries(${lib_name}_demo rt pthread ${lib_name}_static) include(Package) diff --git a/README b/README index d933733..1d2d219 100644 --- a/README +++ b/README @@ -4,13 +4,16 @@ *Author:yangwei@iie.ac.cn *History: 2014-03-24 created by yw - 1)first version + 1)第一个动态库版本 2014-04-16 modified by yw - 1)strict inspection parameters, compatible with g++ 4.4.4 + 1) 支持g++ 4.4.4编译 2014-05-29 update by yw - 1)create directory is supported + 1)支持创建用户指定的日志目录 + + 2019-2-18 update by yw + 1)性能优化,句柄中存储文件fp,定期flush至文件 ------------------------------------------------------------------------------------- NOTICE: 1)compatible with g++, extern with c;