aboutsummaryrefslogtreecommitdiffstats
path: root/epan/CMakeLists.txt
blob: 42509db527dae51db37a9c7039f1b2f834c2a843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# CMakeLists.txt
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
#

if (HAVE_HFI_SECTION_INIT)
	add_definitions(
		-DHAVE_HFI_SECTION_INIT
	)
endif()

add_definitions(
		${LIBXML2_DEFINITIONS}
		${KERBEROS_DEFINITIONS}
)

add_subdirectory(crypt)
add_subdirectory(dfilter)
add_subdirectory(dissectors)
add_subdirectory(ftypes)

if(LUA_FOUND)
	add_subdirectory(wslua)
endif()

add_custom_command(
	OUTPUT ps.c
	COMMAND ${PYTHON_EXECUTABLE}
		${CMAKE_SOURCE_DIR}/tools/rdps.py
		${CMAKE_CURRENT_SOURCE_DIR}/print.ps
		ps.c
	DEPENDS
		${CMAKE_SOURCE_DIR}/tools/rdps.py
		${CMAKE_CURRENT_SOURCE_DIR}/print.ps
)

set(LIBWIRESHARK_PUBLIC_HEADERS
	addr_and_mask.h
	addr_resolv.h
	address.h
	address_types.h
	afn.h
	aftypes.h
	app_mem_usage.h
	arcnet_pids.h
	arptypes.h
	asn1.h
	ax25_pids.h
	bridged_pids.h
	capture_dissectors.h
	charsets.h
	chdlctypes.h
	cisco_pid.h
	color_filters.h
	column.h
	column-info.h
	column-utils.h
	conversation.h
	conversation_debug.h
	conversation_table.h
	conv_id.h
	crc10-tvb.h
	crc16-tvb.h
	crc32-tvb.h
	crc6-tvb.h
	crc8-tvb.h
	decode_as.h
	diam_dict.h
	disabled_protos.h
	conversation_filter.h
	dccpservicecodes.h
	dtd.h
	dtd_parse.h
	dvb_chartbl.h
	eap.h
	eapol_keydes_types.h
	epan.h
	epan_dissect.h
	etypes.h
	ex-opt.h
	except.h
	exceptions.h
	expert.h
	export_object.h
	exported_pdu.h
	filter_expressions.h
	follow.h
	frame_data.h
	frame_data_sequence.h
	funnel.h
	#geoip_db.h
	golay.h
	guid-utils.h
	iana_charsets.h
	iax2_codec_type.h
	in_cksum.h
	introspection.h
	ip_opts.h
	ipproto.h
	ipv4.h
	ipv6.h
	lapd_sapi.h
	llcsaps.h
	maxmind_db.h
	media_params.h
	next_tvb.h
	nlpid.h
	oids.h
	osi-utils.h
	oui.h
	packet.h
	packet_info.h
	params.h
	pci-ids.h
	plugin_if.h
	ppptypes.h
	print.h
	print_stream.h
	prefs.h
	prefs-int.h
	proto.h
	proto_data.h
	ps.h
	ptvcursor.h
	range.h
	reassemble.h
	reedsolomon.h
	register.h
	req_resp_hdrs.h
	rtd_table.h
	rtp_pt.h
	sctpppids.h
	secrets.h
	show_exception.h
	slow_protocol_subtypes.h
	sminmpec.h
	srt_table.h
	stat_tap_ui.h
	stat_groups.h
	stats_tree.h
	stats_tree_priv.h
	stream.h
	strutil.h
	t35.h
	tap.h
	tap-voip.h
	timestamp.h
	timestats.h
	tfs.h
	to_str.h
	tvbparse.h
	tvbuff.h
	tvbuff-int.h
	uat.h
	uat-int.h
	unit_strings.h
	value_string.h
	wmem_scopes.h
	wscbor.h
	x264_prt_id.h
	xdlc.h
)

set(LIBWIRESHARK_HEADER_FILES
	${LIBWIRESHARK_PUBLIC_HEADERS}
)

