summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-08-29 17:59:19 +0800
committeryangwei <[email protected]>2024-08-29 18:16:37 +0800
commitcc2d2be3241da68f417fb826ec995d5036e7e328 (patch)
treeed4cb62f8bdfa400797dab2ec32b8a936d66a88f
parent4060f1bb09024ecf46e1389618cf0ab7673e7cec (diff)
🔧 build(infra build): refactor build parameters
-rw-r--r--infra/CMakeLists.txt22
-rw-r--r--infra/core/CMakeLists.txt2
-rw-r--r--infra/ip_reassembly/CMakeLists.txt2
-rw-r--r--infra/packet_io/CMakeLists.txt2
-rw-r--r--infra/packet_parser/CMakeLists.txt12
-rw-r--r--infra/packet_parser/test/CMakeLists.txt38
-rw-r--r--infra/session_manager/CMakeLists.txt2
-rw-r--r--test/debug_plugin/CMakeLists.txt2
-rw-r--r--test/packet_tool/CMakeLists.txt2
9 files changed, 37 insertions, 47 deletions
diff --git a/infra/CMakeLists.txt b/infra/CMakeLists.txt
index cb6f4df..c869555 100644
--- a/infra/CMakeLists.txt
+++ b/infra/CMakeLists.txt
@@ -1,21 +1,11 @@
-set(MODULES log tuple packet packet_io snowflake ip_reassembly tcp_reassembly session_manager plugin_manager)
+set(INFRA log tuple packet_parser packet_io snowflake ip_reassembly tcp_reassembly session_manager plugin_manager core)
set(DEPS bitmap dablooms interval_tree nmx_pool rbtree timeout toml)
-set(PLUGIN http lpi)
+set(DECODERS http lpi)
+set(WHOLE_ARCHIVE ${DEPS} ${INFRA} ${DECODERS})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-add_subdirectory(log)
-add_subdirectory(tuple)
-add_subdirectory(packet_parser)
-add_subdirectory(packet_io)
-add_subdirectory(snowflake)
-add_subdirectory(ip_reassembly)
-add_subdirectory(tcp_reassembly)
-add_subdirectory(session_manager)
-add_subdirectory(plugin_manager)
-add_subdirectory(core)
-
-set(WHOLE_ARCHIVE core ${DEPS} ${MODULES} ${PLUGIN})
+foreach(infra ${INFRA})
+ add_subdirectory(${infra})
+endforeach()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stellar_devel.c "")
diff --git a/infra/core/CMakeLists.txt b/infra/core/CMakeLists.txt
index 18ed5dd..237e4c4 100644
--- a/infra/core/CMakeLists.txt
+++ b/infra/core/CMakeLists.txt
@@ -1,3 +1,3 @@
add_library(core stellar_config.c stellar_stat.c stellar_core.c)
-target_link_libraries(core PUBLIC ${MODULES})
+target_link_libraries(core PUBLIC packet_io snowflake ip_reassembly plugin_manager)
diff --git a/infra/ip_reassembly/CMakeLists.txt b/infra/ip_reassembly/CMakeLists.txt
index 177c255..5403fd7 100644
--- a/infra/ip_reassembly/CMakeLists.txt
+++ b/infra/ip_reassembly/CMakeLists.txt
@@ -1,6 +1,6 @@
add_library(ip_reassembly ip_reassembly.c)
target_include_directories(ip_reassembly PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(ip_reassembly PUBLIC ${CMAKE_SOURCE_DIR}/deps/crc32)
-target_link_libraries(ip_reassembly packet)
+target_link_libraries(ip_reassembly packet_parser)
add_subdirectory(test) \ No newline at end of file
diff --git a/infra/packet_io/CMakeLists.txt b/infra/packet_io/CMakeLists.txt
index 75afae0..3d77732 100644
--- a/infra/packet_io/CMakeLists.txt
+++ b/infra/packet_io/CMakeLists.txt
@@ -1,3 +1,3 @@
add_library(packet_io dumpfile_io.c marsio_io.c packet_io.c)
target_include_directories(packet_io PUBLIC ${CMAKE_CURRENT_LIST_DIR})
-target_link_libraries(packet_io marsio pcap packet) \ No newline at end of file
+target_link_libraries(packet_io marsio pcap packet_parser) \ No newline at end of file
diff --git a/infra/packet_parser/CMakeLists.txt b/infra/packet_parser/CMakeLists.txt
index 5ed91e5..a0ee580 100644
--- a/infra/packet_parser/CMakeLists.txt
+++ b/infra/packet_parser/CMakeLists.txt
@@ -1,14 +1,14 @@
-add_library(packet
+add_library(packet_parser
packet_utils.c
packet_parser.c
packet_builder.c
packet_filter.c
packet_dump.c
checksum.c)
-target_include_directories(packet PUBLIC ${CMAKE_CURRENT_LIST_DIR})
-target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash)
-target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/include)
-target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/infra/core)
-target_link_libraries(packet tuple log dablooms)
+target_include_directories(packet_parser PUBLIC ${CMAKE_CURRENT_LIST_DIR})
+target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash)
+target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/include)
+target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/infra/core)
+target_link_libraries(packet_parser tuple log dablooms)
add_subdirectory(test) \ No newline at end of file
diff --git a/infra/packet_parser/test/CMakeLists.txt b/infra/packet_parser/test/CMakeLists.txt
index a5e3a2f..f68a294 100644
--- a/infra/packet_parser/test/CMakeLists.txt
+++ b/infra/packet_parser/test/CMakeLists.txt
@@ -1,59 +1,59 @@
add_executable(gtest_tunnel gtest_tunnel.cpp)
-target_link_libraries(gtest_tunnel packet gtest)
+target_link_libraries(gtest_tunnel packet_parser gtest)
add_executable(gtest_udp_utils gtest_udp_utils.cpp)
-target_link_libraries(gtest_udp_utils packet gtest)
+target_link_libraries(gtest_udp_utils packet_parser gtest)
add_executable(gtest_tcp_utils gtest_tcp_utils.cpp)
-target_link_libraries(gtest_tcp_utils packet gtest)
+target_link_libraries(gtest_tcp_utils packet_parser gtest)
add_executable(gtest_ip4_utils gtest_ip4_utils.cpp)
-target_link_libraries(gtest_ip4_utils packet gtest)
+target_link_libraries(gtest_ip4_utils packet_parser gtest)
add_executable(gtest_ip6_utils gtest_ip6_utils.cpp)
-target_link_libraries(gtest_ip6_utils packet gtest)
+target_link_libraries(gtest_ip6_utils packet_parser gtest)
add_executable(gtest_mpls_utils gtest_mpls_utils.cpp)
-target_link_libraries(gtest_mpls_utils packet gtest)
+target_link_libraries(gtest_mpls_utils packet_parser gtest)
add_executable(gtest_eth_utils gtest_eth_utils.cpp)
-target_link_libraries(gtest_eth_utils packet gtest)
+target_link_libraries(gtest_eth_utils packet_parser gtest)
add_executable(gtest_vlan_utils gtest_vlan_utils.cpp)
-target_link_libraries(gtest_vlan_utils packet gtest)
+target_link_libraries(gtest_vlan_utils packet_parser gtest)
add_executable(gtest_vxlan_utils gtest_vxlan_utils.cpp)
-target_link_libraries(gtest_vxlan_utils packet gtest)
+target_link_libraries(gtest_vxlan_utils packet_parser gtest)
add_executable(gtest_gre0_utils gtest_gre0_utils.cpp)
-target_link_libraries(gtest_gre0_utils packet gtest)
+target_link_libraries(gtest_gre0_utils packet_parser gtest)
add_executable(gtest_gre1_utils gtest_gre1_utils.cpp)
-target_link_libraries(gtest_gre1_utils packet gtest)
+target_link_libraries(gtest_gre1_utils packet_parser gtest)
add_executable(gtest_l2tp_utils gtest_l2tp_utils.cpp)
-target_link_libraries(gtest_l2tp_utils packet gtest)
+target_link_libraries(gtest_l2tp_utils packet_parser gtest)
add_executable(gtest_gtp1_utils gtest_gtp1_utils.cpp)
-target_link_libraries(gtest_gtp1_utils packet gtest)
+target_link_libraries(gtest_gtp1_utils packet_parser gtest)
add_executable(gtest_gtp2_utils gtest_gtp2_utils.cpp)
-target_link_libraries(gtest_gtp2_utils packet gtest)
+target_link_libraries(gtest_gtp2_utils packet_parser gtest)
add_executable(gtest_packet_frag gtest_packet_frag.cpp)
-target_link_libraries(gtest_packet_frag packet gtest)
+target_link_libraries(gtest_packet_frag packet_parser gtest)
add_executable(gtest_packet_parser gtest_packet_parser.cpp)
-target_link_libraries(gtest_packet_parser packet gtest)
+target_link_libraries(gtest_packet_parser packet_parser gtest)
add_executable(gtest_packet_builder gtest_packet_builder.cpp)
-target_link_libraries(gtest_packet_builder packet gtest)
+target_link_libraries(gtest_packet_builder packet_parser gtest)
add_executable(gtest_packet_filter gtest_packet_filter.cpp)
-target_link_libraries(gtest_packet_filter packet gtest)
+target_link_libraries(gtest_packet_filter packet_parser gtest)
add_executable(gtest_packet_ldbc gtest_packet_ldbc.cpp)
-target_link_libraries(gtest_packet_ldbc packet gtest)
+target_link_libraries(gtest_packet_ldbc packet_parser gtest)
include(GoogleTest)
gtest_discover_tests(gtest_tunnel)
diff --git a/infra/session_manager/CMakeLists.txt b/infra/session_manager/CMakeLists.txt
index e295d1e..74cc479 100644
--- a/infra/session_manager/CMakeLists.txt
+++ b/infra/session_manager/CMakeLists.txt
@@ -10,6 +10,6 @@ add_library(session_manager
target_include_directories(session_manager PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(session_manager PUBLIC ${CMAKE_SOURCE_DIR}/infra/core)
target_include_directories(session_manager PUBLIC ${CMAKE_SOURCE_DIR}/include)
-target_link_libraries(session_manager timeout packet tcp_reassembly)
+target_link_libraries(session_manager timeout packet_parser tcp_reassembly)
add_subdirectory(test) \ No newline at end of file
diff --git a/test/debug_plugin/CMakeLists.txt b/test/debug_plugin/CMakeLists.txt
index 218462f..19f3159 100644
--- a/test/debug_plugin/CMakeLists.txt
+++ b/test/debug_plugin/CMakeLists.txt
@@ -1,6 +1,6 @@
# build libdebug_plugin.so
add_library(debug_plugin SHARED debug_plugin.c)
-target_link_libraries(debug_plugin stellar_devel session_manager packet)
+target_link_libraries(debug_plugin stellar_devel session_manager packet_parser)
target_include_directories(debug_plugin PUBLIC ${CMAKE_SOURCE_DIR}/include/)
target_include_directories(debug_plugin PUBLIC ${CMAKE_SOURCE_DIR}/infra/core/utils)
set_target_properties(debug_plugin PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map")
diff --git a/test/packet_tool/CMakeLists.txt b/test/packet_tool/CMakeLists.txt
index 54b1207..981c32a 100644
--- a/test/packet_tool/CMakeLists.txt
+++ b/test/packet_tool/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(packet_tool packet_tool.c)
-target_link_libraries(packet_tool packet pcap)
+target_link_libraries(packet_tool packet_parser pcap)
file(COPY split_pcap.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY cmp_layers.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) \ No newline at end of file