为避免误操作,更新名称为libMESA_handle_logger2,ABI向前兼容,install后创建软连接至libMESA_handle_logger.so
This commit is contained in:
@@ -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
|
||||
|
||||
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)
|
||||
|
||||
12
README
12
README
@@ -4,13 +4,19 @@
|
||||
*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至文件
|
||||
|
||||
2020-09-07 update to libMESA_handle_logger2 by yw
|
||||
1)内部使用zlog实现,行为变更,更新库为libMESA_handle_logger2
|
||||
-------------------------------------------------------------------------------------
|
||||
NOTICE:
|
||||
1)compatible with g++, extern with c;
|
||||
|
||||
Reference in New Issue
Block a user