Skip to content

Commit

Permalink
Move version_info.[ch] to ui/
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
randstr authored and Wireshark GitLab Utility committed Jul 4, 2021
1 parent 47d2afd commit 1008763
Show file tree
Hide file tree
Showing 31 changed files with 61 additions and 72 deletions.
49 changes: 14 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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}"
)
Expand All @@ -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}
)
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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}
)
Expand All @@ -2644,15 +2627,14 @@ 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}
)
set(rawshark_FILES
$<TARGET_OBJECTS:cli_main>
$<TARGET_OBJECTS:shark_common>
$<TARGET_OBJECTS:version_info>
rawshark.c
)
set_executable_resources(rawshark "Rawshark")
Expand All @@ -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}
Expand All @@ -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
Expand All @@ -2699,7 +2680,7 @@ if(BUILD_dftest)
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
)
set(dftest_FILES
dftest.c
Expand All @@ -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})
Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -2862,6 +2842,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
wsutil
caputils
ui
version_info
pcap::pcap
${CAP_LIBRARIES}
${GLIB2_LIBRARIES}
Expand All @@ -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
Expand Down Expand Up @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion capinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion captype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion dumpcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion editcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion extcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
3 changes: 1 addition & 2 deletions fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set(fuzzshark_LIBS
ui
wiretap
epan
${VERSION_INFO_LIBS}
version_info
)
if(OSS_FUZZ)
if("$ENV{LIB_FUZZING_ENGINE}" STREQUAL "")
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzzshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion mergecap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion rawshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion reordercap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sharkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion sharkd_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#endif

#include <wsutil/strtoi.h>
#include <version_info.h>
#include <ui/version_info.h>

#include "sharkd.h"

Expand Down
2 changes: 1 addition & 1 deletion sharkd_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion text2pcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Loading

0 comments on commit 1008763

Please sign in to comment.