Move merge.{h,c} into wiretap: these modules use wiretap to merge files.
[metze/wireshark/wip.git] / ui / qt / QtShark.pro
1 #-------------------------------------------------
2 #
3 # Project created by QtCreator 2010-12-21T11:38:10
4 #
5 #-------------------------------------------------
6 #
7 # $Id$
8 #
9 # Wireshark - Network traffic analyzer
10 # By Gerald Combs <gerald@wireshark.org>
11 # Copyright 1998 Gerald Combs
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #
27
28 isEqual(QT_MAJOR_VERSION, 4) {
29   QT += core gui
30 } else {
31   QT += core widgets printsupport
32 }
33
34 macx {
35     TARGET = Wireshark
36 } else {
37     TARGET = qtshark
38 }
39
40 TEMPLATE = app
41
42 TOP_SRCDIR = "$$PWD/../.."
43
44 CONFIG(debug, debug|release) {
45     DESTDIR = "$${TOP_SRCDIR}/wireshark-qt-debug"
46 }
47 CONFIG(release, debug|release) {
48     DESTDIR = "$${TOP_SRCDIR}/wireshark-qt-release"
49 }
50
51 QMAKE_INFO_PLIST = "$$PWD/../../packaging/macosx/Info.plist"
52
53 xxx {
54     message( )
55     message(CONFIG:)
56     message(  $$CONFIG)
57     message( )
58 }
59
60 unix {
61
62     #Check if Qt < 4.8.x (packagesExist is present in Qt >= 4.8)
63     contains(QT_VERSION, ^4\\.[0-7]\\..*) {
64         #Copy from mkspecs/features/qt_functions.prf (Qt 4.8)
65         defineTest(packagesExist) {
66             # this can't be done in global scope here because qt_functions is loaded
67             # before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it
68             # yet. oops.
69             isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config # keep consistent with link_pkgconfig.prf! too
70
71             for(package, ARGS) {
72             !system($$PKG_CONFIG --exists $$package):return(false)
73             }
74
75         return(true)
76         }
77     }
78
79     isEqual(QT_MAJOR_VERSION, 5) {
80         # Hack around what appears to be a bug in the 5.0.2 SDK
81         QT_CONFIG -= no-pkg-config
82     }
83     CONFIG += link_pkgconfig
84     PKGCONFIG += \
85         glib-2.0
86
87     packagesExist(portaudio-2.0) {
88         PKGCONFIG += portaudio-2.0
89     }
90
91     # Some versions of Ubuntu don't ship with zlib.pc
92     !macx {
93         eval(PKGCONFIG += zlib) {
94             PKGCONFIG += zlib
95         }
96     }
97
98     macx {
99         packagesExist(Qt5MacExtras) {
100             message( "Found Qt5MacExtras" )
101             QT += macextras
102         }
103     }
104 }
105
106 win32 {
107     # Note:
108     # Windows Wireshark is compiled with /MD and thus must
109     #  be linked with the "release" versions of the Qt libraries
110     #  which are also compiled with /MD.
111     #
112     # Also: Windows Wireshark is compiled with /Zi and linked with /DEBUG
113     #  which enables source level Wireshark debugging using the
114     #  Windows Visual Studio debugger.
115     #  So: QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS are set to match
116     #  those used building Windows Wireshark. (See config.pri).
117     #  Among other things source-level debugging of the Qt version of Wireshark
118     # (including the ui/qt source) is thus enabled.
119     #
120     #  Note that in this case source level debugging of the Qt
121     #  *libraries* will not be possible since the Qt release libs are
122     #  not compiled with /Zi (and not linked with /DEBUG).
123     #  The Qt "debug" libraries are compiled with /MDd. To build a
124     #  Wireshark-Qt debug version with the ability to do source level debugging
125     #  of the Qt libraries themselves requires that Wireshark first be built with /MDd.
126     #  Presumably doing source-level Qt library debugging shoyuld rarely be needed.
127
128     # We want to build only the QtShark linked with the QT "release" libraries
129     #  so disable debug & etc.
130 ##    CONFIG -= release
131     CONFIG -= debug
132     CONFIG -= debug_and_release
133
134     # Use only Wireshark CFLAGS, CXXFLAGS and LDFLAGS from config.nmake (as provided via config.pri)
135     #  for building the "release" version of Wireshark-Qt
136     # (e.g., so we don't get the Qt release CFLAGS [specifically /O2]
137     QMAKE_CFLAGS_RELEASE   = ""
138     QMAKE_CXXFLAGS_RELEASE = ""
139     QMAKE_LFLAGS_RELEASE   = ""
140
141     # XXX We need to figure out how to pull this in from config.nmake.
142     !include( config.pri ) {
143         error("Can't find config.pri. Have you run 'nmake -f Makefile.nmake' two directories up?")
144     }
145
146     !wireshark_manifest_info_required {
147         CONFIG -= embed_manifest_dll
148         CONFIG -= embed_manifest_exe
149     }
150 }
151
152 INCLUDEPATH += ../.. ../../wiretap
153 win32:INCLUDEPATH += \
154     $${WIRESHARK_LIB_DIR}/gtk2/include/glib-2.0 $${WIRESHARK_LIB_DIR}/gtk2/lib/glib-2.0/include \
155     $${WIRESHARK_LIB_DIR}/gtk3/include/glib-2.0 $${WIRESHARK_LIB_DIR}/gtk3/lib/glib-2.0/include \
156     $${WIRESHARK_LIB_DIR}/WpdPack/Include \
157     $${WIRESHARK_LIB_DIR}/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include \
158     $${WIRESHARK_LIB_DIR}/zlib125/include
159
160 # We have to manually trigger relinking each time one of these is modified.
161 # Is there any way to do this automatically?
162 SOURCES_WS_C = \
163     ../../airpcap_loader.c \
164     ../../capture-pcap-util.c     \
165     ../../capture.c       \
166     ../../capture_ifinfo.c \
167     ../../capture_info.c  \
168     ../../capture_opts.c \
169     ../../capture_sync.c  \
170     ../../capture_ui_utils.c \
171     ../../cfile.c \
172     ../../cfutils.c \
173     ../../clopts_common.c \
174     ../../color_filters.c \
175     ../../file.c  \
176     ../../fileset.c       \
177     ../../filters.c       \
178     ../../frame_tvbuff.c   \
179     ../../g711.c \
180     ../../proto_hier_stats.c      \
181     ../../summary.c       \
182     ../../sync_pipe_write.c       \
183     ../../u3.c \
184     ../../version_info.c
185
186 unix:SOURCES_WS_C += ../../capture-pcap-util-unix.c
187 win32:SOURCES_WS_C += \
188     ../../capture_win_ifnames.c \
189     ../../capture-wpcap.c \
190     ../../capture_wpcap_packet.c \
191     ../../ui/win32/console_win32.c \
192     ../../ui/win32/file_dlg_win32.c
193
194 HEADERS_WS_C  = \
195     ../../wsutil/privileges.h
196
197 FORMS += \
198     capture_preferences_frame.ui \
199     column_preferences_frame.ui \
200     export_object_dialog.ui \
201     file_set_dialog.ui \
202     filter_expressions_preferences_frame.ui \
203     font_color_preferences_frame.ui \
204     import_text_dialog.ui \
205     layout_preferences_frame.ui \
206     main_welcome.ui \
207     main_window.ui \
208     main_window_preferences_frame.ui \
209     module_preferences_scroll_area.ui \
210     packet_comment_dialog.ui \
211     packet_format_group_box.ui \
212     packet_range_group_box.ui \
213     preferences_dialog.ui \
214     print_dialog.ui \
215     profile_dialog.ui \
216     search_frame.ui \
217     splash_overlay.ui \
218     summary_dialog.ui \
219     time_shift_dialog.ui \
220
221
222 win32 { ## These should be in config.pri ??
223     !isEmpty(PORTAUDIO_DIR) {
224         PA_OBJECTS = \
225             ../gtk/pa_allocation.obj \
226             ../gtk/pa_converters.obj \
227             ../gtk/pa_cpuload.obj \
228             ../gtk/pa_dither.obj \
229             ../gtk/pa_front.obj \
230             ../gtk/pa_process.obj \
231             ../gtk/pa_skeleton.obj \
232             ../gtk/pa_stream.obj \
233             ../gtk/pa_trace.obj \
234             ../gtk/pa_win_wmme.obj \
235             ../gtk/pa_win_hostapis.obj \
236             ../gtk/pa_win_util.obj \
237             ../gtk/pa_win_waveformat.obj \
238             ../gtk/pa_x86_plain_converters.obj
239         PA_OBJECTS ~= s,/,\\,g
240     }
241 }
242
243 HEADERS += $$HEADERS_WS_C \
244     accordion_frame.h \
245     capture_preferences_frame.h \
246     column_preferences_frame.h \
247     export_dissection_dialog.h \
248     export_object_dialog.h \
249     filter_expressions_preferences_frame.h \
250     font_color_preferences_frame.h \
251     layout_preferences_frame.h \
252     main_window_preferences_frame.h \
253     module_preferences_scroll_area.h \
254     packet_comment_dialog.h \
255     packet_format_group_box.h \
256     preferences_dialog.h \
257     print_dialog.h \
258     profile_dialog.h \
259     search_frame.h \
260     splash_overlay.h \
261     summary_dialog.h \
262     tango_colors.h \
263
264
265 win32 {
266     OBJECTS_WS_C = $$SOURCES_WS_C
267     OBJECTS_WS_C ~= s/[.]c/.obj/g
268     OBJECTS_WS_C ~= s,/,\\,g
269     OBJECTS_WS_C += ../../image/file_dlg_win32.res
270 } else {
271 ## XXX: Shouldn't need to (re)compile WS_C sources ??
272     SOURCES += $$SOURCES_WS_C
273 }
274
275 DEFINES += INET6 REENTRANT
276 unix:DEFINES += _U_=\"__attribute__((unused))\"
277
278 macx:QMAKE_LFLAGS += \
279     -framework CoreServices \
280     -framework ApplicationServices \
281     -framework CoreFoundation \
282     -framework SystemConfiguration
283
284 unix {
285     exists(../../epan/.libs/libw*) {
286         message( "Assuming Autotools library paths" )
287         LIBS += \
288             -L.. \
289             -L../../epan/.libs -Wl,-rpath ../../epan/.libs \
290             -L../../wiretap/.libs -Wl,-rpath ../../wiretap/.libs \
291             -L../../wsutil/.libs -Wl,-rpath ../../wsutil/.libs
292     } else:exists(../../lib/libw*) {
293         message( "Assuming CMake library path" )
294         LIBS += -L../../lib -Wl,-rpath ../../lib
295     }
296
297     LIBS += -lwireshark -lwiretap -lwsutil -lui \
298     -lpcap
299
300     exists(../libui_dirty.a) {
301         LIBS += -lui_dirty
302     }
303 }
304
305 macx:LIBS += -Wl,-macosx_version_min,10.6 -liconv -lz
306
307 # XXX Copy this only if we're linking with Lua.
308 EXTRA_BINFILES = \
309     ../../epan/wslua/console.lua
310
311 # http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
312 unix: {
313     EXTRA_BINFILES += \
314         ../../dumpcap
315
316     exists(../../epan/.libs/libw*) {
317         EXTRA_BINFILES += \
318             ../../epan/.libs/libwireshark.* \
319             ../../wiretap/.libs/libwiretap.* \
320             ../../wsutil/.libs/libwsutil.*
321     } else:exists(../../lib/libw*) {
322         EXTRA_BINFILES += ../../lib/libwireshark.* \
323                         ../../lib/libwiretap.* \
324                         ../../lib/libwsutil.*
325     }
326
327 }
328 unix:!macx {
329     for(FILE,EXTRA_BINFILES){
330         QMAKE_POST_LINK += $$quote(cp $${FILE} .$$escape_expand(\\n\\t))
331     }
332 }
333 # qmake 2.01a / Qt 4.7.0 doesn't set DESTDIR on OS X.
334 macx {
335     for(FILE,EXTRA_BINFILES){
336         QMAKE_POST_LINK += $$quote(cp -R $${FILE} $${DESTDIR}/$${TARGET}.app/Contents/MacOS$$escape_expand(\\n\\t))
337     }
338 }
339
340 win32 {
341     # Add the wireshark objects to LIBS
342     LIBS += $$OBJECTS_WS_C
343     LIBS += $$PA_OBJECTS
344     LIBS += \
345         $${guilibsdll} $${HHC_LIBS} \
346         -L../../epan -llibwireshark -L../../wsutil -llibwsutil -L../../wiretap -lwiretap-$${WTAP_VERSION} \
347         -L.. -llibui \
348         -L$${GLIB_DIR}/lib -lglib-2.0 -lgmodule-2.0 \
349         -L$${WINSPARKLE_DIR} -lWinSparkle
350
351     !isEmpty(MSVCR_DLL) {
352         EXTRA_BINFILES += \"$${MSVCR_DLL}\"
353     }
354
355     CONFIG(debug, debug|release) {
356         EXTRA_BINFILES += \
357             $$[QT_INSTALL_BINS]/QtCored4.dll \
358             $$[QT_INSTALL_BINS]/QtGuid4.dll
359     } else:CONFIG(release, debug|release) {
360         EXTRA_BINFILES += \
361             $$[QT_INSTALL_BINS]/QtCore4.dll \
362             $$[QT_INSTALL_BINS]/QtGui4.dll
363     }
364
365     EXTRA_BINFILES += \
366         ../../dumpcap.exe \
367         ../../epan/libwireshark.dll ../../wiretap/wiretap-$${WTAP_VERSION}.dll ../../wsutil/libwsutil.dll \
368         $${GLIB_DIR}/bin/libglib-2.0-0.dll $${GLIB_DIR}/bin/libgmodule-2.0-0.dll \
369         $${GLIB_DIR}/bin/libgthread-2.0-0.dll $${GLIB_DIR}/bin/$${INTL_DLL} \
370         $${C_ARES_DIR}/bin/libcares-2.dll $${ZLIB_DIR}/zlib1.dll \
371         $${GNUTLS_DIR}/bin/libgcrypt-11.dll $${GNUTLS_DIR}/bin/libgnutls-26.dll \
372         $${GNUTLS_DIR}/bin/libgpg-error-0.dll $${GNUTLS_DIR}/bin/libtasn1-3.dll \
373         $${GNUTLS_DIR}/bin/libintl-8.dll $${SMI_DIR}/bin/libsmi-2.dll \
374         $${LUA_DIR}/lua5.1.dll \
375         $${GEOIP_DIR}/bin/libGeoIP-1.dll \
376         $${WINSPARKLE_DIR}/WinSparkle.dll \
377         ../../colorfilters ../../dfilters ../../cfilters
378
379     wireshark_use_kfw {
380         EXTRA_BINFILES += \
381             $${KFW_DIR}/bin/comerr32.dll $${KFW_DIR}/bin/krb5_32.dll $${KFW_DIR}/bin/k5sprt32.dll
382     }
383
384     EXTRA_BINFILES ~= s,/,\\,g
385     for(FILE,EXTRA_BINFILES){
386         QMAKE_POST_LINK +=$$quote($(COPY_FILE) $${FILE} $(DESTDIR)$$escape_expand(\\n\\t))
387     }
388     PLUGINS_DIR = $(DESTDIR)\\plugins\\$${VERSION_FULL}
389     QMAKE_POST_LINK +=$$quote($(CHK_DIR_EXISTS) $${PLUGINS_DIR} $(MKDIR) $${PLUGINS_DIR}$$escape_expand(\\n\\t))
390     QMAKE_POST_LINK +=$$quote($(COPY_FILE) ..\\..\\$${INSTALL_DIR}\\plugins\\$${VERSION_FULL}\\*.dll $(DESTDIR)\\plugins\\$${VERSION_FULL}$$escape_expand(\\n\\t))
391
392     # This doesn't depend on wireshark-gtk2. It also doesn't work.
393     #PLUGINS_IN_PWD=$${IN_PWD}
394     #PLUGINS_OUT_PWD=$${OUT_PWD}
395     #QMAKE_POST_LINK +=$$quote(cd $$replace(PLUGINS_IN_PWD, /, \\)\\..\\..\\plugins$$escape_expand(\\n\\t))
396     #QMAKE_POST_LINK +=$$quote(nmake -f Makefile.nmake INSTALL_DIR=$$replace(PLUGINS_OUT_PWD, /, \\)\\$(DESTDIR)$$escape_expand(\\n\\t))
397     #QMAKE_POST_LINK +=$$quote(cd $$replace(PLUGINS_IN_PWD, /, \\)$$escape_expand(\\n\\t))
398 }
399
400 RESOURCES += \
401     ../../image/display_filter.qrc \
402     ../../image/layout.qrc \
403     ../../image/status.qrc \
404     ../../image/toolbar.qrc \
405     i18n.qrc \
406     welcome.qrc \
407
408
409 TRANSLATIONS = \
410         qtshark_de.ts   \
411         qtshark_fr.ts
412
413 ICON = ../../packaging/macosx/Resources/Wireshark.icns
414
415 RC_FILE = ../../image/wireshark.rc
416
417 # http://lists.trolltech.com/qt-interest/2008-01/thread00516-0.html
418 # http://www.freehackers.org/thomas/2009/03/10/fixing-qmake-missing-rule-for-ts-qm/
419 !isEmpty(TRANSLATIONS) {
420
421     isEmpty(QMAKE_LRELEASE) {
422         win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
423         else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
424     }
425
426     isEmpty(TS_DIR):TS_DIR = Translations
427
428     TSQM.name = lrelease ${QMAKE_FILE_IN}
429     TSQM.input = TRANSLATIONS
430     TSQM.output = $$TS_DIR/${QMAKE_FILE_BASE}.qm
431     TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN}
432     TSQM.CONFIG = no_link
433 #    QMAKE_EXTRA_COMPILERS += TSQM
434 #    PRE_TARGETDEPS += compiler_TSQM_make_all
435 } else {
436     message(No translation files in project)
437 }
438
439 win32: QMAKE_CLEAN += *.pdb
440
441 HEADERS += \
442     byte_view_tab.h \
443     byte_view_text.h \
444     capture_file_dialog.h \
445     capture_info_dialog.h \
446     capture_interface_dialog.h \
447     color_dialog.h \
448     color_utils.h \
449     display_filter_combo.h \
450     display_filter_edit.h \
451     file_set_dialog.h \
452     import_text_dialog.h \
453     interface_tree.h \
454     label_stack.h \
455     main_status_bar.h \
456     main_welcome.h \
457     main_window.h \
458     packet_list.h \
459     packet_list_model.h \
460     packet_list_record.h \
461     packet_range_group_box.h \
462     progress_bar.h \
463     proto_tree.h \
464     qt_ui_utils.h \
465     qt_ui_utils.h \
466     recent_file_status.h \
467     related_packet_delegate.h \
468     simple_dialog_qt.h \
469     sparkline_delegate.h \
470     syntax_line_edit.h \
471     time_shift_dialog.h \
472     wireshark_application.h \
473
474
475 SOURCES += \
476     accordion_frame.cpp \
477     byte_view_tab.cpp \
478     byte_view_text.cpp \
479     capture_file_dialog.cpp \
480     capture_info_dialog.cpp \
481     capture_interface_dialog.cpp \
482     capture_preferences_frame.cpp \
483     color_dialog.cpp \
484     color_utils.cpp \
485     column_preferences_frame.cpp \
486     display_filter_combo.cpp \
487     display_filter_edit.cpp \
488     export_dissection_dialog.cpp \
489     export_object_dialog.cpp \
490     file_set_dialog.cpp \
491     filter_expressions_preferences_frame.cpp \
492     font_color_preferences_frame.cpp \
493     import_text_dialog.cpp \
494     interface_tree.cpp \
495     label_stack.cpp \
496     layout_preferences_frame.cpp \
497     main.cpp \
498     main_status_bar.cpp \
499     main_welcome.cpp \
500     main_window.cpp \
501     main_window_preferences_frame.cpp \
502     main_window_slots.cpp \
503     module_preferences_scroll_area.cpp \
504     packet_comment_dialog.cpp \
505     packet_format_group_box.cpp \
506     packet_list.cpp \
507     packet_list_model.cpp \
508     packet_list_record.cpp \
509     packet_range_group_box.cpp \
510     preferences_dialog.cpp \
511     print_dialog.cpp \
512     profile_dialog.cpp \
513     progress_bar.cpp \
514     proto_tree.cpp \
515     qt_ui_utils.cpp \
516     recent_file_status.cpp \
517     related_packet_delegate.cpp \
518     search_frame.cpp \
519     simple_dialog_qt.cpp \
520     sparkline_delegate.cpp \
521     splash_overlay.cpp \
522     summary_dialog.cpp \
523     syntax_line_edit.cpp \
524     time_shift_dialog.cpp \
525     wireshark_application.cpp \