From 5026f256928cc3d3d6768faa63249bd343a4dd74 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 07 九月 2021 16:14:25 +0800
Subject: [PATCH] 调整defer C.BHFree的执行顺序
---
src/CMakeLists.txt | 152 +++++++++++++++++++++++++++++---------------------
1 files changed, 88 insertions(+), 64 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0e9667a..276c547 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,85 +1,109 @@
-
-
# should we use our own math functions
-option(SUPPORT_RDMA "If support rdma" ON)
+option(SUPPORT_RDMA "If support rdma" OFF)
# configure a header file to pass some of the CMake settings
# to the source code
-configure_file(BusConfig.h.in BusConfig.h)
+configure_file(bus_config.h.in bus_config.h)
-add_library(shm_queue
- logger_factory.cpp
- socket/bus_server_socket.cpp
- socket/bus_server_socket_wrapper.cpp
- socket/shm_stream_mod_socket.cpp
- socket/shm_socket.cpp
- socket/net_conn_pool.cpp
- socket/shm_mod_socket.cpp
- socket/net_mod_server_socket_wrapper.cpp
- socket/net_mod_socket_wrapper.cpp
- socket/net_mod_socket.cpp
- socket/net_mod_socket_io.cpp
- socket/net_mod_server_socket.cpp
- bus_error.cpp
- queue/shm_queue_wrapper.cpp
- shm/shm_mm_wrapper.cpp
- shm/mm.cpp
- shm/hashtable.cpp
+#set_property(TARGET shm_queue PROPERTY POSITION_INDEPENDENT_CODE ON)
+add_compile_options(-fPIC)
+#target_compile_options(shm_queue PRIVATE -fPIC)
- )
+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
+./bh_api.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
+../proto/source/bhome_msg_api.pb.cc
+../proto/source/bhome_msg.pb.cc
+../proto/source/error_msg.pb.cc
+./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_})
+ target_compile_options(shm_queue PRIVATE -fPIC)
+ set_property(TARGET shm_queue PROPERTY POSITION_INDEPENDENT_CODE ON)
+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}"
- ${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}/proto
${CMAKE_CURRENT_SOURCE_DIR}/queue
${CMAKE_CURRENT_SOURCE_DIR}/socket
+ ${CMAKE_CURRENT_SOURCE_DIR}/net
)
-# state that anybody linking to us needs to include the current source dir
-# to find MathFunctions.h, while we don't.
-target_include_directories(shm_queue INTERFACE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/shm
- ${CMAKE_CURRENT_SOURCE_DIR}/queue
- ${CMAKE_CURRENT_SOURCE_DIR}/socket
- )
+add_executable(bus_proxy_start bus_proxy_start.cpp)
+target_link_libraries(bus_proxy_start PRIVATE shm_queue ${EXTRA_LIBS} )
+
+target_link_libraries(shm_queue PUBLIC ${EXTRA_LIBS} )
# install rules
-install(TARGETS shm_queue DESTINATION lib)
+install(TARGETS shm_queue DESTINATION lib)
install(FILES
- socket/socket_def.h
- socket/net_conn_pool.h
- socket/bus_server_socket.h
- socket/shm_socket.h
- socket/net_mod_socket.h
- socket/shm_stream_mod_socket.h
- socket/net_mod_server_socket_wrapper.h
- socket/net_mod_socket_io.h
- socket/net_mod_server_socket.h
- socket/shm_mod_socket.h
- socket/net_mod_socket_wrapper.h
- socket/bus_server_socket_wrapper.h
- key_def.h
- bus_error.h
- logger_factory.h
- queue/linked_lock_free_queue.h
- queue/array_lock_free_queue2.h
- queue/array_lock_free_queue.h
- queue/shm_queue.h
- queue/shm_queue_wrapper.h
- queue/lock_free_queue.h
- shm/hashtable.h
- shm/mem_pool.h
- shm/mm.h
- shm/shm_allocator.h
- shm/shm_mm_wraper.h
+ ./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
+./proc_def.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/BusConfig.h"
+install(FILES "${PROJECT_BINARY_DIR}/src/bus_config.h"
DESTINATION include
)
--
Gitblit v1.8.0