set(LIBWIRESHARK_NONGENERATED_FILES
	addr_and_mask.c
	addr_resolv.c
	address_types.c
	afn.c
	aftypes.c
	app_mem_usage.c
	asn1.c
	capture_dissectors.c
	charsets.c
	color_filters.c
	column.c
	column-utils.c
	conversation.c
	conversation_table.c
	crc10-tvb.c
	crc16-tvb.c
	crc32-tvb.c
	crc6-tvb.c
	crc8-tvb.c
	decode_as.c
	disabled_protos.c
	conversation_filter.c
	dvb_chartbl.c
	epan.c
	ex-opt.c
	except.c
	expert.c
	export_object.c
	exported_pdu.c
	filter_expressions.c
	follow.c
	frame_data.c
	frame_data_sequence.c
	funnel.c
	#geoip_db.c
	golay.c
	guid-utils.c
	iana_charsets.c
	in_cksum.c
	introspection.c
	ipproto.c
	maxmind_db.c
	media_params.c
	next_tvb.c
	oids.c
	osi-utils.c
	packet.c
	pci-ids.c
	plugin_if.c
	print.c
	print_stream.c
	prefs.c
	proto.c
	proto_data.c
	range.c
	reassemble.c
	reedsolomon.c
	register.c
	req_resp_hdrs.c
	rtd_table.c
	sctpppids.c
	secrets.c
	sequence_analysis.c
	show_exception.c
	srt_table.c
	stat_tap_ui.c
	stats_tree.c
	strutil.c
	stream.c
	t35.c
	tap.c
	timestamp.c
	timestats.c
	tfs.c
	to_str.c
	tvbparse.c
	tvbuff.c
	tvbuff_base64.c
	tvbuff_brotli.c
	tvbuff_composite.c
	tvbuff_real.c
	tvbuff_subset.c
	tvbuff_zlib.c
	tvbuff_zstd.c
	tvbuff_lz77.c
	tvbuff_lz77huff.c
	tvbuff_lznt1.c
	tvbuff_rdp.c
	uat.c
	value_string.c
	wscbor.c
	unit_strings.c
	wmem_scopes.c
	xdlc.c
	protobuf-helper.c
	protobuf_lang_tree.c
	${CMAKE_CURRENT_BINARY_DIR}/ps.c
)

set(LIBWIRESHARK_FILES ${LIBWIRESHARK_NONGENERATED_FILES})

add_lex_files(LEX_FILES LIBWIRESHARK_FILES
	diam_dict.l
	dtd_parse.l
	dtd_preparse.l
	radius_dict.l
	uat_load.l
	protobuf_lang_scanner.l
)

add_lemon_files(LEMON_FILES LIBWIRESHARK_FILES
	dtd_grammar.lemon
	protobuf_lang_parser.lemon
)

