Wireshark-dev: Re: [Wireshark-dev] How to disable QT_MULTIMEDIA_LIB during cmake

From: Roland Knall <rknall@xxxxxxxxx>
Date: Wed, 28 Apr 2021 15:11:56 +0200
A merge request has been generated for this: https://gitlab.com/wireshark/wireshark/-/merge_requests/2849

cheers

Am Mi., 28. Apr. 2021 um 14:33 Uhr schrieb Roland Knall <rknall@xxxxxxxxx>:
I have created a change which handles the CMAKE stuff correctly (analog to extcap & pcap, ...)

I would need some help from you Jirka for the RTP specifics. 

kind regards
Roland

Am Mi., 28. Apr. 2021 um 14:01 Uhr schrieb John Thacker <johnthacker@xxxxxxxxx>:
In general some features can be disabled, see CMakeOptions.txt for a list, but Qt Multimedia Lib cannot be disabled easily.

If you look at cmakeconfig.h.in:

/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION

/* Define if we have QtMultimedia */
#define QT_MULTIMEDIA_LIB 1

/* Define if we have QtMacExtras */
#cmakedefine QT_MACEXTRAS_LIB 1

You will see that QT_MULTIMEDIA_LIB is always defined.

If you *both* change that line to

#cmakedefine QT_MULTIMEDIA_LIB 1

*and*

comment out Qt5Multimedia from CMakeLists.txt

and then rerun cmake (possibly after removing config.h and build.ninja or your Makefile from the build directory),
then you can build without QT_MULTIMEDIA_LIB being set. On the current master, when doing so, I get the following build error:

In file included from ui/qt/qtui_autogen/EWIEGA46WW/../../../../../wireshark/ui/qt/rtp_stream_dialog.h:16,
                 from ui/qt/qtui_autogen/EWIEGA46WW/../../../../../wireshark/ui/qt/main_window.h:78,
                 from ui/qt/qtui_autogen/EWIEGA46WW/moc_main_window.cpp:10,
                 from ui/qt/qtui_autogen/mocs_compilation.cpp:65:
ui/qt/qtui_autogen/EWIEGA46WW/../../../../../wireshark/ui/qt/rtp_player_dialog.h:27:10: fatal error: QAudioDeviceInfo: No such file or directory
   27 | #include <QAudioDeviceInfo>
      |          ^~~~~~~~~~~~~~~~~~

Because QAudioDeviceInfo is part of Qt Multimedia but not properly protected by that #ifdef, which is exactly what you're trying to test.

John Thacker


On Mon, Apr 26, 2021, 5:03 AM Jirka Novak <j.novak@xxxxxxxxxxxx> wrote:
Hi,

  I would like to test whether #ifdef QT_MULTIMEDIA_LIB are correct in
source code so I need to disable it during cmake detection. Is there
something like there was --nofeature in autoconfigure?

                                                Best regards,

                                                        Jirka
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe