aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/CMakeLists.txt
blob: 8f92e08819bb3fbf92939d7fda6d0989fefe32fc (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
# CMakeLists.txt
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

ADD_CUSTOM_CMAKE_INCLUDE()

set(WIRESHARK_GTK_SRC
	about_dlg.c
	addr_resolution_dlg.c
	bytes_view.c
	capture_dlg.c
	capture_file_dlg.c
	capture_if_dlg.c
	capture_info_dlg.c
	color_dlg.c
	color_edit_dlg.c
	color_utils.c
	conversation_hastables_dlg.c
	conversations_table.c
	decode_as_dlg.c
	dfilter_expr_dlg.c
	dissector_tables_dlg.c
	dlg_utils.c
	drag_and_drop.c
	edit_packet_comment_dlg.c
	expert_comp_table.c
	export_object_dlg.c
	export_pdu_dlg.c
	export_sslkeys.c
	filter_autocomplete.c
	file_dlg.c
	file_import_dlg.c
	fileset_dlg.c
	filter_dlg.c
	filter_expression_save_dlg.c
	filter_utils.c
	find_dlg.c
	firewall_dlg.c
	follow_stream.c
	font_utils.c
	goto_dlg.c
	graph_analysis.c
	gtk_iface_monitor.c
	gui_stat_util.c
	gui_utils.c
	help_dlg.c
	hostlist_table.c
	macros_dlg.c
	main.c
	main_80211_toolbar.c
	main_filter_toolbar.c
	main_menubar.c
	main_statusbar.c
	main_titlebar.c
	main_toolbar.c
	main_welcome.c
	manual_addr_resolv.c
	packet_history.c
	packet_list_store.c
	packet_list.c
	packet_panes.c
	packet_win.c
	pixmap_save.c
	plugins_dlg.c
	prefs_capture.c
	prefs_column.c
	prefs_dlg.c
	prefs_filter_expressions.c
	prefs_gui.c
	prefs_layout.c
	prefs_font_color.c
	print_dlg.c
	profile_dlg.c
	progress_dlg.c
	proto_dlg.c
	proto_hier_stats_dlg.c
	proto_hier_tree_model.c
	proto_tree_model.c
	range_utils.c
	response_time_delay_table.c
	sctp_byte_graph_dlg.c
	sctp_error_dlg.c
	sctp_graph_dlg.c
	service_response_time_table.c
	simple_dialog.c
	simple_stattable.c
	stock_icons.c
	summary_dlg.c
	supported_protos_dlg.c
	tap_param_dlg.c
	text_page_utils.c
	time_shift_dlg.c
	uat_gui.c
	webbrowser.c
	${WIRESHARK_CUSTOM_GTK_SRC}
)

if (AIRPCAP_FOUND)
	set(WIRESHARK_GTK_SRC
		${WIRESHARK_GTK_SRC}
		airpcap_dlg.c
		airpcap_gui_utils.c
		main_airpcap_toolbar.c
	)
endif()

if(PORTAUDIO_FOUND)
	set(WIRESHARK_GTK_SRC
		${WIRESHARK_GTK_SRC}
		rtp_player.c
	)

	# For Win32, there is no PortAudio lib, we compile the files locally
	if(WIN32)
		add_definitions(
			-DPA_NO_DS
			-DPA_NO_ASIO
		)
		set(PORTAUDIO_SRC
			${PORTAUDIO_SRC_DIR}/common/pa_allocation.c
			${PORTAUDIO_SRC_DIR}/common/pa_converters.c
			${PORTAUDIO_SRC_DIR}/common/pa_cpuload.c
			${PORTAUDIO_SRC_DIR}/common/pa_dither.c
			${PORTAUDIO_SRC_DIR}/common/pa_front.c
			${PORTAUDIO_SRC_DIR}/common/pa_process.c
			${PORTAUDIO_SRC_DIR}/common/pa_skeleton.c
			${PORTAUDIO_SRC_DIR}/common/pa_stream.c
			${PORTAUDIO_SRC_DIR}/common/pa_trace.c
			${PORTAUDIO_SRC_DIR}/os/win/pa_win_hostapis.c
			${PORTAUDIO_SRC_DIR}/os/win/pa_win_util.c
			${PORTAUDIO_SRC_DIR}/os/win/pa_x86_plain_converters.c
			${PORTAUDIO_SRC_DIR}/os/win/pa_win_waveformat.c
			${PORTAUDIO_SRC_DIR}/hostapi/wmme/pa_win_wmme.c
		)
		add_library(portaudio OBJECT
			${PORTAUDIO_SRC}
		)
		set_target_properties(portaudio PROPERTIES
			INCLUDE_DIRECTORIES "${PORTAUDIO_INCLUDE_DIRS}"
			FOLDER "UI")

		# Portaudio has some warnings, annoyingly the combination of CMake
		# and MSBuild means that just disabling the warnings on the specific
		# source files doesn't work, so set them to level 4 for the target
		#set_source_files_properties(${PORTAUDIO_SRC_DIR}/common/pa_front.c
		#	PROPERTIES
		#	COMPILE_FLAGS "/wd4189"
		#)
		#set_source_files_properties(${PORTAUDIO_SRC_DIR}/os/win/pa_x86_plain_converters.c
		#	PROPERTIES
		#	COMPILE_FLAGS "/wd4305"
		#)
		target_compile_options(portaudio
			PUBLIC "/w44189"
			PUBLIC "/w44305"
		)

		# Portaudio has some size_t > long warnings as a result of using strlen() on x64.
		if ("${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64")
			#set_source_files_properties(${PORTAUDIO_SRC_DIR}/hostapi/wmme/pa_win_wmme.c
			#	PROPERTIES
			#	COMPILE_FLAGS "/wd4267"
			#)
			target_compile_options(portaudio
				PUBLIC "/w44267"
			)
		endif()
	endif()
endif()

if(ENABLE_EXTCAP)
	set(WIRESHARK_GTK_SRC
		${WIRESHARK_GTK_SRC}
		extcap_gtk.c
	)
endif()

set(WIRESHARK_TAP_SRC
	${CMAKE_CURRENT_SOURCE_DIR}/compare_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/dcerpc_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/expert_comp_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/flow_graph.c
	${CMAKE_CURRENT_SOURCE_DIR}/funnel_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/gsm_map_summary.c
	${CMAKE_CURRENT_SOURCE_DIR}/iax2_analysis.c
	${CMAKE_CURRENT_SOURCE_DIR}/io_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/lbm_stream_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/mac_lte_stat_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/mcast_stream_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/mtp3_summary.c
	${CMAKE_CURRENT_SOURCE_DIR}/rlc_lte_graph.c
	${CMAKE_CURRENT_SOURCE_DIR}/rlc_lte_stat_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/rpc_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/rtp_analysis.c
	${CMAKE_CURRENT_SOURCE_DIR}/rtp_stream_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/sctp_assoc_analyse.c
	${CMAKE_CURRENT_SOURCE_DIR}/sctp_chunk_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/sctp_chunk_stat_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/sctp_stat_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/stats_tree_stat.c
	${CMAKE_CURRENT_SOURCE_DIR}/tcp_graph.c
	${CMAKE_CURRENT_SOURCE_DIR}/voip_calls_dlg.c
	${CMAKE_CURRENT_SOURCE_DIR}/wlan_stat_dlg.c
	${WIRESHARK_CUSTOM_TAP_SRC}
)

set(CLEAN_FILES
	${WIRESHARK_GTK_SRC}
	${WIRESHARK_TAP_SRC}
)

set_source_files_properties(
	${CLEAN_FILES}
	PROPERTIES
	COMPILE_FLAGS "${WERROR_COMMON_FLAGS} ${NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS}"
)

if (ENABLE_GTK3)
	add_definitions(
		${GTK3_DEFINITIONS}
		-DGDK_DISABLE_DEPRECATION_WARNINGS
	)
else()
	add_definitions(
		# We are only allowed to include gtk/gtk.h, no other files. When
		# violating this with gtk3 the compiler will complain anyway.
		-DGTK_DISABLE_SINGLE_INCLUDES

		# GTK+ 3 removes many implementation details and struct members from its
		# public headers. Make the compiler catch all uses of direct access to
		# struct fields so that you can go through them one by one and replace
		# them with a call to an accessor function instead.
		-DGSEAL_ENABLE

		# To verify that your program does not use any deprecated symbols,
		# you can use defines to remove deprecated symbols from the header files
		# -DGDK_DISABLE_DEPRECATED
		-DGTK_DISABLE_DEPRECATED
	)
endif()

if(WIN32)
	set(PLATFORM_UI_SRC
		capture_if_details_dlg_win32.c
	)
endif()

register_tap_files(wireshark-tap-register.c
	${WIRESHARK_TAP_SRC}
)

if(WIN32)
	set(PORTAUDIO_OBJ $<TARGET_OBJECTS:portaudio>)
endif()

find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE
	glib-compile-resources
	HINTS
		"${GLIB2_HINTS}/bin"
)

