🔧 build(infra build): refactor build parameters

This commit is contained in:
yangwei
2024-08-29 17:59:19 +08:00
parent 4060f1bb09
commit cc2d2be324
9 changed files with 37 additions and 47 deletions

View File

@@ -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(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}) foreach(infra ${INFRA})
add_subdirectory(${infra})
add_subdirectory(log) endforeach()
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})
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stellar_devel.c "") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stellar_devel.c "")

View File

@@ -1,3 +1,3 @@
add_library(core stellar_config.c stellar_stat.c stellar_core.c) 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)

View File

@@ -1,6 +1,6 @@
add_library(ip_reassembly ip_reassembly.c) add_library(ip_reassembly ip_reassembly.c)
target_include_directories(ip_reassembly PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(ip_reassembly PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(ip_reassembly PUBLIC ${CMAKE_SOURCE_DIR}/deps/crc32) 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) add_subdirectory(test)

View File

@@ -1,3 +1,3 @@
add_library(packet_io dumpfile_io.c marsio_io.c packet_io.c) add_library(packet_io dumpfile_io.c marsio_io.c packet_io.c)
target_include_directories(packet_io PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(packet_io PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(packet_io marsio pcap packet) target_link_libraries(packet_io marsio pcap packet_parser)

View File

@@ -1,14 +1,14 @@
add_library(packet add_library(packet_parser
packet_utils.c packet_utils.c
packet_parser.c packet_parser.c
packet_builder.c packet_builder.c
packet_filter.c packet_filter.c
packet_dump.c packet_dump.c
checksum.c) checksum.c)
target_include_directories(packet PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(packet_parser PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash) target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash)
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/include) target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/include)
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/infra/core) target_include_directories(packet_parser PUBLIC ${CMAKE_SOURCE_DIR}/infra/core)
target_link_libraries(packet tuple log dablooms) target_link_libraries(packet_parser tuple log dablooms)
add_subdirectory(test) add_subdirectory(test)

View File

@@ -1,59 +1,59 @@
add_executable(gtest_tunnel gtest_tunnel.cpp) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) include(GoogleTest)
gtest_discover_tests(gtest_tunnel) gtest_discover_tests(gtest_tunnel)

View File

@@ -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_CURRENT_LIST_DIR})
target_include_directories(session_manager PUBLIC ${CMAKE_SOURCE_DIR}/infra/core) target_include_directories(session_manager PUBLIC ${CMAKE_SOURCE_DIR}/infra/core)
target_include_directories(session_manager PUBLIC ${CMAKE_SOURCE_DIR}/include) 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) add_subdirectory(test)

View File

@@ -1,6 +1,6 @@
# build libdebug_plugin.so # build libdebug_plugin.so
add_library(debug_plugin SHARED debug_plugin.c) 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}/include/)
target_include_directories(debug_plugin PUBLIC ${CMAKE_SOURCE_DIR}/infra/core/utils) 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") set_target_properties(debug_plugin PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map")

View File

@@ -1,5 +1,5 @@
add_executable(packet_tool packet_tool.c) 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 split_pcap.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY cmp_layers.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY cmp_layers.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})