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