diff options
| author | dump2file <[email protected]> | 2019-01-22 16:48:24 +0600 |
|---|---|---|
| committer | dump2file <[email protected]> | 2019-01-22 16:48:24 +0600 |
| commit | 6189e1d17e461453c9c2db0a996529e0a560e7cd (patch) | |
| tree | 600888ef135f9a992ded2b7c2db1e9264949859d | |
| parent | a01e3a716d8408bb6defd8d5ca7b80b202d4a82f (diff) | |
1、修复USE_DICTATOR开关开启后,CMake文件链接的问题
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | entry/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | support/dictator2/src/CMakeLists.txt | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1114455..1e0f99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,13 +94,18 @@ endif() # Memory Allocator option(OPT_USE_DICTATOR "Use Dictator2 memory allocator" OFF) -option(OPT_USE_TXMEM "Use Dictator2 for TileGX memory allocator" OFF) +option(OPT_USE_DICTATOR_DEBUG "Use Dictator2 memory allocator" OFF) option(OPT_USE_TCMALLOC "Use TCmalloc memory allocator" OFF) option(OPT_USE_TCMALLOC_MINI "Use TCmalloc memory allocator" OFF) option(OPT_USE_JEMALLOC "Use JEmalloc memory allocator" OFF) -if(OPT_USE_DICTATOR) - set(MEM_POOL_DEFINITIONS -DUSE_MEM_POOL=1) +if(OPT_USE_DICTATOR_DEBUG) + set(MEM_POOL_DEFINITIONS -DDICTATOR_DEBUG) +endif() + +if(OPT_USE_DICTATOR OR OPT_USE_DICTATOR_DEBUG) + set(MEM_POOL_DEFINITIONS ${MEM_POOL_DEFINITIONS} -DUSE_MEM_POOL=1 + -DUSE_MEMPOOL) elseif(OPT_USE_TCMALLOC_MINI) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltcmalloc_minimal -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") elseif(OPT_USE_TCMALLOC) @@ -116,6 +121,7 @@ set(SAPP_DEPEND_DYN_LIB MESA_handle_logger MESA_htable pthread MESA_field_stat2 #set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -fno-inline") +add_subdirectory(test_so) add_subdirectory(support) add_subdirectory(dealpkt) add_subdirectory(packet_io) @@ -123,7 +129,6 @@ add_subdirectory(plugin) add_subdirectory(project) add_subdirectory(inner_plug) add_subdirectory(entry) -add_subdirectory(test_so) install(PROGRAMS ${CMAKE_BINARY_DIR}/entry/sapp DESTINATION .) diff --git a/entry/CMakeLists.txt b/entry/CMakeLists.txt index 97b9faf..207e960 100644 --- a/entry/CMakeLists.txt +++ b/entry/CMakeLists.txt @@ -10,12 +10,13 @@ include_directories(${CMAKE_SOURCE_DIR}/dealpkt) include_directories(${CMAKE_SOURCE_DIR}/packet_io) add_executable(sapp sapp_init.c sapp_main.c sapp_global_val.c) +target_compile_options(sapp PUBLIC ${MEM_POOL_DEFINITIONS}) target_link_libraries(sapp nsl pthread dl m pcap) target_link_libraries(sapp MESA_handle_logger MESA_prof_load) set(SAPP_MODULES iknow timestamp_record md5 symbol_check MESA_sleep MESA_socket_wrap packet_io dealpkt project plugctrl) -if(OPT_USE_DICTATOR) +if(OPT_USE_DICTATOR OR OPT_USE_DICTATOR_DEBUG) set(SAPP_MODULES ${SAPP_MODULES} dictator2 ) endif() diff --git a/support/dictator2/src/CMakeLists.txt b/support/dictator2/src/CMakeLists.txt index adc48dc..57959e0 100644 --- a/support/dictator2/src/CMakeLists.txt +++ b/support/dictator2/src/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(${MESA_SDK_PREFIX}/include/MESA) #include_directories(${CMAKE_SOURCE_DIR}/include/support) #include_directories(${CMAKE_SOURCE_DIR}/dealpkt) -add_definitions(-D_BSD_SOURCE -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H) +add_definitions(${MEM_POOL_DEFINITIONS} -D_BSD_SOURCE -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H) add_library(dictator2 STATIC dictator.cpp dictator_debuger.cpp D_internal/D_kernel_list.cpp D_internal/list_common.cpp |
