2009-06-15 18:59:33 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-05-27 06:35:58 +00:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-06-15 18:59:33 +00:00
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-06-15 18:59:33 +00:00
|
|
|
#
|
|
|
|
|
2013-10-15 07:30:05 +00:00
|
|
|
include(UseABICheck)
|
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
set(WSUTIL_COMMON_FILES
|
2014-05-27 06:35:58 +00:00
|
|
|
adler32.c
|
|
|
|
aes.c
|
|
|
|
airpdcap_wep.c
|
2016-10-31 05:10:56 +00:00
|
|
|
base32.c
|
2014-05-27 06:35:58 +00:00
|
|
|
base64.c
|
|
|
|
bitswap.c
|
2014-07-15 23:40:46 +00:00
|
|
|
buffer.c
|
2014-06-29 21:37:21 +00:00
|
|
|
clopts_common.c
|
|
|
|
cmdarg_err.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
|
|
|
|
crc6.c
|
|
|
|
crc7.c
|
|
|
|
crc8.c
|
|
|
|
crc11.c
|
|
|
|
des.c
|
|
|
|
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
|
2014-05-27 06:35:58 +00:00
|
|
|
md4.c
|
|
|
|
md5.c
|
|
|
|
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
|
2014-05-27 06:35:58 +00:00
|
|
|
plugins.c
|
|
|
|
privileges.c
|
|
|
|
sha1.c
|
2016-01-22 15:42:59 +00:00
|
|
|
sha2.c
|
2014-03-18 12:17:28 +00:00
|
|
|
sober128.c
|
2014-05-27 06:35:58 +00:00
|
|
|
strnatcmp.c
|
|
|
|
str_util.c
|
2016-08-30 15:52:54 +00:00
|
|
|
strtoi.c
|
2014-05-27 06:35:58 +00:00
|
|
|
rc4.c
|
|
|
|
report_err.c
|
|
|
|
tempfile.c
|
|
|
|
time_util.c
|
|
|
|
type_util.c
|
|
|
|
unicode-utils.c
|
2014-06-09 20:01:31 +00:00
|
|
|
ws_mempbrk.c
|
2016-09-28 10:01:33 +00:00
|
|
|
wsjsmn.c
|
2009-06-15 18:59:33 +00:00
|
|
|
)
|
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
set(WSUTIL_FILES ${WSUTIL_COMMON_FILES})
|
|
|
|
if(WIN32)
|
|
|
|
list(APPEND WSUTIL_FILES
|
|
|
|
file_util.c
|
|
|
|
inet_ntop.c
|
|
|
|
inet_pton.c
|
2016-06-23 08:43:30 +00:00
|
|
|
win32-utils.c
|
2016-03-11 19:51:39 +00:00
|
|
|
)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
|
2015-11-25 05:46:40 +00:00
|
|
|
if(HAVE_OS_X_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()
|
|
|
|
message(STATUS "Checking for c-compiler flag: -msse4.2")
|
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()
|
|
|
|
message(STATUS "Checking for c-compiler flag: -xarch=sse4_2")
|
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()
|
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_INET_ATON)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES inet_aton.c)
|
2014-12-25 00:13:11 +00:00
|
|
|
endif()
|
|
|
|
|
2014-12-24 23:54:47 +00:00
|
|
|
if(NOT HAVE_POPCOUNT)
|
2016-03-11 19:51:39 +00:00
|
|
|
list(APPEND WSUTIL_FILES popcount.c)
|
2014-12-24 23:54:47 +00:00
|
|
|
endif()
|
|
|
|
|
2014-12-25 00:13:11 +00:00
|
|
|
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)
|
|
|
|
#
|
|
|
|
# We assume that APPLE means OS X so that we have the OS X
|
|
|
|
# frameworks.
|
|
|
|
#
|
|
|
|
FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
|
|
|
|
endif()
|
|
|
|
|
2009-09-23 15:08:32 +00:00
|
|
|
set(wsutil_LIBS
|
2015-10-09 09:31:33 +00:00
|
|
|
${CMAKE_DL_LIBS}
|
2014-06-21 18:01:19 +00:00
|
|
|
${APPLE_CORE_FOUNDATION_LIBRARY}
|
2014-05-27 06:35:58 +00:00
|
|
|
${GMODULE2_LIBRARIES}
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${GCRYPT_LIBRARIES}
|
2016-04-03 04:53:12 +00:00
|
|
|
${ZLIB_LIBRARIES}
|
2014-05-27 06:35:58 +00:00
|
|
|
${WIN_WSOCK32_LIBRARY}
|
2009-09-23 15:08:32 +00:00
|
|
|
)
|
2013-10-13 09:21:55 +00:00
|
|
|
IF(WIN32)
|
2016-08-24 14:48:39 +00:00
|
|
|
set(wsutil_LIBS ${wsutil_LIBS} "iphlpapi.lib" "ws2_32.lib")
|
2013-10-13 09:21:55 +00:00
|
|
|
ENDIF(WIN32)
|
2009-09-23 15:08:32 +00:00
|
|
|
|
2013-07-22 14:43:17 +00:00
|
|
|
set(CLEAN_FILES
|
2014-05-27 06:35:58 +00:00
|
|
|
${WSUTIL_FILES}
|
2013-07-22 14:43:17 +00:00
|
|
|
)
|
|
|
|
|
2016-09-30 14:06:15 +00:00
|
|
|
set_source_files_properties(
|
|
|
|
${CLEAN_FILES}
|
|
|
|
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
|
|
|
|
2009-11-17 11:58:36 +00:00
|
|
|
add_library(wsutil ${LINK_MODE_LIB}
|
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
|
|
|
|
|
|
|
set(FULL_SO_VERSION "0.0.0")
|
|
|
|
|
2014-07-09 13:39:41 +00:00
|
|
|
set_target_properties(wsutil PROPERTIES
|
|
|
|
PREFIX "lib"
|
|
|
|
COMPILE_DEFINITIONS "WS_BUILD_DLL"
|
2016-08-16 21:21:59 +00:00
|
|
|
COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}"
|
2014-07-09 13:39:41 +00:00
|
|
|
LINK_FLAGS "${WS_LINK_FLAGS}"
|
|
|
|
VERSION ${FULL_SO_VERSION} SOVERSION 0
|
2016-06-21 13:30:33 +00:00
|
|
|
FOLDER "DLLs")
|
2009-06-15 18:59:33 +00:00
|
|
|
|
2014-10-10 01:24:18 +00:00
|
|
|
if(ENABLE_APPLICATION_BUNDLE)
|
|
|
|
set_target_properties(wsutil PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-10-15 07:30:05 +00:00
|
|
|
ABICHECK(libwsutil)
|
2013-02-25 18:12:20 +00:00
|
|
|
|
|
|
|
add_custom_command(OUTPUT libwsutil.abi.tar.gz
|
2015-08-16 00:05:17 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
|
|
|
|
COMMAND ${ABI_COPY_COMMAND} ../config.h ${ABICHECK_TMPDIR}/ ${ABI_COPY_FLAGS}
|
|
|
|
COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/ ${ABI_COPY_FLAGS}
|
2013-10-19 15:51:36 +00:00
|
|
|
COMMAND ${ABICHECK_COMMAND}
|
2013-10-19 14:55:12 +00:00
|
|
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwsutil/libwsutil_* ${CMAKE_CURRENT_BINARY_DIR}/libwsutil.abi.tar.gz
|
2015-08-16 00:05:17 +00:00
|
|
|
COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
|
2013-02-25 21:27:07 +00:00
|
|
|
DEPENDS ${HEADERS} wsutil)
|
2013-02-25 18:12:20 +00:00
|
|
|
|
2009-09-23 15:08:32 +00:00
|
|
|
target_link_libraries(wsutil ${wsutil_LIBS})
|
|
|
|
|
2009-11-17 11:58:36 +00:00
|
|
|
if(NOT ${ENABLE_STATIC})
|
|
|
|
install(TARGETS wsutil
|
2014-05-29 03:58:05 +00:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2009-11-17 11:58:36 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-11-17 02:55:14 +00:00
|
|
|
add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
|
|
|
|
|
2016-03-11 19:51:39 +00:00
|
|
|
CHECKAPI(
|
|
|
|
NAME
|
|
|
|
wsutil
|
|
|
|
SWITCHES
|
|
|
|
-g termoutput -build
|
|
|
|
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
|
|
|
#
|
|
|
|
# Editor modelines - http://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:
|
|
|
|
#
|