wangzhengquan
2021-03-01 98d6460918ee7918fa591e12ed0698b14e539c9d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# should we use our own math functions
option(SUPPORT_RDMA "If support rdma" OFF)
 
# configure a header file to pass some of the CMake settings
# to the source code
configure_file(bus_config.h.in bus_config.h)
 
 
list(APPEND _SOURCES_ 
./logger_factory.cpp
./socket/bus_server_socket.cpp
./socket/bus_server_socket_wrapper.cpp
./socket/shm_socket.cpp
./socket/shm_mod_socket.cpp
./time_util.cpp
./bus_error.cpp
./futex_sem.cpp
./svsem.cpp
./net/net_conn_pool.cpp
./net/net_mod_server_socket_wrapper.cpp
./net/net_mod_socket_wrapper.cpp
./net/net_mod_socket.cpp
./net/net_mod_socket_io.cpp
./net/net_mod_server_socket.cpp
./shm/shm_mm_wrapper.cpp
./shm/mm.cpp
./shm/hashtable.cpp
./shm/shm_mm.cpp
 
)
 
if (BUILD_SHARED_LIBS)
  add_library(shm_queue SHARED ${_SOURCES_})
else()
 add_library(shm_queue STATIC ${_SOURCES_})
endif()
 
# STATIC SHARED
# add_library(shm_queue ${_SOURCES_})
 
target_include_directories(shm_queue PUBLIC ${EXTRA_INCLUDES} )
 
target_include_directories(shm_queue PUBLIC
                                                     ${PROJECT_BINARY_DIR}/src
                           ${CMAKE_CURRENT_SOURCE_DIR}
                           ${CMAKE_CURRENT_SOURCE_DIR}/shm
                           ${CMAKE_CURRENT_SOURCE_DIR}/queue
                           ${CMAKE_CURRENT_SOURCE_DIR}/socket
                           ${CMAKE_CURRENT_SOURCE_DIR}/net
                           )
 
 
target_link_libraries(shm_queue PUBLIC  ${EXTRA_LIBS} )
 
 
if (BUILD_SHARED_LIBS)
  add_custom_command(
    OUTPUT ${PROJECT_BINARY_DIR}/lib/libshm_queue.so.md5
    COMMAND md5sum  ${PROJECT_BINARY_DIR}/lib/libshm_queue.so >  ${PROJECT_BINARY_DIR}/lib/libshm_queue.so.md5
    DEPENDS ${PROJECT_BINARY_DIR}/lib/libshm_queue.so
    COMMENT "Generate libshm_queue.so.md5"
    VERBATIM
    )
    
 add_custom_target("genmd5" ALL DEPENDS ${PROJECT_BINARY_DIR}/lib/libshm_queue.so.md5)
endif()
 
# install rules
install(TARGETS shm_queue  DESTINATION lib)
install(FILES 
 ./socket/socket_def.h
./socket/bus_server_socket.h
./socket/shm_socket.h
./socket/shm_mod_socket.h
./socket/bus_server_socket_wrapper.h
./psem.h
./pread_write_lock.h
./key_def.h
./time_util.h
./sv_read_write_lock.h
./futex_sem.h
./bus_error.h
./bus_def.h
./logger_factory.h
./sole.h
./queue/linked_lock_free_queue.h
./queue/array_lock_free_queue.h
./queue/shm_queue.h
./queue/array_lock_free_sem_queue.h
./queue/lock_free_queue.h
./svsem.h
./net/net_conn_pool.h
./net/net_mod_socket.h
./net/net_mod_server_socket_wrapper.h
./net/net_mod_socket_io.h
./net/net_mod_server_socket.h
./net/net_mod_socket_wrapper.h
./shm/hashtable.h
./shm/mm.h
./shm/shm_mm_wrapper.h
./shm/shm_allocator.h
./shm/shm_mm.h
 
 
  DESTINATION include)
 
install(FILES "${PROJECT_BINARY_DIR}/src/bus_config.h"
    DESTINATION include
)