2009-06-15 18:59:33 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
2018-03-07 14:28:51 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2009-06-15 18:59:33 +00:00
|
|
|
#
|
|
|
|
|
2018-08-21 21:23:46 +00:00
|
|
|
add_definitions(-DPLUGIN_DIR=\"${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_LIBDIR}\")
|
|
|
|
add_definitions(-DEXTCAP_DIR=\"${CMAKE_INSTALL_PREFIX}/${EXTCAP_INSTALL_LIBDIR}\")
|
2018-12-04 01:46:01 +00:00
|
|
|
add_definitions(-DDATA_DIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}\")
|
2017-09-12 09:51:46 +00:00
|
|
|
|
2017-09-02 23:42:00 +00:00
|
|
|
set(WSUTIL_PUBLIC_HEADERS
|
|
|
|
adler32.h
|
|
|
|
base32.h
|
|
|
|
bits_count_ones.h
|
|
|
|
bits_ctz.h
|
|
|
|
bitswap.h
|
|
|
|
buffer.h
|
2019-02-03 02:15:13 +00:00
|
|
|
codecs.h
|
2017-09-02 23:42:00 +00:00
|
|
|
color.h
|
|
|
|
copyright_info.h
|
|
|
|
cpu_info.h
|
|
|
|
crash_info.h
|
2019-07-23 14:15:51 +00:00
|
|
|
crc5.h
|
2017-09-02 23:42:00 +00:00
|
|
|
crc6.h
|
|
|
|
crc7.h
|
|
|
|
crc8.h
|
|
|
|
crc10.h
|
|
|
|
crc11.h
|
|
|
|
crc16.h
|
|
|
|
crc16-plain.h
|
|
|
|
crc32.h
|
2018-07-30 16:18:40 +00:00
|
|
|
curve25519.h
|
2017-09-02 23:42:00 +00:00
|
|
|
eax.h
|
2020-01-21 22:26:38 +00:00
|
|
|
epochs.h
|
2017-09-02 23:42:00 +00:00
|
|
|
filesystem.h
|
|
|
|
frequency-utils.h
|
|
|
|
g711.h
|
|
|
|
inet_addr.h
|
2018-04-22 14:29:04 +00:00
|
|
|
inet_ipv4.h
|
2017-09-02 23:42:00 +00:00
|
|
|
inet_ipv6.h
|
|
|
|
interface.h
|
|
|
|
jsmn.h
|
2018-11-20 01:47:36 +00:00
|
|
|
json_dumper.h
|
2017-09-02 23:42:00 +00:00
|
|
|
mpeg-audio.h
|
2018-05-21 16:45:44 +00:00
|
|
|
netlink.h
|
2017-09-02 23:42:00 +00:00
|
|
|
nstime.h
|
|
|
|
os_version_info.h
|
|
|
|
pint.h
|
2019-03-24 04:02:47 +00:00
|
|
|
please_report_bug.h
|
2017-09-02 23:42:00 +00:00
|
|
|
plugins.h
|
2018-02-20 05:27:03 +00:00
|
|
|
pow2.h
|
2017-09-02 23:42:00 +00:00
|
|
|
privileges.h
|
|
|
|
processes.h
|
|
|
|
report_message.h
|
|
|
|
sign_ext.h
|
|
|
|
sober128.h
|
|
|
|
socket.h
|
|
|
|
str_util.h
|
|
|
|
strnatcmp.h
|
|
|
|
strtoi.h
|
|
|
|
tempfile.h
|
|
|
|
time_util.h
|
|
|
|
type_util.h
|
|
|
|
unicode-utils.h
|
|
|
|
utf8_entities.h
|
|
|
|
ws_cpuid.h
|
|
|
|
ws_mempbrk.h
|
|
|
|
ws_mempbrk_int.h
|
Put special pipe-handling code into libwsutil.
Ask, in a comment, why we're doing PeekNamedPipe() when we're trying
to read everyting in the pipe, up to the EOF, into a string.
On UN*X, do the same "read up to an EOF and then NUL-terminate the
result" stuff that we did on Windows; nothing guarantees that, on all
UN*Xes, in all circumstances, until the end of time, world without end,
amen, we can do one read and get the entire string.
Change-Id: I578802b23fec1051139eaefd9a09fe2a6de06a11
Reviewed-on: https://code.wireshark.org/review/24959
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-23 08:05:21 +00:00
|
|
|
ws_pipe.h
|
2017-09-02 23:42:00 +00:00
|
|
|
ws_printf.h
|
2018-04-20 14:55:00 +00:00
|
|
|
wsjson.h
|
2017-09-02 23:42:00 +00:00
|
|
|
xtea.h
|
|
|
|
)
|
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
set(WSUTIL_COMMON_FILES
|
2014-05-27 06:35:58 +00:00
|
|
|
adler32.c
|
2016-10-31 05:10:56 +00:00
|
|
|
base32.c
|
2014-05-27 06:35:58 +00:00
|
|
|
bitswap.c
|
2014-07-15 23:40:46 +00:00
|
|
|
buffer.c
|
2019-02-03 02:15:13 +00:00
|
|
|
codecs.c
|
2014-06-21 17:32:12 +00:00
|
|
|
copyright_info.c
|
2014-05-27 06:35:58 +00:00
|
|
|
crash_info.c
|
|
|
|
crc10.c
|
|
|
|
crc16.c
|
|
|
|
crc16-plain.c
|
|
|
|
crc32.c
|
2019-07-23 14:15:51 +00:00
|
|
|
crc5.c
|
2014-05-27 06:35:58 +00:00
|
|
|
crc6.c
|
|
|
|
crc7.c
|
|
|
|
crc8.c
|
|
|
|
crc11.c
|
2018-07-30 16:18:40 +00:00
|
|
|
curve25519.c
|
2018-02-23 17:43:29 +00:00
|
|
|
dot11decrypt_wep.c
|
2014-05-27 06:35:58 +00:00
|
|
|
eax.c
|
|
|
|
filesystem.c
|
2015-06-11 22:05:44 +00:00
|
|
|
frequency-utils.c
|
2014-05-27 06:35:58 +00:00
|
|
|
g711.c
|
2016-02-10 09:11:12 +00:00
|
|
|
inet_addr.c
|
2016-02-23 13:33:54 +00:00
|
|
|
interface.c
|
2015-01-19 18:54:41 +00:00
|
|
|
jsmn.c
|
2018-11-20 01:47:36 +00:00
|
|
|
json_dumper.c
|
2014-05-27 06:35:58 +00:00
|
|
|
mpeg-audio.c
|
|
|
|
nstime.c
|
2016-09-22 11:23:37 +00:00
|
|
|
cpu_info.c
|
2014-06-21 18:01:19 +00:00
|
|
|
os_version_info.c
|
2019-03-24 04:02:47 +00:00
|
|
|
please_report_bug.c
|
2014-05-27 06:35:58 +00:00
|
|
|
privileges.c
|
2017-04-26 05:33:25 +00:00
|
|
|
rsa.c
|
2014-03-18 12:17:28 +00:00
|
|
|
sober128.c
|
2019-05-02 01:46:23 +00:00
|
|
|
socket.c
|
2014-05-27 06:35:58 +00:00
|
|
|
strnatcmp.c
|
|
|
|
str_util.c
|
2016-08-30 15:52:54 +00:00
|
|
|
strtoi.c
|
2017-04-08 19:45:19 +00:00
|
|
|
report_message.c
|
2014-05-27 06:35:58 +00:00
|
|
|
tempfile.c
|
|
|
|
time_util.c
|
|
|
|
type_util.c
|
|
|
|
unicode-utils.c
|
2014-06-09 20:01:31 +00:00
|
|
|
ws_mempbrk.c
|
Put special pipe-handling code into libwsutil.
Ask, in a comment, why we're doing PeekNamedPipe() when we're trying
to read everyting in the pipe, up to the EOF, into a string.
On UN*X, do the same "read up to an EOF and then NUL-terminate the
result" stuff that we did on Windows; nothing guarantees that, on all
UN*Xes, in all circumstances, until the end of time, world without end,
amen, we can do one read and get the entire string.
Change-Id: I578802b23fec1051139eaefd9a09fe2a6de06a11
Reviewed-on: https://code.wireshark.org/review/24959
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-23 08:05:21 +00:00
|
|
|
ws_pipe.c
|
2017-02-13 18:31:26 +00:00
|
|
|
wsgcrypt.c
|
2018-04-20 14:55:00 +00:00
|
|
|
wsjson.c
|
2017-07-30 15:05:02 +00:00
|
|
|
xtea.c
|
2009-06-15 18:59:33 +00:00
|
|
|
)
|
|
|
|
|
2018-01-28 17:40:52 +00:00
|
|
|
if(ENABLE_PLUGINS)
|
|
|
|
list(APPEND WSUTIL_COMMON_FILES
|
|
|
|
plugins.c
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
set(WSUTIL_FILES ${WSUTIL_COMMON_FILES})
|
|
|
|
if(WIN32)
|
|
|
|
list(APPEND WSUTIL_FILES
|
|
|
|
file_util.c
|
2016-06-23 08:43:30 +00:00
|
|
|
win32-utils.c
|
2016-03-11 19:51:39 +00:00
|
|
|
)
|
2018-01-28 17:40:52 +00:00
|
|
|
endif(WIN32)
|
2016-03-11 19:51:39 +00:00
|
|
|
|
|
|
|
|
2017-06-16 08:49:44 +00:00
|
|
|
if(HAVE_MACOS_FRAMEWORKS)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES cfutils.c)
|
2015-11-25 05:46:40 +00:00
|
|
|
endif()
|
|
|
|
|
2015-01-21 02:44:17 +00:00
|
|
|
#
|
2015-01-21 07:27:08 +00:00
|
|
|
# XXX - we're assuming MSVC doesn't require a flag to enable SSE 4.2
|
|
|
|
# support, and that, if the compiler supports a flag for SSE 4.2
|
|
|
|
# support, the intrinsics are supported iff we can include the
|
|
|
|
# <nmmintrin.h> flag.
|
2015-01-21 02:44:17 +00:00
|
|
|
#
|
2015-01-21 07:27:08 +00:00
|
|
|
# We only check for the GCC-style -msse4.2 flag and the Sun C
|
|
|
|
# -xarch=sse4_2 flag.
|
2015-01-21 02:44:17 +00:00
|
|
|
#
|
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
2015-02-11 22:19:57 +00:00
|
|
|
set(COMPILER_CAN_HANDLE_SSE4_2 TRUE)
|
2015-01-21 03:17:36 +00:00
|
|
|
set(SSE4_2_FLAG "")
|
2015-01-21 02:44:17 +00:00
|
|
|
else()
|
2015-02-11 22:19:57 +00:00
|
|
|
check_c_compiler_flag(-msse4.2 COMPILER_CAN_HANDLE_SSE4_2)
|
|
|
|
if(COMPILER_CAN_HANDLE_SSE4_2)
|
2015-01-21 04:32:27 +00:00
|
|
|
set(SSE4_2_FLAG "-msse4.2")
|
2015-01-21 07:27:08 +00:00
|
|
|
else()
|
2015-02-11 22:19:57 +00:00
|
|
|
check_c_compiler_flag(-xarch=sse4_2 COMPILER_CAN_HANDLE_SSE4_2)
|
|
|
|
if(COMPILER_CAN_HANDLE_SSE4_2)
|
2015-01-21 07:27:08 +00:00
|
|
|
set(SSE4_2_FLAG "-xarch=sse4_2")
|
|
|
|
endif()
|
2015-01-21 04:32:27 +00:00
|
|
|
endif()
|
2020-10-19 15:28:36 +00:00
|
|
|
if(SSE4_2_FLAG)
|
|
|
|
message(STATUS "SSE4.2 compiler flag: ${SSE4_2_FLAG}")
|
|
|
|
else()
|
|
|
|
message(STATUS "No SSE4.2 compiler flag enabled")
|
|
|
|
endif()
|
2015-01-21 03:17:36 +00:00
|
|
|
endif()
|
2015-02-11 22:19:57 +00:00
|
|
|
if(COMPILER_CAN_HANDLE_SSE4_2)
|
2015-01-21 03:17:36 +00:00
|
|
|
#
|
2015-02-19 01:16:04 +00:00
|
|
|
# Make sure we have the necessary headers for the SSE4.2 intrinsics
|
|
|
|
# and that we can use them.
|
2015-01-21 03:17:36 +00:00
|
|
|
#
|
2015-02-19 01:16:04 +00:00
|
|
|
# First, check whether we have emmintrin.h and can use it
|
|
|
|
# *without* the SSE 4.2 flag.
|
2015-01-21 03:17:36 +00:00
|
|
|
#
|
2015-02-19 01:16:04 +00:00
|
|
|
check_include_file("emmintrin.h" EMMINTRIN_H_WORKS)
|
|
|
|
|
2015-01-21 03:17:36 +00:00
|
|
|
#
|
2015-02-19 01:16:04 +00:00
|
|
|
# OK, if that works, see whether we have nmmintrin.h and
|
|
|
|
# can use it *with* the SSE 4.2 flag.
|
2015-02-11 22:19:57 +00:00
|
|
|
#
|
2015-02-19 01:16:04 +00:00
|
|
|
if(EMMINTRIN_H_WORKS)
|
|
|
|
#
|
|
|
|
# Does this add the SSE4.2 flags to the beginning of
|
|
|
|
# CFLAGS?
|
|
|
|
#
|
|
|
|
# Note that if there's a mix of "enable SSE 4.2" and
|
|
|
|
# "disable SSE 4.2" flags, this may not indicate that
|
|
|
|
# we can use the header. That's not a bug, that's a
|
|
|
|
# feature; the other flags may have been forced by
|
|
|
|
# the build process, e.g. in Gentoo Linux, and we want
|
|
|
|
# to check this with whatever flags will actually be
|
|
|
|
# used when building (see bug 10792).
|
|
|
|
#
|
|
|
|
cmake_push_check_state()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${SSE4_2_FLAG}")
|
|
|
|
check_include_file("nmmintrin.h" HAVE_SSE4_2)
|
|
|
|
cmake_pop_check_state()
|
|
|
|
endif()
|
2015-01-21 02:44:17 +00:00
|
|
|
endif()
|
2014-12-24 23:54:47 +00:00
|
|
|
if(HAVE_SSE4_2)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES ws_mempbrk_sse42.c)
|
2014-12-24 23:54:47 +00:00
|
|
|
endif()
|
|
|
|
|
2014-12-25 01:10:40 +00:00
|
|
|
if(NOT HAVE_GETOPT_LONG)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES getopt_long.c)
|
2014-12-25 00:13:11 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT HAVE_STRPTIME)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES strptime.c)
|
2014-12-25 00:13:11 +00:00
|
|
|
endif()
|
|
|
|
|
2014-06-24 07:07:38 +00:00
|
|
|
if(APPLE)
|
|
|
|
#
|
2017-04-05 19:15:27 +00:00
|
|
|
# We assume that APPLE means macOS so that we have the macOS
|
2014-06-24 07:07:38 +00:00
|
|
|
# frameworks.
|
|
|
|
#
|
|
|
|
FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
|
|
|
|
endif()
|
|
|
|
|
2016-09-30 14:06:15 +00:00
|
|
|
set_source_files_properties(
|
2018-02-17 02:22:31 +00:00
|
|
|
${WSUTIL_FILES}
|
2016-09-30 14:06:15 +00:00
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
|
|
|
|
)
|
2014-06-13 15:59:02 +00:00
|
|
|
if (HAVE_SSE4_2)
|
2016-09-30 14:06:15 +00:00
|
|
|
# TODO with CMake 2.8.12, we could use COMPILE_OPTIONS and just append
|
|
|
|
# instead of this COMPILE_FLAGS duplication...
|
2015-01-21 03:17:36 +00:00
|
|
|
set_source_files_properties(
|
|
|
|
ws_mempbrk_sse42.c
|
|
|
|
PROPERTIES
|
2016-09-30 14:06:15 +00:00
|
|
|
COMPILE_FLAGS "${WERROR_COMMON_FLAGS} ${SSE4_2_FLAG}"
|
2015-01-21 03:17:36 +00:00
|
|
|
)
|
2014-06-13 15:59:02 +00:00
|
|
|
endif()
|
2013-07-22 14:43:17 +00:00
|
|
|
|
2017-11-01 20:22:32 +00:00
|
|
|
add_library(wsutil
|
2014-05-27 06:35:58 +00:00
|
|
|
${WSUTIL_FILES}
|
2015-01-10 21:29:57 +00:00
|
|
|
${CMAKE_BINARY_DIR}/image/libwsutil.rc
|
2009-06-15 18:59:33 +00:00
|
|
|
)
|
2013-02-25 18:12:20 +00:00
|
|
|
|
2014-07-09 13:39:41 +00:00
|
|
|
set_target_properties(wsutil PROPERTIES
|
|
|
|
PREFIX "lib"
|
|
|
|
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
|
|
|
LINK_FLAGS "${WS_LINK_FLAGS}"
|
2018-06-06 19:01:44 +00:00
|
|
|
VERSION "0.0.0" SOVERSION 0
|
2017-09-24 01:30:08 +00:00
|
|
|
FOLDER "DLLs"
|
2019-01-21 10:56:57 +00:00
|
|
|
INSTALL_RPATH "${LIBRARY_INSTALL_RPATH}"
|
2017-09-24 01:30:08 +00:00
|
|
|
)
|
2009-06-15 18:59:33 +00:00
|
|
|
|
2018-11-27 19:37:33 +00:00
|
|
|
target_link_libraries(wsutil
|
|
|
|
PUBLIC
|
|
|
|
${CMAKE_DL_LIBS}
|
|
|
|
${APPLE_CORE_FOUNDATION_LIBRARY}
|
|
|
|
${GMODULE2_LIBRARIES}
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${GCRYPT_LIBRARIES}
|
2019-04-30 22:48:06 +00:00
|
|
|
${WIN_WS2_32_LIBRARY}
|
2018-11-27 19:37:33 +00:00
|
|
|
${GNUTLS_LIBRARIES}
|
2019-07-30 12:13:04 +00:00
|
|
|
${M_LIBRARIES}
|
2018-11-27 19:37:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_link_libraries(wsutil PRIVATE "iphlpapi.lib" "ws2_32.lib")
|
|
|
|
endif(WIN32)
|
2009-09-23 15:08:32 +00:00
|
|
|
|
2019-01-10 01:45:00 +00:00
|
|
|
target_include_directories(wsutil SYSTEM
|
|
|
|
PUBLIC
|
|
|
|
${GCRYPT_INCLUDE_DIRS}
|
|
|
|
${GNUTLS_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2017-11-01 20:22:32 +00:00
|
|
|
install(TARGETS wsutil
|
2018-08-23 21:03:28 +00:00
|
|
|
EXPORT WiresharkTargets
|
2018-11-26 02:08:59 +00:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2017-11-01 20:22:32 +00:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
)
|
2009-11-17 11:58:36 +00:00
|
|
|
|
2018-11-23 20:39:48 +00:00
|
|
|
install(FILES ${WSUTIL_PUBLIC_HEADERS}
|
2019-02-01 16:25:24 +00:00
|
|
|
DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil"
|
2018-11-23 20:39:48 +00:00
|
|
|
)
|
2017-09-02 23:42:00 +00:00
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
CHECKAPI(
|
|
|
|
NAME
|
|
|
|
wsutil
|
|
|
|
SWITCHES
|
2020-09-04 22:15:05 +00:00
|
|
|
--group termoutput:2 --summary-group termoutput
|
2016-03-11 19:51:39 +00:00
|
|
|
SOURCES
|
|
|
|
${WSUTIL_COMMON_FILES}
|
|
|
|
)
|
|
|
|
|
2016-09-28 10:01:33 +00:00
|
|
|
set_source_files_properties(jsmn.c PROPERTIES COMPILE_DEFINITIONS "JSMN_STRICT")
|
|
|
|
|
2013-11-17 02:55:14 +00:00
|
|
|
#
|
2019-07-26 18:43:17 +00:00
|
|
|
# Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2013-11-17 02:55:14 +00:00
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|