set_source_files_properties(
	${LIBWIRESHARK_NONGENERATED_FILES}
	PROPERTIES
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_library(epan
	#Included so that Visual Studio can properly put header files in solution
	${LIBWIRESHARK_HEADER_FILES}

	${LIBWIRESHARK_FILES}
	$<TARGET_OBJECTS:crypt>
	$<TARGET_OBJECTS:dfilter>
	$<TARGET_OBJECTS:dissectors>
	$<TARGET_OBJECTS:dissectors-corba>
	$<TARGET_OBJECTS:dissector-registration>
	$<TARGET_OBJECTS:ftypes>
	$<$<BOOL:${LUA_FOUND}>:$<TARGET_OBJECTS:wslua>>
	${CMAKE_BINARY_DIR}/resources/libwireshark.rc
)

set_target_properties(epan PROPERTIES
	COMPILE_DEFINITIONS "WS_BUILD_DLL"
	LINK_FLAGS "${WS_LINK_FLAGS}"
	VERSION "0.0.0" SOVERSION 0
	INSTALL_RPATH "${LIBRARY_INSTALL_RPATH}"
	# By default the name for a library with target name epan will be libepan,
	# but Ethereal is now named Wireshark
	OUTPUT_NAME "wireshark"
	PREFIX "lib"
	FOLDER "DLLs"
)
if(MSVC)
	set_target_properties(epan PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
endif()

target_link_libraries(epan
	PUBLIC
		wsutil
		${GLIB2_LIBRARIES}
	PRIVATE
		wiretap
		${BROTLI_LIBRARIES}
		${CARES_LIBRARIES}
		${GCRYPT_LIBRARIES}
		${GIO2_LIBRARIES}
		${GNUTLS_LIBRARIES}
		${KERBEROS_LIBRARIES}
		${LIBXML2_LIBRARIES}
		${LUA_LIBRARIES}
		${LZ4_LIBRARIES}
		${M_LIBRARIES}
		${NGHTTP2_LIBRARIES}
		${SMI_LIBRARIES}
		${SNAPPY_LIBRARIES}
		${WIN_PSAPI_LIBRARY}
		${WIN_WS2_32_LIBRARY}
		${ZLIB_LIBRARIES}
		${ZSTD_LIBRARIES}
		$<$<BOOL:${LUA_FOUND}>:lrexlib>
)

target_include_directories(epan
	SYSTEM PUBLIC
		${GLIB2_INCLUDE_DIRS}
)

target_include_directories(epan
	INTERFACE
		$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
		$<INSTALL_INTERFACE:include/wireshark>
)

target_include_directories(epan
	SYSTEM PRIVATE
		${BROTLI_INCLUDE_DIRS}
		${CARES_INCLUDE_DIRS}
		${GCRYPT_INCLUDE_DIRS}
		${GLIB2_INCLUDE_DIRS}
		${GNUTLS_INCLUDE_DIRS}
		${LIBXML2_INCLUDE_DIRS}
		${LUA_INCLUDE_DIRS}
		${LZ4_INCLUDE_DIRS}
		${NGHTTP2_INCLUDE_DIRS}
		${SMI_INCLUDE_DIRS}
		${ZLIB_INCLUDE_DIRS}
		${ZSTD_INCLUDE_DIRS}
	PRIVATE
		${CMAKE_CURRENT_BINARY_DIR}
		${CMAKE_CURRENT_SOURCE_DIR}
)

add_dependencies(epan lemon)

install(TARGETS epan
	EXPORT WiresharkTargets
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(FILES ${LIBWIRESHARK_PUBLIC_HEADERS}
	DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/epan"
	COMPONENT "Development"
	EXCLUDE_FROM_ALL
)

add_executable(exntest EXCLUDE_FROM_ALL exntest.c except.c)
target_link_libraries(exntest epan)
set_target_properties(exntest PROPERTIES
	FOLDER "Tests"
	EXCLUDE_FROM_DEFAULT_BUILD True
	COMPILE_DEFINITIONS "WS_BUILD_DLL"
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_executable(oids_test EXCLUDE_FROM_ALL oids_test.c)
target_link_libraries(oids_test epan)
set_target_properties(oids_test PROPERTIES
	FOLDER "Tests"
	EXCLUDE_FROM_DEFAULT_BUILD True
	COMPILE_DEFINITIONS "WS_BUILD_DLL"
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_executable(reassemble_test EXCLUDE_FROM_ALL reassemble_test.c)
target_link_libraries(reassemble_test epan)
set_target_properties(reassemble_test PROPERTIES
	FOLDER "Tests"
	EXCLUDE_FROM_DEFAULT_BUILD True
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_executable(tvbtest EXCLUDE_FROM_ALL tvbtest.c)
target_link_libraries(tvbtest epan)
set_target_properties(tvbtest PROPERTIES
	FOLDER "Tests"
	EXCLUDE_FROM_DEFAULT_BUILD True
	COMPILE_DEFINITIONS "WS_BUILD_DLL"
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_executable(wscbor_test EXCLUDE_FROM_ALL wscbor_test.c)
target_link_libraries(wscbor_test epan)
set_target_properties(wscbor_test PROPERTIES
    FOLDER "Tests"
    EXCLUDE_FROM_DEFAULT_BUILD True
    COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

add_executable(test_epan EXCLUDE_FROM_ALL test_epan.c)
target_link_libraries(test_epan epan)
set_target_properties(test_epan PROPERTIES
	FOLDER "Tests"
	EXCLUDE_FROM_DEFAULT_BUILD True
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
)

CHECKAPI(
	NAME
	  epan
	SWITCHES
	SOURCES
	  ${LIBWIRESHARK_NONGENERATED_FILES}
)

#
# Editor modelines  -  https://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:
#