CMake: Allow user build flags to override default build flags
[metze/wireshark/wip.git] / ui / qt / 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 ADD_CUSTOM_CMAKE_INCLUDE()
23
24 set(WIRESHARK_WIDGET_HEADERS
25         widgets/additional_toolbar.h
26         widgets/apply_line_edit.h
27         widgets/capture_filter_combo.h
28         widgets/capture_filter_edit.h
29         widgets/clickable_label.h
30         widgets/display_filter_combo.h
31         widgets/display_filter_edit.h
32         widgets/drag_drop_toolbar.h
33         widgets/editor_color_dialog.h
34         widgets/editor_file_dialog.h
35         widgets/elided_label.h
36         widgets/field_filter_edit.h
37         widgets/find_line_edit.h
38         widgets/follow_stream_text.h
39         widgets/interface_toolbar_lineedit.h
40         widgets/label_stack.h
41         widgets/overlay_scroll_bar.h
42         widgets/qcustomplot.h
43         widgets/stock_icon_tool_button.h
44         widgets/syntax_line_edit.h
45         widgets/tabnav_tree_view.h
46 )
47
48 set(WIRESHARK_UTILS_HEADERS
49         utils/color_utils.h
50         utils/stock_icon.h
51         utils/qt_ui_utils.h
52         utils/tango_colors.h
53         utils/variant_pointer.h
54 )
55
56 set(WIRESHARK_MODEL_HEADERS
57         models/cache_proxy_model.h
58         models/decode_as_delegate.h
59         models/decode_as_model.h
60         models/interface_sort_filter_model.h
61         models/interface_tree_cache_model.h
62         models/interface_tree_model.h
63         models/numeric_value_chooser_delegate.h
64         models/packet_list_model.h
65         models/packet_list_record.h
66         models/path_chooser_delegate.h
67         models/percent_bar_delegate.h
68         models/related_packet_delegate.h
69         models/timeline_delegate.h
70         models/sparkline_delegate.h
71         models/uat_delegate.h
72         models/uat_model.h
73         models/voip_calls_info_model.h
74 )
75
76 # All .h files which inherit from QObject aka which use the Q_OBJECT macro
77 # need to go here.
78 set(WIRESHARK_QT_HEADERS
79         about_dialog.h
80         accordion_frame.h
81         address_editor_frame.h
82         bluetooth_att_server_attributes_dialog.h
83         bluetooth_device_dialog.h
84         bluetooth_devices_dialog.h
85         bluetooth_hci_summary_dialog.h
86         accordion_frame.h
87         byte_view_tab.h
88         byte_view_text.h
89         capture_file.h
90         capture_file_dialog.h
91         capture_file_properties_dialog.h
92         capture_filter_syntax_worker.h
93         capture_info_dialog.h
94         capture_interfaces_dialog.h
95         capture_preferences_frame.h
96         coloring_rules_dialog.h
97         column_preferences_frame.h
98         column_editor_frame.h
99         compiled_filter_output.h
100         conversation_colorize_action.h
101         conversation_dialog.h
102         conversation_hash_tables_dialog.h
103         decode_as_dialog.h
104         display_filter_expression_dialog.h
105         dissector_tables_dialog.h
106         enabled_protocols_dialog.h
107         endpoint_dialog.h
108         expert_info_dialog.h
109         export_dissection_dialog.h
110         export_object_action.h
111         export_object_dialog.h
112         export_pdu_dialog.h
113         file_set_dialog.h
114         filter_action.h
115         filter_dialog.h
116         filter_dialog.h
117         filter_expression_frame.h
118         firewall_rules_dialog.h
119         follow_stream_dialog.h
120         font_color_preferences_frame.h
121         funnel_string_dialog.h
122         funnel_text_dialog.h
123         funnel_statistics.h
124         geometry_state_dialog.h
125         gsm_map_summary_dialog.h
126         iax2_analysis_dialog.h
127         import_text_dialog.h
128         interface_toolbar.h
129         interface_toolbar_reader.h
130         interface_frame.h
131         io_graph_dialog.h
132         layout_preferences_frame.h
133         lbm_lbtrm_transport_dialog.h
134         lbm_lbtru_transport_dialog.h
135         lbm_stream_dialog.h
136         lte_rlc_graph_dialog.h
137         lte_mac_statistics_dialog.h
138         lte_rlc_statistics_dialog.h
139         main_status_bar.h
140         main_welcome.h
141         main_window.h
142         main_window_preferences_frame.h
143         manage_interfaces_dialog.h
144         module_preferences_scroll_area.h
145         mtp3_summary_dialog.h
146         multicast_statistics_dialog.h
147         packet_comment_dialog.h
148         packet_dialog.h
149         packet_format_group_box.h
150         packet_list.h
151         packet_range_group_box.h
152         preference_editor_frame.h
153         preferences_dialog.h
154         print_dialog.h
155         profile_dialog.h
156         progress_frame.h
157         proto_tree.h
158         protocol_hierarchy_dialog.h
159         protocol_preferences_menu.h
160         recent_file_status.h
161         resolved_addresses_dialog.h
162         response_time_delay_dialog.h
163         rpc_service_response_time_dialog.h
164         rtp_analysis_dialog.h
165         rtp_audio_stream.h
166         rtp_player_dialog.h
167         rtp_stream_dialog.h
168         sctp_all_assocs_dialog.h
169         sctp_assoc_analyse_dialog.h
170         sctp_chunk_statistics_dialog.h
171         sctp_graph_dialog.h
172         sctp_graph_arwnd_dialog.h
173         sctp_graph_byte_dialog.h
174         search_frame.h
175         sequence_diagram.h
176         sequence_dialog.h
177         show_packet_bytes_dialog.h
178         splash_overlay.h
179         stats_tree_dialog.h
180         service_response_time_dialog.h
181         simple_statistics_dialog.h
182         supported_protocols_dialog.h
183         tabnav_tree_widget.h
184         tap_parameter_dialog.h
185         tcp_stream_dialog.h
186         time_shift_dialog.h
187         traffic_table_dialog.h
188         uat_dialog.h
189         uat_frame.h
190         voip_calls_dialog.h
191         wireless_frame.h
192         wireless_timeline.h
193         wireshark_application.h
194         wireshark_dialog.h
195         wlan_statistics_dialog.h
196         ${WIRESHARK_CUSTOM_QT_HEADERS}
197 )
198
199 if(HAVE_PCAP_REMOTE)
200         set(WIRESHARK_QT_HEADERS
201                 ${WIRESHARK_QT_HEADERS}
202                 remote_capture_dialog.h
203                 remote_settings_dialog.h
204         )
205 endif()
206
207 if(ENABLE_EXTCAP)
208         set(WIRESHARK_QT_HEADERS
209                 ${WIRESHARK_QT_HEADERS}
210                 extcap_argument.h
211                 extcap_argument_file.h
212                 extcap_argument_multiselect.h
213                 extcap_options_dialog.h
214         )
215 endif()
216
217 file(GLOB EXTRA_QT_HEADERS
218         packet_list_record.h
219         models/sparkline_delegate.h
220         utils/qt_ui_utils.h
221         utils/stock_icon.h
222 )
223
224 set(WIRESHARK_WIDGET_SRCS
225         widgets/additional_toolbar.cpp
226         widgets/apply_line_edit.cpp
227         widgets/capture_filter_combo.cpp
228         widgets/capture_filter_edit.cpp
229         widgets/clickable_label.cpp
230         widgets/display_filter_combo.cpp
231         widgets/display_filter_edit.cpp
232         widgets/drag_drop_toolbar.cpp
233         widgets/editor_color_dialog.cpp
234         widgets/editor_file_dialog.cpp
235         widgets/elided_label.cpp
236         widgets/field_filter_edit.cpp
237         widgets/find_line_edit.cpp
238         widgets/follow_stream_text.cpp
239         widgets/interface_toolbar_lineedit.cpp
240         widgets/label_stack.cpp
241         widgets/overlay_scroll_bar.cpp
242         widgets/qcustomplot.cpp
243         widgets/stock_icon_tool_button.cpp
244         widgets/syntax_line_edit.cpp
245         widgets/tabnav_tree_view.cpp
246 )
247
248 set(WIRESHARK_UTILS_SRCS
249         utils/color_utils.cpp
250         utils/stock_icon.cpp
251         utils/qt_ui_utils.cpp
252 )
253
254 set(WIRESHARK_MODEL_SRCS
255         models/cache_proxy_model.cpp
256         models/decode_as_delegate.cpp
257         models/decode_as_model.cpp
258         models/interface_sort_filter_model.cpp
259         models/interface_tree_cache_model.cpp
260         models/interface_tree_model.cpp
261         models/numeric_value_chooser_delegate.cpp
262         models/packet_list_model.cpp
263         models/packet_list_record.cpp
264         models/path_chooser_delegate.cpp
265         models/percent_bar_delegate.cpp
266         models/related_packet_delegate.cpp
267         models/sparkline_delegate.cpp
268         models/sparkline_delegate.cpp
269         models/timeline_delegate.cpp
270         models/uat_delegate.cpp
271         models/uat_model.cpp
272         models/voip_calls_info_model.cpp
273 )
274
275 set(WIRESHARK_QT_SRC
276         about_dialog.cpp
277         accordion_frame.cpp
278         address_editor_frame.cpp
279         bluetooth_att_server_attributes_dialog.cpp
280         bluetooth_device_dialog.cpp
281         bluetooth_devices_dialog.cpp
282         bluetooth_hci_summary_dialog.cpp
283         byte_view_tab.cpp
284         byte_view_text.cpp
285         capture_file.cpp
286         capture_file_dialog.cpp
287         capture_file_properties_dialog.cpp
288         capture_filter_syntax_worker.cpp
289         capture_info_dialog.cpp
290         capture_interfaces_dialog.cpp
291         capture_preferences_frame.cpp
292         coloring_rules_dialog.cpp
293         column_preferences_frame.cpp
294         column_editor_frame.cpp
295         compiled_filter_output.cpp
296         conversation_colorize_action.cpp
297         conversation_dialog.cpp
298         conversation_hash_tables_dialog.cpp
299         decode_as_dialog.cpp
300         display_filter_expression_dialog.cpp
301         dissector_tables_dialog.cpp
302         enabled_protocols_dialog.cpp
303         endpoint_dialog.cpp
304         export_dissection_dialog.cpp
305         export_object_action.cpp
306         export_object_dialog.cpp
307         export_pdu_dialog.cpp
308         file_set_dialog.cpp
309         filter_action.cpp
310         filter_dialog.cpp
311         filter_expression_frame.cpp
312         firewall_rules_dialog.cpp
313         follow_stream_dialog.cpp
314         font_color_preferences_frame.cpp
315         funnel_string_dialog.cpp
316         funnel_text_dialog.cpp
317         geometry_state_dialog.cpp
318         iax2_analysis_dialog.cpp
319         import_text_dialog.cpp
320         interface_frame.cpp
321         interface_toolbar.cpp
322         interface_toolbar_reader.cpp
323         layout_preferences_frame.cpp
324         lbm_lbtrm_transport_dialog.cpp
325         lbm_lbtru_transport_dialog.cpp
326         lbm_stream_dialog.cpp
327         lte_mac_statistics_dialog.cpp
328         lte_rlc_graph_dialog.cpp
329         lte_rlc_statistics_dialog.cpp
330         main_status_bar.cpp
331         main_welcome.cpp
332         main_window.cpp
333         main_window_preferences_frame.cpp
334         main_window_slots.cpp
335         manage_interfaces_dialog.cpp
336         module_preferences_scroll_area.cpp
337         packet_comment_dialog.cpp
338         packet_dialog.cpp
339         packet_format_group_box.cpp
340         packet_list.cpp
341         packet_range_group_box.cpp
342         preference_editor_frame.cpp
343         preferences_dialog.cpp
344         print_dialog.cpp
345         profile_dialog.cpp
346         progress_frame.cpp
347         proto_tree.cpp
348         protocol_hierarchy_dialog.cpp
349         protocol_preferences_menu.cpp
350         recent_file_status.cpp
351         resolved_addresses_dialog.cpp
352         response_time_delay_dialog.cpp
353         rpc_service_response_time_dialog.cpp
354         rtp_analysis_dialog.cpp
355         rtp_audio_stream.cpp
356         rtp_player_dialog.cpp
357         rtp_stream_dialog.cpp
358         sctp_all_assocs_dialog.cpp
359         sctp_assoc_analyse_dialog.cpp
360         sctp_chunk_statistics_dialog.cpp
361         sctp_graph_dialog.cpp
362         sctp_graph_arwnd_dialog.cpp
363         sctp_graph_byte_dialog.cpp
364         search_frame.cpp
365         sequence_diagram.cpp
366         sequence_dialog.cpp
367         service_response_time_dialog.cpp
368         show_packet_bytes_dialog.cpp
369         simple_dialog.cpp
370         simple_statistics_dialog.cpp
371         splash_overlay.cpp
372         supported_protocols_dialog.cpp
373         tabnav_tree_widget.cpp
374         tap_parameter_dialog.cpp
375         tcp_stream_dialog.cpp
376         time_shift_dialog.cpp
377         traffic_table_dialog.cpp
378         uat_dialog.cpp
379         uat_frame.cpp
380         voip_calls_dialog.cpp
381         wireless_frame.cpp
382         wireless_timeline.cpp
383         wireshark_application.cpp
384         wireshark_dialog.cpp
385         ${WIRESHARK_CUSTOM_QT_SRCS}
386 )
387
388 if(HAVE_PCAP_REMOTE)
389         set(WIRESHARK_QT_SRC
390                 ${WIRESHARK_QT_SRC}
391                 remote_capture_dialog.cpp
392                 remote_settings_dialog.cpp
393         )
394 endif()
395
396 if(ENABLE_EXTCAP)
397         set(WIRESHARK_QT_SRC
398                 ${WIRESHARK_QT_SRC}
399                 extcap_argument.cpp
400                 extcap_argument_file.cpp
401                 extcap_argument_multiselect.cpp
402                 extcap_options_dialog.cpp
403         )
404 endif()
405
406 set(WIRESHARK_QT_TAP_SRC
407         expert_info_dialog.cpp
408         funnel_statistics.cpp
409         gsm_map_summary_dialog.cpp
410         io_graph_dialog.cpp
411         lte_mac_statistics_dialog.cpp
412         lte_rlc_statistics_dialog.cpp
413         mtp3_summary_dialog.cpp
414         multicast_statistics_dialog.cpp
415         rtp_stream_dialog.cpp
416         sctp_all_assocs_dialog.cpp
417         sctp_assoc_analyse_dialog.cpp
418         stats_tree_dialog.cpp
419         wlan_statistics_dialog.cpp
420         ${WIRESHARK_CUSTOM_TAP_SRC}
421 )
422
423 set(WIRESHARK_QT_FILES
424         ${WIRESHARK_QT_SRC}
425         ${WIRESHARK_QT_TAP_SRC}
426 )
427
428 set(WIRESHARK_QT_UI
429         about_dialog.ui
430         address_editor_frame.ui
431         bluetooth_att_server_attributes_dialog.ui
432         bluetooth_device_dialog.ui
433         bluetooth_devices_dialog.ui
434         bluetooth_hci_summary_dialog.ui
435         capture_file_properties_dialog.ui
436         capture_interfaces_dialog.ui
437         capture_preferences_frame.ui
438         coloring_rules_dialog.ui
439         column_preferences_frame.ui
440         column_editor_frame.ui
441         compiled_filter_output.ui
442         conversation_hash_tables_dialog.ui
443         decode_as_dialog.ui
444         display_filter_expression_dialog.ui
445         dissector_tables_dialog.ui
446         enabled_protocols_dialog.ui
447         expert_info_dialog.ui
448         export_object_dialog.ui
449         export_pdu_dialog.ui
450         file_set_dialog.ui
451         filter_dialog.ui
452         filter_expression_frame.ui
453         firewall_rules_dialog.ui
454         follow_stream_dialog.ui
455         font_color_preferences_frame.ui
456         funnel_string_dialog.ui
457         funnel_text_dialog.ui
458         gsm_map_summary_dialog.ui
459         iax2_analysis_dialog.ui
460         import_text_dialog.ui
461         interface_frame.ui
462         interface_toolbar.ui
463         io_graph_dialog.ui
464         layout_preferences_frame.ui
465         lbm_lbtrm_transport_dialog.ui
466         lbm_lbtru_transport_dialog.ui
467         lbm_stream_dialog.ui
468         lte_rlc_graph_dialog.ui
469         main_welcome.ui
470         main_window.ui
471         main_window_preferences_frame.ui
472         manage_interfaces_dialog.ui
473         module_preferences_scroll_area.ui
474         mtp3_summary_dialog.ui
475         packet_comment_dialog.ui
476         packet_dialog.ui
477         packet_format_group_box.ui
478         packet_range_group_box.ui
479         preference_editor_frame.ui
480         preferences_dialog.ui
481         print_dialog.ui
482         profile_dialog.ui
483         progress_frame.ui
484         protocol_hierarchy_dialog.ui
485         resolved_addresses_dialog.ui
486         rtp_analysis_dialog.ui
487         rtp_player_dialog.ui
488         rtp_stream_dialog.ui
489         sctp_all_assocs_dialog.ui
490         sctp_assoc_analyse_dialog.ui
491         sctp_chunk_statistics_dialog.ui
492         sctp_graph_dialog.ui
493         sctp_graph_arwnd_dialog.ui
494         sctp_graph_byte_dialog.ui
495         search_frame.ui
496         sequence_dialog.ui
497         show_packet_bytes_dialog.ui
498         splash_overlay.ui
499         supported_protocols_dialog.ui
500         tap_parameter_dialog.ui
501         tcp_stream_dialog.ui
502         time_shift_dialog.ui
503         traffic_table_dialog.ui
504         uat_dialog.ui
505         uat_frame.ui
506         voip_calls_dialog.ui
507         wireless_frame.ui
508 )
509
510 if(HAVE_PCAP_REMOTE)
511         set(WIRESHARK_QT_UI
512                 ${WIRESHARK_QT_UI}
513                 remote_capture_dialog.ui
514                 remote_settings_dialog.ui
515         )
516 endif()
517
518 if(ENABLE_EXTCAP)
519         set(WIRESHARK_QT_UI
520                 ${WIRESHARK_QT_UI}
521                 extcap_options_dialog.ui
522         )
523 endif()
524
525 set(WIRESHARK_QT_TS
526         wireshark_de.ts
527         wireshark_en.ts # lupdate -pluralonly
528         wireshark_fr.ts
529         wireshark_it.ts
530         wireshark_ja_JP.ts
531         wireshark_pl.ts
532         wireshark_zh_CN.ts
533 )
534
535 foreach(_file ${WIRESHARK_QT_TS})
536         get_filename_component(_qresource ${_file} NAME_WE)
537         set(_qresource_qm "${_qresource}.qm")
538         set(i18n_qresource "${i18n_qresource}\n    <file>${_qresource_qm}</file>")
539         set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc PROPERTIES OBJECT_DEPENDS ${_qresource_qm})
540 endforeach()
541 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/i18n.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc)
542
543 set(WIRESHARK_QT_QRC
544         ../../image/about.qrc
545         ../../image/languages/languages.qrc
546         ../../image/layout.qrc
547         ../../image/toolbar.qrc
548         ../../image/wsicon.qrc
549         ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc
550 )
551
552 include_directories(
553         ${CMAKE_CURRENT_BINARY_DIR}
554         ${CMAKE_CURRENT_SOURCE_DIR}
555 )
556
557 SET(CMAKE_AUTOMOC TRUE)
558
559 if (QT_VERSION EQUAL 5)
560         QT5_ADD_TRANSLATION(WIRESHARK_QT_QM ${WIRESHARK_QT_TS})
561         QT5_ADD_RESOURCES(WIRESHARK_QT_QRC_SRC ${WIRESHARK_QT_QRC})
562         QT5_WRAP_UI(WIRESHARK_QT_UI_SRC ${WIRESHARK_QT_UI})
563 else()
564         QT4_ADD_TRANSLATION(WIRESHARK_QT_QM ${WIRESHARK_QT_TS})
565         QT4_ADD_RESOURCES(WIRESHARK_QT_QRC_SRC ${WIRESHARK_QT_QRC})
566         QT4_WRAP_UI(WIRESHARK_QT_UI_SRC ${WIRESHARK_QT_UI})
567 endif()
568
569 add_custom_target(
570         translations ALL
571         DEPENDS
572                 ${WIRESHARK_QT_QM}
573 )
574 set_target_properties(translations PROPERTIES FOLDER "UI")
575
576 set_source_files_properties(
577         ${WIRESHARK_QT_FILES}
578         PROPERTIES
579         COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
580 )
581
582 add_definitions(${QT_DEFINITIONS})
583
584 register_tap_files(wireshark-tap-register.c
585         taps
586         ${WIRESHARK_QT_TAP_SRC}
587 )
588
589 source_group("ui\\moc Source Files" FILES ${WIRESHARK_QT_MOC_SRC})
590 source_group("ui\\Header" FILES ${WIRESHARK_QT_UI_SRC})
591 source_group("ui\\UIC Files" FILES ${WIRESHARK_QT_UI})
592 source_group("ui\\qrc" FILES ${WIRESHARK_QT_QRC_SRC} ${WIRESHARK_QT_QRC})
593 source_group("ui\\Header" FILES ${WIRESHARK_QT_HEADERS})
594 source_group("ui\\Widget Header" FILES ${WIRESHARK_WIDGET_HEADERS})
595 source_group("ui\\Widget Source" FILES ${WIRESHARK_WIDGET_SRCS})
596 source_group("ui\\Utils Headers Files" FILES ${WIRESHARK_UTILS_HEADERS})
597 source_group("ui\\Utils Source" FILES ${WIRESHARK_UTILS_SRCS})
598 source_group("ui\\Models Headers" FILES ${WIRESHARK_MODEL_HEADERS})
599 source_group("ui\\Models Source" FILES ${WIRESHARK_MODEL_SRCS})
600
601 add_library(qtui STATIC
602         #Included so that Visual Studio can properly put header files in solution
603         ${WIRESHARK_QT_HEADERS}
604         ${WIRESHARK_WIDGET_HEADERS}
605         ${WIRESHARK_UTILS_HEADERS}
606         ${WIRESHARK_MODEL_HEADERS}
607
608         ${WIRESHARK_QT_SRC}
609         ${WIRESHARK_WIDGET_SRCS}
610         ${WIRESHARK_UTILS_SRCS}
611         ${WIRESHARK_MODEL_SRCS}
612
613         ${WIRESHARK_QT_TAP_SRC}
614         ${WIRESHARK_QT_UI_SRC}
615         ${WIRESHARK_QT_MOC_SRC}
616         ${WIRESHARK_QT_QRC_SRC}
617         wireshark-tap-register.c
618 )
619 add_dependencies(qtui translations)
620 set_target_properties(qtui PROPERTIES
621         LINK_FLAGS "${WS_LINK_FLAGS}"
622         FOLDER "UI"
623 )
624
625 #
626 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
627 #
628 # Local variables:
629 # c-basic-offset: 8
630 # tab-width: 8
631 # indent-tabs-mode: t
632 # End:
633 #
634 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
635 # :indentSize=8:tabSize=8:noTabs=false:
636 #