From bb426c7a853df53c1f86ff6f9e947889c4582937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sat, 11 Feb 2023 08:52:18 +0000 Subject: [PATCH] CMake: Remove unnecessary wmem object library The cmake wmem sub-library code is superfluous and adds complexity if trying to build parallel different configurations of wsutil. --- wsutil/CMakeLists.txt | 86 +++++++++++++++++++++++--- wsutil/wmem/CMakeLists.txt | 120 ------------------------------------- 2 files changed, 77 insertions(+), 129 deletions(-) delete mode 100644 wsutil/wmem/CMakeLists.txt diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index 3be5a384c9..77354ffb32 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -22,7 +22,54 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/path_config.h.in ${CMAKE_CURRENT_BINA include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_subdirectory(wmem) +set(WMEM_PUBLIC_HEADERS + wmem/wmem.h + wmem/wmem_array.h + wmem/wmem_core.h + wmem/wmem_list.h + wmem/wmem_map.h + wmem/wmem_miscutl.h + wmem/wmem_multimap.h + wmem/wmem_queue.h + wmem/wmem_stack.h + wmem/wmem_strbuf.h + wmem/wmem_strutl.h + wmem/wmem_tree.h + wmem/wmem_interval_tree.h + wmem/wmem_user_cb.h +) + +set(WMEM_HEADER_FILES + ${WMEM_PUBLIC_HEADERS} + wmem/wmem_allocator.h + wmem/wmem_allocator_block.h + wmem/wmem_allocator_block_fast.h + wmem/wmem_allocator_simple.h + wmem/wmem_allocator_strict.h + wmem/wmem_interval_tree.h + wmem/wmem_map_int.h + wmem/wmem_tree-int.h + wmem/wmem_user_cb_int.h +) + +set(WMEM_FILES + wmem/wmem_array.c + wmem/wmem_core.c + wmem/wmem_allocator_block.c + wmem/wmem_allocator_block_fast.c + wmem/wmem_allocator_simple.c + wmem/wmem_allocator_strict.c + wmem/wmem_interval_tree.c + wmem/wmem_list.c + wmem/wmem_map.c + wmem/wmem_miscutl.c + wmem/wmem_multimap.c + wmem/wmem_stack.c + wmem/wmem_strbuf.c + wmem/wmem_strutl.c + wmem/wmem_tree.c + wmem/wmem_user_cb.c +) set(WSUTIL_PUBLIC_HEADERS 802_11-utils.h @@ -171,7 +218,11 @@ if(ENABLE_PLUGINS) ) endif() -set(WSUTIL_FILES ${WSUTIL_COMMON_FILES}) +set(WSUTIL_FILES + ${WMEM_FILES} + ${WSUTIL_COMMON_FILES} +) + if(WIN32) list(APPEND WSUTIL_FILES file_util.c @@ -287,7 +338,6 @@ endif() add_library(wsutil ${WSUTIL_FILES} - $ ${CMAKE_BINARY_DIR}/resources/libwsutil.rc ) @@ -344,6 +394,29 @@ install(TARGETS wsutil ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +install(FILES ${WMEM_PUBLIC_HEADERS} + DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil/wmem" + COMPONENT "Development" + EXCLUDE_FROM_ALL +) + +install(FILES ${WSUTIL_PUBLIC_HEADERS} + DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil" + COMPONENT "Development" + EXCLUDE_FROM_ALL +) + +add_executable(wmem_test EXCLUDE_FROM_ALL wmem/wmem_test.c ${WMEM_FILES}) + +target_link_libraries(wmem_test wsutil) + +set_target_properties(wmem_test PROPERTIES + FOLDER "Tests" + EXCLUDE_FROM_DEFAULT_BUILD True + COMPILE_DEFINITIONS "WS_BUILD_DLL" + COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" +) + add_executable(test_wsutil EXCLUDE_FROM_ALL test_wsutil.c ) @@ -356,17 +429,12 @@ set_target_properties(test_wsutil PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) -install(FILES ${WSUTIL_PUBLIC_HEADERS} - DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil" - COMPONENT "Development" - EXCLUDE_FROM_ALL -) - CHECKAPI( NAME wsutil SWITCHES SOURCES + ${WMEM_FILES} ${WSUTIL_COMMON_FILES} ) diff --git a/wsutil/wmem/CMakeLists.txt b/wsutil/wmem/CMakeLists.txt deleted file mode 100644 index 25909a4fa2..0000000000 --- a/wsutil/wmem/CMakeLists.txt +++ /dev/null @@ -1,120 +0,0 @@ -# CMakeLists.txt -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 1998 Gerald Combs -# -# SPDX-License-Identifier: GPL-2.0-or-later -# - -set(WMEM_PUBLIC_HEADERS - wmem.h - wmem_array.h - wmem_core.h - wmem_list.h - wmem_map.h - wmem_miscutl.h - wmem_multimap.h - wmem_queue.h - wmem_stack.h - wmem_strbuf.h - wmem_strutl.h - wmem_tree.h - wmem_interval_tree.h - wmem_user_cb.h -) - -set(WMEM_HEADER_FILES - ${WMEM_PUBLIC_HEADERS} - wmem_allocator.h - wmem_allocator_block.h - wmem_allocator_block_fast.h - wmem_allocator_simple.h - wmem_allocator_strict.h - wmem_interval_tree.h - wmem_map_int.h - wmem_tree-int.h - wmem_user_cb_int.h -) - -set(WMEM_FILES - wmem_array.c - wmem_core.c - wmem_allocator_block.c - wmem_allocator_block_fast.c - wmem_allocator_simple.c - wmem_allocator_strict.c - wmem_interval_tree.c - wmem_list.c - wmem_map.c - wmem_miscutl.c - wmem_multimap.c - wmem_stack.c - wmem_strbuf.c - wmem_strutl.c - wmem_tree.c - wmem_user_cb.c -) -source_group(wmem FILES ${WMEM_FILES}) - -set_source_files_properties( - ${WMEM_FILES} - PROPERTIES - COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" -) - -add_library(wmem OBJECT - #Included so that Visual Studio can properly put header files in solution - ${WMEM_HEADER_FILES} - - ${WMEM_FILES} -) - -target_include_directories(wmem - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set_target_properties(wmem PROPERTIES - FOLDER "Libs/wsutil/wmem" - COMPILE_DEFINITIONS "WS_BUILD_DLL" -) - -add_executable(wmem_test EXCLUDE_FROM_ALL wmem_test.c $) - -target_link_libraries(wmem_test wsutil) - -set_target_properties(wmem_test PROPERTIES - FOLDER "Tests" - EXCLUDE_FROM_DEFAULT_BUILD True - COMPILE_DEFINITIONS "WS_BUILD_DLL" - COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" -) - -install(FILES ${WMEM_PUBLIC_HEADERS} - DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil/wmem" - COMPONENT "Development" - EXCLUDE_FROM_ALL -) - -CHECKAPI( - NAME - wmem - SWITCHES - SOURCES - ${WMEM_FILES} -) - -# -# Editor modelines - https://www.wireshark.org/tools/modelines.html -# -# Local variables: -# c-basic-offset: 8 -# tab-width: 8 -# indent-tabs-mode: t -# End: -# -# vi: set shiftwidth=8 tabstop=8 noexpandtab: -# :indentSize=8:tabSize=8:noTabs=false: -#