Move version_info.[ch] to ui/

Version info is an aspect of UI implementation so move it to
a more appropriate place, such as ui/. This also helps declutter
the top-level.

A static library is appropriate to encapsulate the dependencies
as private and it is better supported by CMake than object libraries.

Also version_info.h should not be installed as a public header.
This commit is contained in:
João Valverde 2021-07-03 12:58:30 +01:00 committed by Wireshark GitLab Utility
parent 47d2afd990
commit 100876337a
31 changed files with 61 additions and 72 deletions

View File

@ -1936,13 +1936,6 @@ if(NOT WIN32)
list(APPEND INSTALL_FILES COPYING)
endif()
set(VERSION_INFO_LIBS
${ZLIB_LIBRARIES}
)
set(VERSION_INFO_INCLUDE_DIRS
${ZLIB_INCLUDE_DIRS}
)
if(WIN32)
set(_dll_output_dir "${DATAFILE_DIR}")
add_custom_target(copy_cli_dlls)
@ -2331,13 +2324,6 @@ list(APPEND copy_data_files_depends
add_custom_target(copy_data_files ALL DEPENDS ${copy_data_files_depends} )
set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
# Shared code, build object files once for all users.
add_library(version_info OBJECT version_info.c)
target_include_directories(version_info SYSTEM PRIVATE ${VERSION_INFO_INCLUDE_DIRS})
if(NOT VCSVERSION_OVERRIDE)
add_dependencies(version_info version)
endif()
# sources common for wireshark, tshark, rawshark and sharkd
add_library(shark_common OBJECT
cfile.c
@ -2350,7 +2336,7 @@ add_library(shark_common OBJECT
add_library(cli_main OBJECT cli_main.c)
add_library(capture_opts OBJECT capture_opts.c)
target_include_directories(capture_opts SYSTEM PRIVATE ${PCAP_INCLUDE_DIRS})
set_target_properties(version_info shark_common cli_main capture_opts
set_target_properties(shark_common cli_main capture_opts
PROPERTIES
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
@ -2366,7 +2352,6 @@ if(BUILD_wireshark AND QT_FOUND)
$<TARGET_OBJECTS:capture_opts>
$<TARGET_OBJECTS:qtui>
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
${WIRESHARK_SRC}
${PLATFORM_UI_RC_FILES}
)
@ -2451,8 +2436,8 @@ if(BUILD_wireshark AND QT_FOUND)
caputils
wiretap
epan
version_info
${QT_LIBRARIES}
${VERSION_INFO_LIBS}
${APPLE_APPLICATION_SERVICES_LIBRARY}
${APPLE_APPKIT_LIBRARY}
${APPLE_CORE_FOUNDATION_LIBRARY}
@ -2591,7 +2576,7 @@ if(BUILD_tshark)
caputils
wiretap
epan
${VERSION_INFO_LIBS}
version_info
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
${WIN_WS2_32_LIBRARY}
@ -2601,7 +2586,6 @@ if(BUILD_tshark)
$<TARGET_OBJECTS:capture_opts>
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
tshark-tap-register.c
tshark.c
${TSHARK_TAP_SRC}
@ -2620,14 +2604,13 @@ if(BUILD_tfshark)
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
)
set(tfshark_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
tfshark.c
${TSHARK_TAP_SRC}
)
@ -2644,7 +2627,7 @@ if(BUILD_rawshark AND PCAP_FOUND)
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
${WIN_WS2_32_LIBRARY}
@ -2652,7 +2635,6 @@ if(BUILD_rawshark AND PCAP_FOUND)
set(rawshark_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
rawshark.c
)
set_executable_resources(rawshark "Rawshark")
@ -2667,7 +2649,7 @@ if(BUILD_sharkd)
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
${WIN_WS2_32_LIBRARY}
@ -2680,7 +2662,6 @@ if(BUILD_sharkd)
# $<TARGET_OBJECTS:cli_main> and has real_main().
#
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
sharkd.c
sharkd_daemon.c
sharkd_session.c
@ -2699,7 +2680,7 @@ if(BUILD_dftest)
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
)
set(dftest_FILES
dftest.c
@ -2721,7 +2702,6 @@ if(BUILD_randpkt)
)
set(randpkt_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
randpkt.c
)
add_executable(randpkt ${randpkt_FILES})
@ -2738,12 +2718,12 @@ if(BUILD_text2pcap)
set(text2pcap_LIBS
writecap
wsutil
version_info
${M_LIBRARIES}
${ZLIB_LIBRARIES}
)
set(text2pcap_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
text2pcap.c
)
add_lex_files(text2pcap_LEX_FILES text2pcap_FILES
@ -2761,12 +2741,12 @@ if(BUILD_mergecap)
set(mergecap_LIBS
ui
wiretap
version_info
${ZLIB_LIBRARIES}
${CMAKE_DL_LIBS}
)
set(mergecap_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
mergecap.c
)
set_executable_resources(mergecap "Mergecap")
@ -2780,12 +2760,12 @@ if(BUILD_reordercap)
set(reordercap_LIBS
ui
wiretap
version_info
${ZLIB_LIBRARIES}
${CMAKE_DL_LIBS}
)
set(reordercap_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
reordercap.c
)
set_executable_resources(reordercap "Reordercap")
@ -2800,13 +2780,13 @@ if(BUILD_capinfos)
ui
wiretap
wsutil
version_info
${ZLIB_LIBRARIES}
${GCRYPT_LIBRARIES}
${CMAKE_DL_LIBS}
)
set(capinfos_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
capinfos.c
)
set_executable_resources(capinfos "Capinfos")
@ -2821,12 +2801,12 @@ if(BUILD_captype)
ui
wiretap
wsutil
version_info
${ZLIB_LIBRARIES}
${CMAKE_DL_LIBS}
)
set(captype_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
captype.c
)
set_executable_resources(captype "Captype")
@ -2840,13 +2820,13 @@ if(BUILD_editcap)
set(editcap_LIBS
ui
wiretap
version_info
${ZLIB_LIBRARIES}
${GCRYPT_LIBRARIES}
${CMAKE_DL_LIBS}
)
set(editcap_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
editcap.c
)
set_executable_resources(editcap "Editcap")
@ -2862,6 +2842,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
wsutil
caputils
ui
version_info
pcap::pcap
${CAP_LIBRARIES}
${GLIB2_LIBRARIES}
@ -2874,7 +2855,6 @@ if(BUILD_dumpcap AND PCAP_FOUND)
set(dumpcap_FILES
$<TARGET_OBJECTS:capture_opts>
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:version_info>
dumpcap.c
ringbuffer.c
sync_pipe_write.c
@ -3394,7 +3374,6 @@ set(SHARK_PUBLIC_HEADERS
ws_diag_control.h
ws_log_defs.h
ws_symbol_export.h
version_info.h
${CMAKE_BINARY_DIR}/ws_version.h
)

View File

@ -73,7 +73,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/wtap_opttypes.h>
#ifdef HAVE_PLUGINS

View File

@ -42,7 +42,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>

View File

@ -45,7 +45,7 @@
#include <ui/cmdarg_err.h>
#include <wsutil/strtoi.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wsutil/socket.h>
#include <wsutil/wslog.h>

View File

@ -80,7 +80,7 @@
#include <wsutil/strnatcmp.h>
#include <wsutil/str_util.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wsutil/pint.h>
#include <wsutil/strtoi.h>
#include <wsutil/ws_assert.h>

View File

@ -49,7 +49,7 @@
#include "extcap.h"
#include "extcap_parser.h"
#include "version_info.h"
#include "ui/version_info.h"
static void extcap_child_watch_cb(GPid pid, gint status, gpointer user_data);

2
file.c
View File

@ -24,7 +24,7 @@
#include <wsutil/json_dumper.h>
#include <wsutil/wslog.h>
#include <wsutil/ws_assert.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/merge.h>

View File

@ -30,7 +30,7 @@ set(fuzzshark_LIBS
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
)
if(OSS_FUZZ)
if("$ENV{LIB_FUZZING_ENGINE}" STREQUAL "")
@ -40,7 +40,6 @@ if(OSS_FUZZ)
endif()
set(fuzzshark_FILES
fuzzshark.c
$<TARGET_OBJECTS:version_info>
)
set(FUZZ_LINK_FLAGS "${WS_LINK_FLAGS}")
if(ENABLE_FUZZER)

View File

@ -26,7 +26,7 @@
#include <wsutil/privileges.h>
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/wtap.h>

View File

@ -45,7 +45,7 @@
#include <wsutil/wslog.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>

View File

@ -91,7 +91,7 @@
#include <wiretap/pcap-encap.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include "capture/capture-pcap-util.h"

View File

@ -36,7 +36,7 @@
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/wtap_opttypes.h>
#ifdef HAVE_PLUGINS

View File

@ -30,7 +30,7 @@
#include <wsutil/privileges.h>
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/wtap_opttypes.h>
#include <epan/decode_as.h>

View File

@ -49,7 +49,7 @@
#endif
#include <wsutil/strtoi.h>
#include <version_info.h>
#include <ui/version_info.h>
#include "sharkd.h"

View File

@ -53,7 +53,7 @@
#include <ui/rtp_stream.h>
#include <ui/tap-rtp-common.h>
#include <ui/tap-rtp-analysis.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <epan/to_str.h>
#include <epan/addr_resolv.h>

View File

@ -101,7 +101,7 @@
#include <string.h>
#include <wsutil/file_util.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wsutil/inet_addr.h>
#include <wsutil/wslog.h>

View File

@ -50,7 +50,7 @@
#include <wsutil/wslog.h>
#include <wsutil/ws_assert.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include "globals.h"
#include <epan/timestamp.h>

View File

@ -61,7 +61,7 @@
#include <wsutil/wslog.h>
#include <wsutil/ws_assert.h>
#include <cli_main.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <wiretap/wtap_opttypes.h>
#include "globals.h"

View File

@ -78,17 +78,8 @@ set_source_files_properties(
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)
add_library(ui STATIC ${UI_SRC})
set_target_properties(ui PROPERTIES
LINK_FLAGS "${WS_LINK_FLAGS}"
FOLDER "UI"
)
if(MSVC)
set_target_properties(ui PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
endif()
target_link_libraries(ui wsutil caputils)
target_include_directories(ui SYSTEM
@ -96,6 +87,26 @@ target_include_directories(ui SYSTEM
${WINSPARKLE_INCLUDE_DIRS}
)
add_library(version_info STATIC version_info.c)
if(NOT VCSVERSION_OVERRIDE)
add_dependencies(version_info version)
endif()
target_link_libraries(version_info PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(version_info PRIVATE ${ZLIB_INCLUDE_DIRS})
set_target_properties(ui version_info PROPERTIES
LINK_FLAGS "${WS_LINK_FLAGS}"
FOLDER "UI"
)
if(MSVC)
set_target_properties(ui version_info PROPERTIES
LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}"
)
endif()
add_definitions(-DDOC_DIR="${CMAKE_INSTALL_FULL_DOCDIR}")
CHECKAPI(

View File

@ -29,7 +29,7 @@
#include <wsutil/wsgetopt.h>
#endif
#include <version_info.h>
#include <ui/version_info.h>
#include <ui/clopts_common.h>
#include <ui/cmdarg_err.h>

View File

@ -25,7 +25,7 @@
#include "wsutil/filesystem.h"
#include <wsutil/ws_assert.h>
#include "ui/cmdarg_err.h"
#include "version_info.h"
#include "ui/version_info.h"
/* XXX - We might want to switch this to a UAT */

View File

@ -15,7 +15,7 @@
#include "globals.h"
#include "wsutil/os_version_info.h"
#include "wsutil/tempfile.h"
#include "version_info.h"
#include "ui/version_info.h"
#include <epan/tap.h>
#include <epan/exported_pdu.h>

View File

@ -38,7 +38,7 @@
#include "wsutil/tempfile.h"
#include "wsutil/plugins.h"
#include "wsutil/copyright_info.h"
#include "version_info.h"
#include "ui/version_info.h"
#include "extcap.h"

View File

@ -16,7 +16,7 @@
#include "wsutil/str_util.h"
#include "wsutil/utf8_entities.h"
#include "version_info.h"
#include "ui/version_info.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "wireshark_application.h"

View File

@ -33,7 +33,7 @@
#include "wsutil/file_util.h"
#include "wsutil/str_util.h"
#include "version_info.h"
#include "ui/version_info.h"
#include "ws_symbol_export.h"

View File

@ -48,7 +48,7 @@
#include <wsutil/report_message.h>
#include <wsutil/please_report_bug.h>
#include <wsutil/unicode-utils.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <epan/addr_resolv.h>
#include <epan/ex-opt.h>

View File

@ -23,7 +23,7 @@ DIAG_ON(frame-larger-than=)
#include <wsutil/filesystem.h>
#include <wsutil/wslog.h>
#include <wsutil/ws_assert.h>
#include <version_info.h>
#include <ui/version_info.h>
#include <epan/prefs.h>
#include <epan/stats_tree_priv.h>
#include <epan/plugin_if.h>

View File

@ -16,7 +16,7 @@
#include "ui/capture_globals.h"
#include "ui/urls.h"
#include "version_info.h"
#include "ui/version_info.h"
#include "welcome_page.h"
#include <ui_welcome_page.h>

View File

@ -18,7 +18,7 @@
#include <wsutil/os_version_info.h>
#include <wsutil/report_message.h>
#include "version_info.h"
#include "ui/version_info.h"
#include "tap_export_pdu.h"