Revert "plaintext=decrypt_krb5_data => enc_key_t"
[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 # SPDX-License-Identifier: GPL-2.0-or-later
8 #
9
10 include(UseABICheck)
11
12 if (HAVE_HFI_SECTION_INIT)
13         add_definitions(
14                 -DHAVE_HFI_SECTION_INIT
15         )
16 endif()
17
18 add_subdirectory(crypt)
19 add_subdirectory(dfilter)
20 add_subdirectory(dissectors)
21 add_subdirectory(ftypes)
22 add_subdirectory(wmem)
23 if (HAVE_LIBLUA)
24         add_subdirectory(wslua)
25 endif()
26
27 include_directories(
28         ${CMAKE_CURRENT_BINARY_DIR}
29         ${CMAKE_CURRENT_SOURCE_DIR}
30 )
31
32 add_custom_command(
33         OUTPUT ps.c
34         COMMAND ${PYTHON_EXECUTABLE}
35                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
36                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
37                 ps.c
38         DEPENDS
39                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
40                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
41 )
42
43 set(LIBWIRESHARK_PUBLIC_HEADERS
44         addr_and_mask.h
45         addr_resolv.h
46         address.h
47         address_types.h
48         afn.h
49         aftypes.h
50         app_mem_usage.h
51         arcnet_pids.h
52         arptypes.h
53         asn1.h
54         ax25_pids.h
55         bridged_pids.h
56         capture_dissectors.h
57         charsets.h
58         chdlctypes.h
59         color_filters.h
60         column.h
61         column-info.h
62         column-utils.h
63         conversation.h
64         conversation_debug.h
65         conversation_table.h
66         conv_id.h
67         crc10-tvb.h
68         crc16-tvb.h
69         crc32-tvb.h
70         crc6-tvb.h
71         crc8-tvb.h
72         decode_as.h
73         diam_dict.h
74         disabled_protos.h
75         dissector_filters.h
76         dtd.h
77         dtd_parse.h
78         dvb_chartbl.h
79         eap.h
80         eapol_keydes_types.h
81         epan.h
82         epan_dissect.h
83         etypes.h
84         ex-opt.h
85         except.h
86         exceptions.h
87         expert.h
88         export_object.h
89         exported_pdu.h
90         filter_expressions.h
91         follow.h
92         frame_data.h
93         frame_data_sequence.h
94         funnel.h
95         garrayfix.h
96         #geoip_db.h
97         golay.h
98         guid-utils.h
99         iana_charsets.h
100         iax2_codec_type.h
101         in_cksum.h
102         ip_opts.h
103         ipproto.h
104         ipv4.h
105         ipv6.h
106         lapd_sapi.h
107         llcsaps.h
108         maxmind_db.h
109         media_params.h
110         next_tvb.h
111         nlpid.h
112         oids.h
113         osi-utils.h
114         oui.h
115         packet.h
116         packet_info.h
117         params.h
118         plugin_if.h
119         ppptypes.h
120         print.h
121         print_stream.h
122         prefs.h
123         prefs-int.h
124         proto.h
125         proto_data.h
126         ps.h
127         ptvcursor.h
128         range.h
129         reassemble.h
130         reedsolomon.h
131         register.h
132         req_resp_hdrs.h
133         rtd_table.h
134         rtp_pt.h
135         sctpppids.h
136         show_exception.h
137         slow_protocol_subtypes.h
138         sminmpec.h
139         srt_table.h
140         stat_tap_ui.h
141         stat_groups.h
142         stats_tree.h
143         stats_tree_priv.h
144         stream.h
145         strutil.h
146         t35.h
147         tap.h
148         tap-voip.h
149         timestamp.h
150         timestats.h
151         tfs.h
152         time_fmt.h
153         to_str.h
154         tvbparse.h
155         tvbuff.h
156         tvbuff-int.h
157         uat.h
158         uat-int.h
159         unit_strings.h
160         value_string.h
161         x264_prt_id.h
162         xdlc.h
163 )
164
165 set(LIBWIRESHARK_NONGENERATED_FILES
166         addr_and_mask.c
167         addr_resolv.c
168         address_types.c
169         afn.c
170         aftypes.c
171         app_mem_usage.c
172         asn1.c
173         capture_dissectors.c
174         charsets.c
175         color_filters.c
176         column.c
177         column-utils.c
178         conversation.c
179         conversation_table.c
180         crc10-tvb.c
181         crc16-tvb.c
182         crc32-tvb.c
183         crc6-tvb.c
184         crc8-tvb.c
185         decode_as.c
186         disabled_protos.c
187         dissector_filters.c
188         dvb_chartbl.c
189         epan.c
190         ex-opt.c
191         except.c
192         expert.c
193         export_object.c
194         exported_pdu.c
195         filter_expressions.c
196         follow.c
197         frame_data.c
198         frame_data_sequence.c
199         funnel.c
200         #geoip_db.c
201         golay.c
202         guid-utils.c
203         iana_charsets.c
204         in_cksum.c
205         ipproto.c
206         maxmind_db.c
207         media_params.c
208         next_tvb.c
209         oids.c
210         osi-utils.c
211         packet.c
212         plugin_if.c
213         print.c
214         print_stream.c
215         prefs.c
216         proto.c
217         proto_data.c
218         range.c
219         reassemble.c
220         reedsolomon.c
221         register.c
222         req_resp_hdrs.c
223         rtd_table.c
224         sequence_analysis.c
225         show_exception.c
226         srt_table.c
227         stat_tap_ui.c
228         stats_tree.c
229         strutil.c
230         stream.c
231         t35.c
232         tap.c
233         timestamp.c
234         timestats.c
235         tfs.c
236         to_str.c
237         tvbparse.c
238         tvbuff.c
239         tvbuff_base64.c
240         tvbuff_composite.c
241         tvbuff_real.c
242         tvbuff_subset.c
243         tvbuff_zlib.c
244         uat.c
245         value_string.c
246         unit_strings.c
247         xdlc.c
248         ${CMAKE_CURRENT_BINARY_DIR}/ps.c
249         ${CMAKE_SOURCE_DIR}/version_info.c
250 )
251
252 set(LIBWIRESHARK_FILES ${LIBWIRESHARK_NONGENERATED_FILES})
253
254 add_lex_files(LEX_FILES LIBWIRESHARK_FILES
255         diam_dict.l
256         dtd_parse.l
257         dtd_preparse.l
258         radius_dict.l
259         uat_load.l
260 )
261
262 add_lemon_files(LEMON_FILES LIBWIRESHARK_FILES
263         dtd_grammar.lemon
264 )
265
266 set_source_files_properties(
267         ${LIBWIRESHARK_FILES}
268         PROPERTIES
269         COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
270 )
271
272 add_library(epan
273         ${LIBWIRESHARK_FILES}
274         $<TARGET_OBJECTS:crypt>
275         $<TARGET_OBJECTS:dfilter>
276         $<TARGET_OBJECTS:dissectors>
277         $<TARGET_OBJECTS:dissectors-corba>
278         $<TARGET_OBJECTS:ftypes>
279         $<TARGET_OBJECTS:wmem>
280         $<$<BOOL:${HAVE_LIBLUA}>:$<TARGET_OBJECTS:wslua>>
281         ${CMAKE_BINARY_DIR}/image/libwireshark.rc
282 )
283
284 add_dependencies(epan version)
285
286 if(ENABLE_PLUGINS)
287         target_compile_definitions(epan PUBLIC HAVE_PLUGINS)
288 endif()
289
290 set_target_properties(epan PROPERTIES
291         COMPILE_DEFINITIONS "WS_BUILD_DLL"
292         LINK_FLAGS "${WS_LINK_FLAGS}"
293         VERSION "0.0.0" SOVERSION 0
294 )
295
296 if(ENABLE_APPLICATION_BUNDLE)
297         if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
298                 # Xcode
299                 set_target_properties(epan PROPERTIES
300                         LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/Frameworks
301                 )
302         else()
303                 set_target_properties(epan PROPERTIES
304                         LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
305                 )
306         endif()
307 endif()
308
309 ABICHECK(libwireshark)
310
311 set(TOP_LEVEL_HEADERS ${CMAKE_BINARY_DIR}/config.h)
312 file(GLOB CRYPT_HEADERS crypt/*.h)
313 file(GLOB DFILTER_HEADERS dfilter/*.h ../tools/lemon/cppmagic.h)
314 file(GLOB D_HEADERS dissectors/*.h)
315 file(GLOB FTYPES_HEADERS ftypes/*.h)
316 file(GLOB WMEM_HEADERS wmem/*.h)
317
318 add_custom_command(OUTPUT libwireshark.abi.tar.gz
319         COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
320         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
321         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/epan
322         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/crypt
323         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dfilter
324         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dissectors
325         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/ftypes
326         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/wmem
327         COMMAND ${ABI_COPY_COMMAND} ${TOP_LEVEL_HEADERS} ${ABICHECK_TMPDIR} ${ABI_COPY_FLAGS}
328         COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/epan ${ABI_COPY_FLAGS}
329         COMMAND ${ABI_COPY_COMMAND} ${CRYPT_HEADERS} ${ABICHECK_TMPDIR}/crypt ${ABI_COPY_FLAGS}
330         COMMAND ${ABI_COPY_COMMAND} ${DFILTER_HEADERS} ${ABICHECK_TMPDIR}/dfilter ${ABI_COPY_FLAGS}
331         COMMAND ${ABI_COPY_COMMAND} ${D_HEADERS} ${ABICHECK_TMPDIR}/dissectors ${ABI_COPY_FLAGS}
332         COMMAND ${ABI_COPY_COMMAND} ${FTYPES_HEADERS} ${ABICHECK_TMPDIR}/ftypes ${ABI_COPY_FLAGS}
333         COMMAND ${ABI_COPY_COMMAND} ${WMEM_HEADERS} ${ABICHECK_TMPDIR}/wmem ${ABI_COPY_FLAGS}
334         COMMAND rm -f ${ABICHECK_TMPDIR}/dissectors/x11-extension-implementation.h
335                 ${ABICHECK_TMPDIR}/dissectors/packet-rtps.h
336                 ${ABICHECK_TMPDIR}/dissectors/x11-glx-render-enum.h
337                 ${ABICHECK_TMPDIR}/dissectors/x11-register-info.h
338                 ${ABICHECK_TMPDIR}/dissectors/packet-idmp.h
339         COMMAND ${ABICHECK_COMMAND}
340         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwireshark/libwireshark_* ${CMAKE_CURRENT_BINARY_DIR}/libwireshark.abi.tar.gz
341         COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
342 #       COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps ${ABICHECK_TMPDIR}/config.h
343 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/crypt/*
344 #               ${ABICHECK_TMPDIR}/dfilter/* ${ABICHECK_TMPDIR}/dissectors/*
345 #               ${ABICHECK_TMPDIR}/ftypes/* ${ABICHECK_TMPDIR}/wmem/*
346         DEPENDS ${HEADERS}
347                 ${CRYPT_HEADERS} ${DFILTER_HEADERS} ${D_HEADERS}
348                 ${FTYPES_HEADERS} ${WMEM_HEADERS} epan)
349
350 # By default the name for a library with target name epan will be libepan,
351 # but Ethereal is now named Wireshark
352 set_target_properties(epan PROPERTIES
353         OUTPUT_NAME "wireshark"
354         PREFIX "lib"
355         FOLDER "DLLs"
356 )
357
358 target_link_libraries(epan
359         PUBLIC
360                 wiretap
361                 wsutil
362                 ${GLIB2_LIBRARIES}
363         PRIVATE
364                 ${CARES_LIBRARIES}
365                 ${GCRYPT_LIBRARIES}
366                 ${GIO2_LIBRARIES}
367                 ${GTHREAD2_LIBRARIES}
368                 ${GNUTLS_LIBRARIES}
369                 ${KERBEROS_LIBRARIES}
370                 ${LUA_LIBRARIES}
371                 ${LZ4_LIBRARIES}
372                 ${M_LIBRARIES}
373                 ${NGHTTP2_LIBRARIES}
374                 ${PCAP_LIBRARIES}
375                 ${SMI_LIBRARIES}
376                 ${SNAPPY_LIBRARIES}
377                 ${WIN_PSAPI_LIBRARY}
378                 ${LIBXML2_LIBRARIES}
379                 ${JSONGLIB_LIBRARIES}
380 )
381
382 target_include_directories(epan
383         INTERFACE
384         $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
385         $<INSTALL_INTERFACE:include/wireshark>
386         PUBLIC
387         ${GLIB2_INCLUDE_DIRS}
388 )
389
390 add_dependencies(epan lemon)
391
392 install(TARGETS epan
393         EXPORT WiresharkTargets
394         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
395         RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
396         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
397 )
398
399 if(NOT WIN32)
400         install(FILES ${LIBWIRESHARK_PUBLIC_HEADERS}
401                 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${CPACK_PACKAGE_NAME}/epan"
402         )
403 endif()
404
405 add_executable(exntest EXCLUDE_FROM_ALL exntest.c except.c)
406 target_link_libraries(exntest ${GLIB2_LIBRARIES})
407 set_target_properties(exntest PROPERTIES
408         FOLDER "Tests"
409         EXCLUDE_FROM_DEFAULT_BUILD True
410         COMPILE_DEFINITIONS "WS_BUILD_DLL"
411 )
412
413 add_executable(oids_test EXCLUDE_FROM_ALL oids_test.c)
414 target_link_libraries(oids_test epan ${ZLIB_LIBRARIES})
415 set_target_properties(oids_test PROPERTIES
416         FOLDER "Tests"
417         EXCLUDE_FROM_DEFAULT_BUILD True
418         COMPILE_DEFINITIONS "WS_BUILD_DLL"
419 )
420
421 add_executable(reassemble_test EXCLUDE_FROM_ALL reassemble_test.c)
422 target_link_libraries(reassemble_test epan)
423 set_target_properties(reassemble_test PROPERTIES
424         FOLDER "Tests"
425         EXCLUDE_FROM_DEFAULT_BUILD True
426 )
427
428 add_executable(tvbtest EXCLUDE_FROM_ALL tvbtest.c)
429 target_link_libraries(tvbtest epan)
430 set_target_properties(tvbtest PROPERTIES
431         FOLDER "Tests"
432         EXCLUDE_FROM_DEFAULT_BUILD True
433         COMPILE_DEFINITIONS "WS_BUILD_DLL"
434 )
435
436 CHECKAPI(
437         NAME
438           epan
439         SWITCHES
440           --group termoutput:10 --summary-group termoutput --build
441         SOURCES
442           ${LIBWIRESHARK_NONGENERATED_FILES}
443 )
444
445 #
446 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
447 #
448 # Local variables:
449 # c-basic-offset: 8
450 # tab-width: 8
451 # indent-tabs-mode: t
452 # End:
453 #
454 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
455 # :indentSize=8:tabSize=8:noTabs=false:
456 #