Skip to content

Commit

Permalink
CMake+etc: Enable Qt6 by default for Unix builds
Browse files Browse the repository at this point in the history
Linux builds were left behind on the Qt transition, presumably because
our Ubuntu CI image does not support Qt6.

Enable Qt6 by default and explicitly disable it for slower or more
conservative Linux distros.

Drop experimental status for Qt6, because we are using it to build
official Windows and macOS releases.
  • Loading branch information
randstr authored and rknall committed Aug 22, 2022
1 parent 6b35aa0 commit b332107
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ variables:
script:
# setcap restricts our library paths
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
- CFLAGS=-Wl,-rpath=$(pwd)/run CXXFLAGS=-Wl,-rpath=$(pwd)/run cmake -GNinja -DENABLE_CCACHE=ON $CMAKE_ARGS ..
- CFLAGS=-Wl,-rpath=$(pwd)/run CXXFLAGS=-Wl,-rpath=$(pwd)/run cmake -GNinja -DENABLE_CCACHE=ON -DUSE_qt6=OFF $CMAKE_ARGS ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- ninja
- ninja install
Expand Down Expand Up @@ -187,7 +187,7 @@ Source Package:
script:
- ../tools/make-version.py --set-release ..
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
- cmake -G Ninja $CMAKE_ARGS -DENABLE_CCACHE=ON ..
- cmake -G Ninja $CMAKE_ARGS -DENABLE_CCACHE=ON -DUSE_qt6=OFF ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- cd $CI_PROJECT_DIR
- build/packaging/source/git-export-release.sh -d .
Expand Down Expand Up @@ -332,7 +332,7 @@ Win64 Package:
- cd build
script:
- C:\Windows\py.exe ..\tools\make-version.py --set-release ..
- cmake -G "Visual Studio 17 2022" -A x64 -DUSE_qt6=ON -DENABLE_LTO=off ..
- cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_LTO=off ..
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
- msbuild /verbosity:minimal /maxcpucount wireshark_nsis_prep.vcxproj
Expand Down Expand Up @@ -372,7 +372,7 @@ macOS Arm Package:
- mkdir build
- cd build
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
- cmake -DENABLE_CCACHE=ON -DUSE_qt6=ON -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
- cmake -DENABLE_CCACHE=ON -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- ninja
- package-prep
Expand Down Expand Up @@ -406,7 +406,7 @@ macOS Intel Package:
- mkdir build
- cd build
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
- cmake -DENABLE_CCACHE=ON -DUSE_qt6=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DCMAKE_OSX_SYSROOT=macosx10.15 -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
- cmake -DENABLE_CCACHE=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DCMAKE_OSX_SYSROOT=macosx10.15 -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- ninja
- package-prep
Expand Down Expand Up @@ -500,7 +500,7 @@ GCC Warnings:
script:
# build-ubuntu puts us in `build`.
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
- CC=gcc CXX=g++ cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja ..
- CC=gcc CXX=g++ cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -DUSE_qt6=OFF -G Ninja ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- script --command ninja --flush --quiet --return ../gcc_report.txt
- ansi2html < ../gcc_report.txt > ../gcc_report.html
Expand Down Expand Up @@ -530,7 +530,7 @@ Code Checks + Clang Warnings:
- cd build
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
# We don't have an "All options" job, so build fuzzshark and tfshark here.
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DBUILD_fuzzshark=ON -DBUILD_tfshark=On -DBUILD_logray=ON -DENABLE_CCACHE=ON -G Ninja ..
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DBUILD_fuzzshark=ON -DBUILD_tfshark=On -DBUILD_logray=ON -DENABLE_CCACHE=ON -DUSE_qt6=OFF -G Ninja ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- mkdir ../html
- script --command ninja --flush --quiet --return ../tmp_clang_report.txt
Expand All @@ -555,7 +555,7 @@ No options:
extends: .build-ubuntu
rules: !reference [.if-merge-request]
script: |
cmake -GNinja -DENABLE_CCACHE=ON \
cmake -GNinja -DENABLE_CCACHE=ON -DUSE_qt6=OFF \
-DENABLE_BROTLI=OFF -DENABLE_CAP=OFF -DENABLE_CARES=OFF -DENABLE_CHECKHF_CONFLICT=ON -DENABLE_GNUTLS=OFF \
-DENABLE_KERBEROS=OFF -DENABLE_LIBXML2=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF -DENABLE_MINIZIP=OFF \
-DENABLE_NETLINK=OFF -DENABLE_NGHTTP2=OFF -DENABLE_PCAP=OFF -DENABLE_PLUGIN_IFDEMO=ON -DENABLE_PLUGINS=OFF \
Expand All @@ -570,7 +570,7 @@ Windows Build:
tags:
- wireshark-windows-merge-req
script:
- cmake -G "Visual Studio 17 2022" -A x64 -DUSE_qt6=ON -DENABLE_LTO=off ..
- cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_LTO=off ..
- msbuild /verbosity:minimal /maxcpucount Wireshark.sln
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
- ctest -C RelWithDebInfo --parallel 3 --force-new-ctest-process --output-on-failure
Expand Down Expand Up @@ -642,7 +642,7 @@ Coverity Visual C++ Scan:
- $gitDescription = (( git describe --tags ) | Out-String).Trim()
- C:\Windows\System32\curl --output $env:temp\cov-analysis-win64.zip --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN https://scan.coverity.com/download/win64
- C:\ProgramData\chocolatey\tools\7z x "$env:temp\cov-analysis-win64.zip" -y -r -o"$env:temp"
- cmake -DTEST_EXTRA_ARGS=--enable-release -DUSE_qt6=ON -DENABLE_LTO=off -G "Visual Studio 17 2022" -A x64 ..
- cmake -DTEST_EXTRA_ARGS=--enable-release -DENABLE_LTO=off -G "Visual Studio 17 2022" -A x64 ..
- $covAnalysisWin64 = (Get-ChildItem -Path $env:temp -Filter "cov-analysis-win64-*" -Directory)[0].FullName
- Invoke-Expression "& $covAnalysisWin64\bin\cov-build.exe --return-emit-failures --dir ..\cov-int msbuild /verbosity:minimal `"/consoleloggerparameters:PerformanceSummary;NoSummary`" /maxcpucount:1 Wireshark.sln"
- cd ..
Expand Down Expand Up @@ -676,7 +676,7 @@ Clang Static Analyzer:
CC: "clang-${CLANG_VERSION}"
CXX: "clang++-${CLANG_VERSION}"
script:
- scan-build-${CLANG_VERSION} cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=OFF -G Ninja ..
- scan-build-${CLANG_VERSION} cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=OFF -DUSE_qt6=OFF -G Ninja ..
- scan-build-${CLANG_VERSION} -o ../sbout ninja
- cd ../sbout
- RAW_DIR=$( find ../sbout -type d -name "20??-??-??-*" -printf "%P\n" | head )
Expand All @@ -699,7 +699,7 @@ Visual Studio Code Analysis:
when: always
script:
- $env:caexcludepath = "C:\Qt;$env:INCLUDE"
- cmake -DENABLE_CODE_ANALYSIS=ON -G "Visual Studio 17 2022" -A x64 -DUSE_qt6=ON -DENABLE_LTO=off ..
- cmake -DENABLE_CODE_ANALYSIS=ON -G "Visual Studio 17 2022" -A x64 -DENABLE_LTO=off ..
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount:2 Wireshark.sln

# Build all doxygen docs
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1185,9 +1185,6 @@ ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD)
if(BUILD_wireshark OR BUILD_logray)
if(USE_qt6)
set(qtver "6")
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
set(CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT6_PREFIX_PATH})
endif()
else()
set(qtver "5")
# XXX We used to recommend setting QT5_BASE_DIR. Remove after the 4.0 branch is created.
Expand Down Expand Up @@ -1610,6 +1607,8 @@ add_subdirectory( wsutil )

if(BUILD_wireshark AND QT_FOUND)
add_subdirectory( ui/qt )
elseif(BUILD_wireshark AND USE_qt6)
message(VERBOSE "To use Qt5 instead of Qt6 use CMake option USE_qt6=OFF.")
endif()

if(BUILD_logray AND QT_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion CMakeOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
option(BUILD_wireshark "Build Wireshark" ON)
option(BUILD_logray "Build Logray" OFF)
if(BUILD_wireshark OR BUILD_logray)
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
if(NOT DEFINED ENV{WIRESHARK_BUILD_WITH_QT5})
option(USE_qt6 "Use Qt6 instead of Qt5" ON)
else()
option(USE_qt6 "Use Qt6 instead of Qt5" OFF)
Expand Down
2 changes: 2 additions & 0 deletions docbook/release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ It is used for troubleshooting, analysis, development and education.

// Add *major* changes here.

* Wireshark now builds with Qt6 by default. To use Qt5 instead pass USE_qt6=OFF to CMake.

Many other improvements have been made.
See the “New and Updated Features” section below for more details.

Expand Down
4 changes: 1 addition & 3 deletions docbook/wsdg_src/WSDG_chapter_quick_setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@ Note that installation of separate Qt components are required for 64 bit and 32
The components are forward compatible; you can build Wireshark using Qt’s “msvc2019 64-bit” and Visual {cpp} 2022.
The environment variable `https://doc.qt.io/qt-5/cmake-get-started.html[CMAKE_PREFIX_PATH]` should be set as appropriate for your environment and should point to the Qt installation directory, e.g. _C:\Qt{backslash}{qt-lts-version}.2\msvc2019_64_

