TLS13: update pre_shared_key lengths for draft -19
[metze/wireshark/wip.git] / epan / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
6 #
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.
11 #
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.
16 #
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.
20 #
21
22 include(UseABICheck)
23
24 if (HAVE_HFI_SECTION_INIT)
25         add_definitions(
26                 -DHAVE_HFI_SECTION_INIT
27         )
28 endif()
29
30 add_subdirectory(crypt)
31 add_subdirectory(dfilter)
32 add_subdirectory(dissectors)
33 add_subdirectory(ftypes)
34 add_subdirectory(wmem)
35 if (HAVE_LIBLUA)
36         add_subdirectory(wslua)
37 endif()
38
39 include_directories(
40         ${CMAKE_CURRENT_BINARY_DIR}
41         ${CMAKE_CURRENT_SOURCE_DIR}
42 )
43
44 set(COMPRESS_FILES
45         compress/lzxpress.c
46 )
47 source_group(compress FILES ${COMPRESS_FILES})
48
49 set(LIBWIRESHARK_ASM_FILES
50         asm_utils.c
51 # todo
52 #       !IFDEF NASM
53 #       asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
54 #               $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
55 #       !ENDIF
56 #       ...
57 #       !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
58 #               asm_utils_win32_x86.obj
59 #       !ELSE
60 #               asm_utils.obj
61 #       !ENDIF
62 )
63
64 add_custom_target(
65         update-sminmpec
66         COMMAND ${PERL_EXECUTABLE}
67                 ${CMAKE_SOURCE_DIR}/tools/make-sminmpec.pl
68         DEPENDS
69                 enterprise-numbers
70                 ${CMAKE_SOURCE_DIR}/tools/make-sminmpec.pl
71 )
72 set_target_properties(update-sminmpec PROPERTIES FOLDER "tools")
73
74 add_custom_command(
75         OUTPUT ps.c
76         COMMAND ${PYTHON_EXECUTABLE}
77                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
78                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
79                 ps.c
80         DEPENDS
81                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
82                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
83 )
84
85 set(LIBWIRESHARK_FILES
86         addr_and_mask.c
87         addr_resolv.c
88         address_types.c
89         afn.c
90         aftypes.c
91         app_mem_usage.c
92         asn1.c
93         capture_dissectors.c
94         charsets.c
95         circuit.c
96         color_filters.c
97         column.c
98         column-utils.c
99         conversation.c
100         conversation_table.c
101         crc10-tvb.c
102         crc16-tvb.c
103         crc32-tvb.c
104         crc6-tvb.c
105         crc8-tvb.c
106         decode_as.c
107         disabled_protos.c
108         dissector_filters.c
109         dvb_chartbl.c
110         dwarf.c
111         epan.c
112         ex-opt.c
113         except.c
114         expert.c
115         export_object.c
116         exported_pdu.c
117         plugin_if.c
118         filter_expressions.c
119         follow.c
120         frame_data.c
121         frame_data_sequence.c
122         funnel.c
123         geoip_db.c
124         golay.c
125         guid-utils.c
126         iana_charsets.c
127         in_cksum.c
128         ipproto.c
129         ipv4.c
130         media_params.c
131         next_tvb.c
132         oids.c
133         osi-utils.c
134         oui.c
135         packet_range.c
136         packet.c
137         print.c
138         print_stream.c
139         prefs.c
140         proto.c
141         proto_data.c
142         ps.c
143         range.c
144         reassemble.c
145         reedsolomon.c
146         req_resp_hdrs.c
147         rtd_table.c
148         show_exception.c
149         sminmpec.c
150         srt_table.c
151         stat_tap_ui.c
152         stats_tree.c
153         strutil.c
154         stream.c
155         t35.c
156         tap.c
157         timestamp.c
158         timestats.c
159         tfs.c
160         to_str.c
161         tvbparse.c
162         tvbuff.c
163         tvbuff_base64.c
164         tvbuff_composite.c
165         tvbuff_real.c
166         tvbuff_subset.c
167         tvbuff_zlib.c
168         uat.c
169         value_string.c
170         unit_strings.c
171         xdlc.c
172         ${CMAKE_SOURCE_DIR}/ws_version_info.c
173 )
174
175 set(LIBWIRESHARK_CLEAN_FILES
176         ${LIBWIRESHARK_FILES}
177 )
178
179 add_lex_files(LEX_FILES GENERATED_FILES
180         diam_dict.l
181         dtd_parse.l
182         dtd_preparse.l
183         radius_dict.l
184         uat_load.l
185 )
186
187 add_lemon_files(LEMON_FILES GENERATED_FILES
188         dtd_grammar.lemon
189 )
190
191 set(epan_LIBS
192         wiretap
193         wsutil
194         ${CARES_LIBRARIES}
195         ${GCRYPT_LIBRARIES}
196         ${GEOIP_LIBRARIES}
197         ${GLIB2_LIBRARIES}
198         ${GNUTLS_LIBRARIES}
199         ${KERBEROS_LIBRARIES}
200         ${LUA_LIBRARIES}
201         ${LZ4_LIBRARIES}
202         ${M_LIBRARIES}
203         ${NGHTTP2_LIBRARIES}
204         ${PCAP_LIBRARIES}
205         ${SMI_LIBRARIES}
206         ${SNAPPY_LIBRARIES}
207         ${WIN_PSAPI_LIBRARY}
208 )
209
210 set(CLEAN_FILES
211         ${LIBWIRESHARK_CLEAN_FILES}
212         ${COMPRESS_FILES}
213         ${LIBWIRESHARK_ASM_FILES}
214 )
215
216 set_source_files_properties(
217         ${CLEAN_FILES}
218         PROPERTIES
219         COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
220 )
221
222 # Cannot use $<$<BOOL:${HAVE_LIBLUA}>:$<TARGET_OBJECTS:wslua>> as that breaks
223 # get_target_property(_libwireshark_location epan LOCATION).
224 if(HAVE_LIBLUA)
225         set(wslua_sources $<TARGET_OBJECTS:wslua>)
226 else()
227         set(wslua_sources)
228 endif()
229 add_library(epan ${LINK_MODE_LIB}
230         ${LIBWIRESHARK_FILES}
231         ${GENERATED_FILES}
232         ${COMPRESS_FILES}
233         ${LIBWIRESHARK_ASM_FILES}
234         $<TARGET_OBJECTS:crypt>
235         $<TARGET_OBJECTS:dfilter>
236         $<TARGET_OBJECTS:dissectors>
237         $<TARGET_OBJECTS:dissectors-corba>
238         $<TARGET_OBJECTS:ftypes>
239         $<TARGET_OBJECTS:wmem>
240         ${wslua_sources}
241         ${CMAKE_BINARY_DIR}/image/libwireshark.rc
242 )
243
244 add_dependencies(epan version)
245
246 set(FULL_SO_VERSION "0.0.0")
247
248 set_target_properties(epan PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL")
249 set_target_properties(epan PROPERTIES COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}")
250 set_target_properties(epan PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
251 set_target_properties(epan PROPERTIES VERSION ${FULL_SO_VERSION} SOVERSION 0)
252
253 if(ENABLE_APPLICATION_BUNDLE)
254         set_target_properties(epan PROPERTIES
255                 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
256         )
257 endif()
258
259 ABICHECK(libwireshark)
260
261 set(TOP_LEVEL_HEADERS ${CMAKE_BINARY_DIR}/config.h ${CMAKE_SOURCE_DIR}/register.h)
262 file(GLOB CRYPT_HEADERS crypt/*.h)
263 file(GLOB COMPRESS_HEADERS compress/*.h)
264 file(GLOB DFILTER_HEADERS dfilter/*.h ../tools/lemon/cppmagic.h)
265 file(GLOB D_HEADERS dissectors/*.h)
266 file(GLOB FTYPES_HEADERS ftypes/*.h)
267 file(GLOB WMEM_HEADERS wmem/*.h)
268
269 add_custom_command(OUTPUT libwireshark.abi.tar.gz
270         COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
271         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
272         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/epan
273         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/crypt
274         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/compress
275         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dfilter
276         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dissectors
277         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/ftypes
278         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/wmem
279         COMMAND ${ABI_COPY_COMMAND} ${TOP_LEVEL_HEADERS} ${ABICHECK_TMPDIR} ${ABI_COPY_FLAGS}
280         COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/epan ${ABI_COPY_FLAGS}
281         COMMAND ${ABI_COPY_COMMAND} ${CRYPT_HEADERS} ${ABICHECK_TMPDIR}/crypt ${ABI_COPY_FLAGS}
282         COMMAND ${ABI_COPY_COMMAND} ${COMPRESS_HEADERS} ${ABICHECK_TMPDIR}/compress ${ABI_COPY_FLAGS}
283         COMMAND ${ABI_COPY_COMMAND} ${DFILTER_HEADERS} ${ABICHECK_TMPDIR}/dfilter ${ABI_COPY_FLAGS}
284         COMMAND ${ABI_COPY_COMMAND} ${D_HEADERS} ${ABICHECK_TMPDIR}/dissectors ${ABI_COPY_FLAGS}
285         COMMAND ${ABI_COPY_COMMAND} ${FTYPES_HEADERS} ${ABICHECK_TMPDIR}/ftypes ${ABI_COPY_FLAGS}
286         COMMAND ${ABI_COPY_COMMAND} ${WMEM_HEADERS} ${ABICHECK_TMPDIR}/wmem ${ABI_COPY_FLAGS}
287         COMMAND rm -f ${ABICHECK_TMPDIR}/dissectors/x11-extension-implementation.h
288                 ${ABICHECK_TMPDIR}/dissectors/packet-rtps.h
289                 ${ABICHECK_TMPDIR}/dissectors/x11-glx-render-enum.h
290                 ${ABICHECK_TMPDIR}/dissectors/x11-register-info.h
291                 ${ABICHECK_TMPDIR}/dissectors/packet-idmp.h
292         COMMAND ${ABICHECK_COMMAND}
293         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwireshark/libwireshark_* ${CMAKE_CURRENT_BINARY_DIR}/libwireshark.abi.tar.gz
294         COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
295 #       COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps ${ABICHECK_TMPDIR}/config.h
296 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/crypt/*
297 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/compress/*
298 #               ${ABICHECK_TMPDIR}/dfilter/* ${ABICHECK_TMPDIR}/dissectors/*
299 #               ${ABICHECK_TMPDIR}/ftypes/* ${ABICHECK_TMPDIR}/wmem/*
300         DEPENDS ${HEADERS}
301                 ${CRYPT_HEADERS} ${COMPRESS_HEADERS} ${DFILTER_HEADERS} ${D_HEADERS}
302                 ${FTYPES_HEADERS} ${WMEM_HEADERS} epan)
303
304 # By default the name for a library with target name epan will be libepan,
305 # but Ethereal is now named Wireshark
306 set_target_properties(epan PROPERTIES
307         OUTPUT_NAME "wireshark"
308         PREFIX "lib"
309         FOLDER "DLLs"
310 )
311
312 target_link_libraries(epan ${epan_LIBS})
313
314 add_dependencies(epan lemon)
315
316 if(NOT ${ENABLE_STATIC})
317         install(TARGETS epan
318                 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
319                 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
320                 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
321         )
322 endif()
323
324 add_executable(exntest EXCLUDE_FROM_ALL exntest.c except.c)
325 target_link_libraries(exntest ${GLIB2_LIBRARIES})
326 set_target_properties(exntest PROPERTIES
327         FOLDER "Tests"
328         COMPILE_DEFINITIONS "WS_BUILD_DLL"
329         COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}"
330 )
331
332 add_executable(oids_test EXCLUDE_FROM_ALL oids_test.c)
333 target_link_libraries(oids_test epan ${ZLIB_LIBRARIES})
334 set_target_properties(oids_test PROPERTIES
335         FOLDER "Tests"
336         COMPILE_DEFINITIONS "WS_BUILD_DLL"
337         COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}"
338 )
339
340 add_executable(reassemble_test EXCLUDE_FROM_ALL reassemble_test.c)
341 target_link_libraries(reassemble_test epan)
342 set_target_properties(reassemble_test PROPERTIES
343         FOLDER "Tests"
344 )
345
346 add_executable(tvbtest EXCLUDE_FROM_ALL tvbtest.c)
347 target_link_libraries(tvbtest epan)
348 set_target_properties(tvbtest PROPERTIES
349         FOLDER "Tests"
350         COMPILE_DEFINITIONS "WS_BUILD_DLL"
351         COMPILE_OPTIONS "${WS_WARNINGS_C_FLAGS}"
352 )
353
354 CHECKAPI(
355         NAME
356           epan
357         SWITCHES
358           -g termoutput -build
359         SOURCES
360           ${LIBWIRESHARK_FILES}
361 )
362
363 #
364 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
365 #
366 # Local variables:
367 # c-basic-offset: 8
368 # tab-width: 8
369 # indent-tabs-mode: t
370 # End:
371 #
372 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
373 # :indentSize=8:tabSize=8:noTabs=false:
374 #