pkg_check_modules(GRESOURCE QUIET gio-2.0>=2.32 gdk-pixbuf-2.0>=2.26)

macro(WIRESHARK_GRESOURCES _outputfile _resourcefile)
	add_custom_command(
		OUTPUT ${_outputfile}
		COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE} --sourcedir=${CMAKE_SOURCE_DIR} --target=${_outputfile} --generate --manual-register ${CMAKE_CURRENT_SOURCE_DIR}/${_resourcefile}
		DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_resourcefile}
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
	)
endmacro(WIRESHARK_GRESOURCES)

WIRESHARK_GRESOURCES(wireshark-gresources.h main.gresources.xml)

WIRESHARK_GRESOURCES(wireshark-gresources.c main.gresources.xml)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

if(GRESOURCE_FOUND AND NOT WIN32)
	set(PIXBUF_SRC
		wireshark-gresources.c
		wireshark-gresources.h
	)
	add_definitions(-DHAVE_GDK_GRESOURCE)
else()
	set(PIXBUF_SRC
		pixbuf-csource.c
	)
endif()

add_library(gtkui STATIC
	${WIRESHARK_GTK_SRC}
	${WIRESHARK_TAP_SRC}
	${PLATFORM_UI_SRC}
	${PORTAUDIO_OBJ}
	wireshark-tap-register.c
	${PIXBUF_SRC}
)
set_target_properties(gtkui PROPERTIES
	LINK_FLAGS "${WS_LINK_FLAGS}"
	FOLDER "UI"
)

CHECKAPI(
	NAME
	  gtk-base
	SWITCHES
	  -g deprecated-gtk
	SOURCES
	  ${WIRESHARK_GTK_SRC}
	  ${WIRESHARK_TAP_SRC}
	  ${PLATFORM_UI_SRC}
)
CHECKAPI(
	NAME
	  gtk-todo
	SWITCHES
	  -M -g deprecated-gtk-todo
	SOURCES
	  ${WIRESHARK_GTK_SRC}
	  ${WIRESHARK_TAP_SRC}
	  ${PLATFORM_UI_SRC}
)

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