3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 set(WSUTIL_PLATFORM_FILES
76 ${WSUTIL_PLATFORM_FILES}
80 # XXX - we're assuming MSVC supports the SSE 4.2 intrinsics and
81 # that other C compilers support them iff they support the
84 # Perhaps we should check whether we can compile something
85 # that uses them, instead, and do something else to figure
86 # out what compiler flag, if any, we need to pass to the
87 # compiler to compile code that uses them.
89 if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
93 message(STATUS "Checking for c-compiler flag: -msse4.2")
94 check_c_compiler_flag(-msse4.2 HAVE_SSE4_2)
96 set(SSE4_2_FLAG "-msse4.2")
101 # Make sure we have the necessary header for the SSE4.2 intrinsics
102 # and that we can use it.
106 # Does this add the SSE4.2 flags to the beginning of CFLAGS?
108 cmake_push_check_state()
109 set(CMAKE_REQUIRED_FLAGS "${SSE4_2_FLAG}")
110 check_include_file("nmmintrin.h" CAN_USE_SSE4_2)
111 cmake_pop_check_state()
112 if(NOT CAN_USE_SSE4_2)
114 # OK, it's not working for some reason, perhaps because
115 # ${SSE4_2_FLAG} above didn't enable SSE 4.2 support.
117 set(HAVE_SSE4_2 FALSE)
121 set(WSUTIL_FILES ${WSUTIL_FILES} ws_mempbrk_sse42.c)
124 if(NOT HAVE_GETOPT_LONG)
125 set(WSUTIL_FILES ${WSUTIL_FILES} wsgetopt.c)
128 if(NOT HAVE_INET_ATON)
129 set(WSUTIL_FILES ${WSUTIL_FILES} inet_aton.c)
132 if(NOT HAVE_POPCOUNT)
133 set(WSUTIL_FILES ${WSUTIL_FILES} popcount.c)
136 if(NOT HAVE_STRPTIME)
137 set(WSUTIL_FILES ${WSUTIL_FILES} strptime.c)
142 # We assume that APPLE means OS X so that we have the OS X
145 FIND_LIBRARY (APPLE_CORE_FOUNDATION_LIBRARY CoreFoundation)
149 ${APPLE_CORE_FOUNDATION_LIBRARY}
150 ${GMODULE2_LIBRARIES}
153 ${WIN_WSOCK32_LIBRARY}
156 set(wsutil_LIBS ${wsutil_LIBS} "ws2_32.lib")
164 set_source_files_properties(
167 COMPILE_FLAGS -Werror
171 # Set the property to an empty string, so that if we try
172 # to get it below, it succeeds.
174 set_source_files_properties(
181 get_source_file_property(
182 WS_MEMPBRK_SSE42_COMPILE_FLAGS
186 set_source_files_properties(
189 COMPILE_FLAGS "${WS_MEMPBRK_SSE42_COMPILE_FLAGS} ${SSE4_2_FLAG}"
193 add_library(wsutil ${LINK_MODE_LIB}
195 ${CMAKE_BINARY_DIR}/image/libwsutil.rc
198 add_dependencies(wsutil gitversion)
200 set(FULL_SO_VERSION "0.0.0")
202 set_target_properties(wsutil PROPERTIES
204 COMPILE_DEFINITIONS "WS_BUILD_DLL"
205 LINK_FLAGS "${WS_LINK_FLAGS}"
206 VERSION ${FULL_SO_VERSION} SOVERSION 0
209 if(ENABLE_APPLICATION_BUNDLE)
210 set_target_properties(wsutil PROPERTIES
211 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
217 add_custom_command(OUTPUT libwsutil.abi.tar.gz
218 COMMAND cp ../config.h ${ABICHECK_TMPDIR}/
219 COMMAND ${ABICHECK_COMMAND}
220 COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwsutil/libwsutil_* ${CMAKE_CURRENT_BINARY_DIR}/libwsutil.abi.tar.gz
221 COMMAND rm -rf ${ABICHECK_TMPDIR}/* ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
222 DEPENDS ${HEADERS} wsutil)
224 target_link_libraries(wsutil ${wsutil_LIBS})
226 if(NOT ${ENABLE_STATIC})
227 install(TARGETS wsutil
228 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
229 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
230 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
234 add_definitions( -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" )
237 # Editor modelines - http://www.wireshark.org/tools/modelines.html
242 # indent-tabs-mode: t
245 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
246 # :indentSize=8:tabSize=8:noTabs=false: