Rework Windows Wireshark Qt build configuration a bit:
[obnox/wireshark/wip.git] / ui / qt / QtShark.pro
1 #-------------------------------------------------
2 #
3 # Project created by QtCreator 2010-12-21T11:38:10
4 #
5 #-------------------------------------------------
6
7 QT += core gui
8
9 TARGET = Wireshark
10 TEMPLATE = app
11
12 unix {
13     CONFIG += link_pkgconfig
14     PKGCONFIG += \
15         glib-2.0
16
17     # Some versions of Ubuntu don't ship with zlib.pc
18     eval(PKGCONFIG += zlib) {
19         PKGCONFIG += zlib
20     }
21 }
22
23 xwin32 {
24 message( )
25 message(CONFIG:)
26 message(  $$CONFIG)
27 message( )
28 message(CFLAGS:)
29 message(  $$QMAKE_CFLAGS)
30 message(  $$QMAKE_CFLAGS_RELEASE)
31 message(  $$QMAKE_CFLAGS_DEBUG)
32 message( )
33 message(LFLAGS:)
34 message(  $$QMAKE_LFLAGS)
35 message(  $$QMAKE_LFLAGS_RELEASE)
36 message(  $$QMAKE_LFLAGS_DEBUG)
37 }
38
39 win32 {
40     # Note:
41     # Windows Wireshark is compiled with /MD and thus must
42     #  be linked with the "release" versions of the Qt libraries
43     #  which are also compiled with /MD.
44     #
45     # Also: Windows Wireshark is compiled with /Zi and linked with /DEBUG
46     #  which enables source level Wireshark debugging using the
47     #  Windows Visual Studio debugger.
48     #  So: QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS are set to match
49     #  those used building Windows Wireshark. (See config.pri).
50     #  Among other things source-level debugging of the Qt version of Wireshark
51     # (including the ui/qt source) is thus enabled.
52     #
53     #  Note that in this case source level debugging of the Qt
54     #  *libraries* will not be possible since the Qt release libs are
55     #  not compiled with /Zi (and not linked with /DEBUG).
56     #  The Qt "debug" libraries are compiled with /MDd. To build a
57     #  Wireshark-Qt debug version with the ability to do source level debugging
58     #  of the Qt libraries themselves requires that Wireshark first be built with /MDd.
59     #  Presumably doing source-level Qt library debugging shoyuld rarely be needed.
60
61     # We want to build only the QtShark linked with the QT "release" libraries
62     #  so disable debug & etc.
63 ##    CONFIG -= release
64     CONFIG -= debug
65     CONFIG -= debug_and_release
66
67     # Use only Wireshark CFLAGS and LDFLAGS from config.nmake (as provided via config.pri)
68     #  for building the "release" version of Wireshark-Qt
69     # (e.g., so we don't get the Qt release CFLAGS [specifically /O2]
70     QMAKE_CFLAGS_RELEASE = ""
71     QMAKE_LFLAGS_RELEASE = ""
72
73     # XXX We need to figure out how to pull this in from config.nmake.
74     !include( config.pri ) {
75         error("Can't find config.pri. Have you run 'nmake -f Makefile.nmake' two directories up?")
76     }
77
78     DESTDIR = wireshark-qt
79 }
80
81 xwin32 {
82 message( )
83 message(CONFIG:)
84 message(  $$CONFIG)
85 message( )
86 message(CFLAGS:)
87 message(  $$QMAKE_CFLAGS)
88 message(  $$QMAKE_CFLAGS_RELEASE)
89 message(  $$QMAKE_CFLAGS_DEBUG)
90 message( )
91 message(LFLAGS:)
92 message(  $$QMAKE_LFLAGS)
93 message(  $$QMAKE_LFLAGS_RELEASE)
94 message(  $$QMAKE_LFLAGS_DEBUG)
95 }
96
97 INCLUDEPATH += ../.. ../../wiretap
98 win32:INCLUDEPATH += \
99     $${WIRESHARK_LIB_DIR}/gtk2/include/glib-2.0 $${WIRESHARK_LIB_DIR}/gtk2/lib/glib-2.0/include \
100     $${WIRESHARK_LIB_DIR}/WpdPack/Include \
101     $${WIRESHARK_LIB_DIR}/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include \
102     $${WIRESHARK_LIB_DIR}/zlib125/include
103
104 # XXX - If we add ../gtk/recent.c to SOURCES, jom will try to compile everything
105 # in ../gtk. Until we move the things we need in recent.c to a common file, simply
106 # copy it to our current directory.
107 #recent.target = recent.c
108 #!win32:recent.commands = $$QMAKE_COPY ../gtk/$$recent.target .
109 #win32:recent.commands = $$QMAKE_COPY ..\\gtk\\$$recent.target .
110 #recent.depends = ../gtk/$$recent.target
111 #QMAKE_EXTRA_TARGETS += recent
112
113 SOURCES += \
114     ../../airpcap_loader.c \
115     ../../alert_box.c     \
116     ../../capture-pcap-util.c     \
117     ../../capture.c       \
118     ../../capture_ifinfo.c \
119     ../../capture_info.c  \
120     ../../capture_opts.c \
121     ../../capture_sync.c  \
122     ../../capture_ui_utils.c \
123     ../../cfile.c \
124     ../../clopts_common.c \
125     ../../color_filters.c \
126     ../../disabled_protos.c       \
127     ../../file.c  \
128     ../../fileset.c       \
129     ../../filters.c       \
130     ../../frame_data_sequence.c   \
131     ../../g711.c \
132     ../../merge.c \
133     ../../packet-range.c  \
134     ../../print.c \
135     ../../proto_hier_stats.c      \
136     ../../ps.c    \
137     ../../recent.c \
138     ../../summary.c       \
139     ../../sync_pipe_write.c       \
140     ../../tap-megaco-common.c     \
141     ../../tap-rtp-common.c    \
142     ../../tempfile.c      \
143     ../../timestats.c     \
144     ../../u3.c \
145     ../../util.c  \
146     ../../version_info.c \
147     byte_view_tab.cpp \
148     byte_view_text.cpp \
149     capture_file_dialog.cpp \
150     capture_info_dialog.cpp \
151     capture_interface_dialog.cpp \
152     color_dialog.cpp \
153     color_utils.cpp \
154     display_filter_combo.cpp \
155     display_filter_edit.cpp \
156     fileset_dialog.cpp \
157     interface_tree.cpp \
158     main.cpp \
159     main_status_bar.cpp \
160     main_welcome.cpp \
161     main_window.cpp \
162     monospace_font.cpp \
163     packet_list.cpp \
164     packet_list_model.cpp \
165     packet_list_record.cpp \
166     progress_dialog.cpp \
167     proto_tree.cpp \
168     qt_ui_utils.cpp \
169     recent_file_status.cpp \
170     simple_dialog_qt.cpp \
171     wireshark_application.cpp \
172     label_stack.cpp
173
174
175 unix:SOURCES += ../../capture-pcap-util-unix.c
176 win32:SOURCES += ../../capture-wpcap.c ../../capture_wpcap_packet.c
177
178 HEADERS  += \
179     ../../wsutil/privileges.h \
180     byte_view_tab.h \
181     byte_view_text.h \
182     capture_file_dialog.h \
183     capture_info_dialog.h \
184     capture_interface_dialog.h \
185     color_dialog.h \
186     color_utils.h \
187     display_filter_combo.h \
188     display_filter_edit.h \
189     fileset_dialog.h \
190     interface_tree.h \
191     main_status_bar.h \
192     main_welcome.h \
193     main_window.h \
194     monospace_font.h \
195     packet_list.h \
196     packet_list_model.h \
197     packet_list_record.h \
198     progress_dialog.h \
199     proto_tree.h \
200     qt_ui_utils.h \
201     qt_ui_utils.h \
202     recent_file_status.h \
203     simple_dialog_qt.h \
204     wireshark_application.h \
205     label_stack.h
206
207
208 FORMS += main_window.ui
209
210 DEFINES += HAVE_CONFIG_H INET6 REENTRANT
211 unix:DEFINES += _U_=\"__attribute__((unused))\"
212
213 macx:QMAKE_LFLAGS += \
214     -framework CoreServices \
215     -framework ApplicationServices -framework CoreFoundation -framework CoreServices
216
217 unix:LIBS += -L../../lib -Wl,-rpath ../../lib -lwireshark -lwiretap -lwsutil \
218     -lpcap -lportaudio
219 macx:LIBS += -Wl,-macosx_version_min,10.5 -liconv
220
221 # http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
222 unix: {
223     EXTRA_BINFILES = \
224         ../../dumpcap \
225         ../../lib/*.so  \
226 }
227 unix:!macx {
228     for(FILE,EXTRA_BINFILES){
229         QMAKE_POST_LINK += $$quote(cp $${FILE} .$$escape_expand(\n\t))
230     }
231 }
232 # qmake 2.01a / Qt 4.7.0 doesn't set DESTDIR on OS X.
233 macx {
234     for(FILE,EXTRA_BINFILES){
235         QMAKE_POST_LINK += $$quote(cp $${FILE} Wireshark.app/Contents/MacOS$$escape_expand(\n\t))
236     }
237 }
238
239 win32 {
240     LIBS += \
241         wsock32.lib user32.lib shell32.lib comctl32.lib \
242         -L../../epan -llibwireshark -L../../wsutil -llibwsutil -L../../wiretap -lwiretap-1.7.0 \
243         -L$${GLIB_DIR}/lib -lglib-2.0 -lgmodule-2.0
244
245     !isEmpty(PORTAUDIO_DIR) {
246         PA_SOURCES = \
247             common/pa_allocation.c \
248             common/pa_converters.c \
249             common/pa_cpuload.c \
250             common/pa_dither.c \
251             common/pa_front.c \
252             common/pa_process.c \
253             common/pa_skeleton.c \
254             common/pa_stream.c \
255             common/pa_trace.c \
256             hostapi/wmme/pa_win_wmme.c \
257             os/win/pa_win_hostapis.c \
258             os/win/pa_win_util.c \
259             os/win/pa_win_waveformat.c \
260             os/win/pa_x86_plain_converters.c
261
262         for(FILE,PA_SOURCES){
263             SOURCES += $${PORTAUDIO_DIR}/src/$${FILE}
264         }
265     }
266
267     EXTRA_BINFILES = \
268         ../../dumpcap.exe \
269         ../../epan/libwireshark.dll ../../wiretap/wiretap-1.7.0.dll ../../wsutil/libwsutil.dll \
270         $${GLIB_DIR}/bin/libglib-2.0-0.dll $${GLIB_DIR}/bin/libgmodule-2.0-0.dll \
271         $${GLIB_DIR}/bin/libgthread-2.0-0.dll $${GLIB_DIR}/bin/intl.dll \
272         $${C_ARES_DIR}/bin/libcares-2.dll $${ZLIB_DIR}/zlib1.dll \
273         $${GNUTLS_DIR}/bin/libgcrypt-11.dll $${GNUTLS_DIR}/bin/libgnutls-26.dll \
274         $${GNUTLS_DIR}/bin/libgpg-error-0.dll $${GNUTLS_DIR}/bin/ $${GNUTLS_DIR}/bin/libtasn1-3.dll \
275         $${GNUTLS_DIR}/bin/libintl-8.dll $${SMI_DIR}/bin/libsmi-2.dll \
276         $${KFW_DIR}/bin/comerr32.dll $${KFW_DIR}/bin/krb5_32.dll $${KFW_DIR}/bin/k5sprt32.dll \
277         $${LUA_DIR}/lua5.1.dll \
278         ../../colorfilters ../../dfilters ../../cfilters
279
280     EXTRA_BINFILES ~= s,/,\\,g
281     for(FILE,EXTRA_BINFILES){
282         QMAKE_POST_LINK +=$$quote($(COPY_FILE) $${FILE} $(DESTDIR)$$escape_expand(\n\t))
283     }
284     PLUGINS_DIR = $(DESTDIR)\plugins\\$${VERSION}
285     QMAKE_POST_LINK +=$$quote($(CHK_DIR_EXISTS) $${PLUGINS_DIR} $(MKDIR) $${PLUGINS_DIR}$$escape_expand(\n\t))
286     QMAKE_POST_LINK +=$$quote($(COPY_FILE) ..\..\wireshark-gtk2\plugins\\$${VERSION}\*.dll $(DESTDIR)\plugins\\$${VERSION}$$escape_expand(\n\t))
287
288     # This doesn't depend on wireshark-gtk2. It also doesn't work.
289     #PLUGINS_IN_PWD=$${IN_PWD}
290     #PLUGINS_OUT_PWD=$${OUT_PWD}
291     #QMAKE_POST_LINK +=$$quote(cd $$replace(PLUGINS_IN_PWD, /, \\)\\..\\..\\plugins$$escape_expand(\n\t))
292     #QMAKE_POST_LINK +=$$quote(nmake -f Makefile.nmake INSTALL_DIR=$$replace(PLUGINS_OUT_PWD, /, \\)\\$(DESTDIR)$$escape_expand(\n\t))
293     #QMAKE_POST_LINK +=$$quote(cd $$replace(PLUGINS_IN_PWD, /, \\)$$escape_expand(\n\t))
294
295 }
296
297
298 RESOURCES += \
299     toolbar.qrc \
300     welcome.qrc \
301     display_filter.qrc
302
303 ICON = ../../packaging/macosx/Resources/Wireshark.icns