Wireshark has experimental support for Qt 6.
If you would like to build Wireshark with Qt 6 you must install it along with the “Qt5 Compatibility Module” component and and pass `-DUSE_qt6=ON` to cmake.
You can optionally set the `WIRESHARK_QT6_PREFIX_PATH` environment variable to your Qt 6 installation directory instead of `CMAKE_PREFIX_PATH`.
By default Wireshark uses Qt 6. If you would like to build Wireshark with Qt 5 you must pass `-DUSE_qt6=OFF` to cmake.

The Qt maintenance tool (_C:\Qt\MaintenanceTool.exe_) can be used to upgrade Qt to newer versions.

Expand Down
2 changes: 1 addition & 1 deletion packaging/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endif
dh $@ --with python3 --buildsystem $(DH_BUILDSYSTEM) --with quilt

override_dh_auto_configure:
dh_auto_configure -- -DBUILD_xxx2deb=ON -DBUILD_corbaidl2wrs=ON
dh_auto_configure -- -DBUILD_xxx2deb=ON -DBUILD_corbaidl2wrs=ON -DUSE_qt6=OFF

override_dh_auto_build:
# Ignore warnings from asn2wrs.py about duplicate field names.
Expand Down
2 changes: 1 addition & 1 deletion packaging/rpm/wireshark.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ development of Wireshark scripts and plugins.
-DENABLE_CCACHE=ON \
%endif
%if %{with qt5}
-DBUILD_wireshark=ON \
-DBUILD_wireshark=ON -DUSE_qt6=OFF \
%else
-DBUILD_wireshark=OFF \
%endif
Expand Down
7 changes: 4 additions & 3 deletions tools/arch-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ BASIC_LIST="base-devel \
ninja \
pcre2 \
python \
qt5-base \
qt5-multimedia \
qt5-tools \
qt6-base \
qt6-multimedia \
qt6-tools \
qt6-5compat \
sbc \
snappy \
spandsp \
Expand Down

0 comments on commit b332107

Please sign in to comment.