summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2020-09-07 16:53:11 +0800
committeryangwei <[email protected]>2020-09-07 16:53:11 +0800
commitbafd63face5ed77d25afa718b2762064497f2066 (patch)
treeab34cf395e9d35e0b051c9be1303cda894edeb20
parente6e1f8494ec3d2e1dc21b7a9dbbcf57a5397e134 (diff)
为避免误操作,更新名称为libMESA_handle_logger2,ABI向前兼容,install后创建软连接至libMESA_handle_logger.so
-rw-r--r--CMakeLists.txt30
-rw-r--r--README12
2 files changed, 22 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e74949d..464f5e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 2.8)
-set(lib_name MESA_handle_logger)
+set(lib_name MESA_handle_logger2)
project (${lib_name})
@@ -32,17 +32,11 @@ endif()
# end of for ASAN
include_directories(${PROJECT_SOURCE_DIR}/inc/)
-include_directories(${PROJECT_SOURCE_DIR}/zlog/)
add_subdirectory(zlog)
-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)
target_link_libraries(${lib_name}_shared zlog-static)
set_target_properties(${lib_name}_shared PROPERTIES LINK_FLAGS
"-Wl,--version-script=${PROJECT_SOURCE_DIR}/src/version.map")
@@ -57,7 +51,7 @@ set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_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)
target_link_libraries(${lib_name}_static -Wl,--whole-archive zlog-static -Wl,--no-whole-archive)
set_target_properties(${lib_name}_static PROPERTIES OUTPUT_NAME ${lib_name})
@@ -65,17 +59,19 @@ set(CMAKE_INSTALL_PREFIX /opt/MESA)
install(TARGETS ${lib_name}_shared LIBRARY DESTINATION
${CMAKE_INSTALL_PREFIX}/lib)
-install(FILES inc/${lib_name}.h DESTINATION
- ${CMAKE_INSTALL_PREFIX}/include/MESA COMPONENT devel)
-
+install(CODE "execute_process( \
+ COMMAND ${CMAKE_COMMAND} -E create_symlink \
+ libMESA_handle_logger2.so \
+ ${CMAKE_INSTALL_PREFIX}/lib/libMESA_handle_logger.so \
+ )"
+)
+
+install(FILES inc/MESA_handle_logger.h DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/include/MESA COMPONENT devel)
-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..8dd9cf5 100644
--- a/README
+++ b/README
@@ -4,13 +4,19 @@
*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至文件
+
+ 2020-09-07 update to libMESA_handle_logger2 by yw
+ 1)内部使用zlog实现,行为变更,更新库为libMESA_handle_logger2
-------------------------------------------------------------------------------------
NOTICE:
1)compatible with g++, extern with c;