Skip to content

Commit

Permalink
Upgrade to Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Young committed Oct 11, 2024
1 parent d86a543 commit 752df04
Show file tree
Hide file tree
Showing 50 changed files with 408 additions and 318 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,36 +154,33 @@ jobs:
Expand-Archive -Path C:/_/build/nsis/Nsislog.zip -DestinationPath C:/_/build/nsis/Nsislog
Tree /f C:/_/build
# Somehow, running the configure script sets up CMake to use Ninja rather than Makefiles, which is then in
# conflict with our other assumptions about CMake. Error message says remove CMakeCache.txt before running CMake,
# so we do that as a short-term fix (on the assumption that, longer term, we'll be moving to Meson).
# The configure script does default set-up for CMake that is enough for us here
- name: CMake Config
shell: msys2 {0}
run: |
cd /C/_
./configure
cd build
rm CMakeCache.txt
cmake .. -DCMAKE_RC_COMPILER:FILEPATH=windres.exe -G "MinGW Makefiles"
- name: Build (with Meson)
shell: msys2 {0}
run: |
cd /C/_/mbuild
pwd
meson compile
# The pwd and find ../third-party commands below are just diagnostics, but it's generally useful to have too
# much rather than not enough diagnostic info on these GitHub action builds
#
# This is the same reason we specify the --verbose option on CMake
- name: Build (with CMake)
shell: msys2 {0}
run: |
cd /C/_/build
pwd
tree -sh
cmake --build .
cmake --build . --verbose
ls
- name: Build (with Meson)
shell: msys2 {0}
run: |
cd /C/_/mbuild
pwd
meson compile
# The 'export QT_DEBUG_PLUGINS=1' give us diagnostics in the event that there are problems initialising QT
# The 'export QT_QPA_PLATFORM=offscreen' stops Qt's xcb sub-module trying to connect to a non-existent display
# (which would cause the test runner to abort before running any tests).
Expand Down
179 changes: 103 additions & 76 deletions CMakeLists.txt

Large diffs are not rendered by default.

42 changes: 37 additions & 5 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
#!/bin/bash
#----------------------------------------------------------------------------------------------------------------------
# configure is part of Brewtarget, and is copyright the following authors 2009-2024:
# • Matt Young <[email protected]>
# • Philip Greggory Lee <[email protected]>
#
# Brewtarget is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Brewtarget is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#----------------------------------------------------------------------------------------------------------------------

# stop when sth failed
#
# This script can be used to help set up the build directory for doing CMake builds.
#
# ⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
# NB: Meson and the `bt` build tool Python script are now the primary way of building and packaging the software. You
# can also still CMake to compile the product and install it locally, but we no longer support using CMake to do
# packaging.
# ⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
#

# Stop when something failed
set -e

PREFIX=""
Expand Down Expand Up @@ -63,6 +89,15 @@ fi

echo "CMAKEOPTIONS: $CMAKEOPTIONS"

# When a git repository is cloned, the submodules don't get cloned until you specifically ask for it
if [ ! -d third-party ]
then
echo "Pulling in submodules"
mkdir -p third-party
git submodule init
git submodule update
fi

# Create dir only if needed
mkdir -p build

Expand All @@ -71,7 +106,4 @@ cd build/
cmake $CMAKEOPTIONS ../

# Tell the user what to do (if everything went well...)
echo ""
echo ""
echo -e "\tNow, cd to build/ and run \"make\""
echo ""
echo -e "\n\n\tNow, cd to build/ and run \"make\" (or \"cmake --build .\" on Windows)\n"
2 changes: 1 addition & 1 deletion doc/manpage.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ all the important parameters, helps you with mash temperatures, and just
makes the process of recipe formulation much easier.

# COPYRIGHT
Copyright © various authors 2009-2023 -- see accompanying documentation
Copyright © various authors 2009-2024 -- see accompanying documentation

@CONFIG_APPLICATION_NAME_UC@ is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
Expand Down
46 changes: 31 additions & 15 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@
# - Meson 0.59.0 or newer to use qt.compile_resources, qt.compile_ui and qt.compile_moc
# - Meson 0.60.0 or newer to use + to append items to lists (aka 'list.<plus>' feature -- at least that's what the
# warning message says if you've specified a lower minimum version of Meson)
# We would/will need:
# - Meson 0.62.0 or newer for dep 'dl' custom lookup, but current version of Meson on Ubuntu 22.04 LTS is only 0.61.2
# - Meson 0.63.0 or newer to correctly locate versions of Qt >= 6.1 -- see https://mesonbuild.com/Qt6-module.html
#
# NB: Per https://mesonbuild.com/Reference-manual_functions.html#project the default_options settings "are only used
# when running Meson for the first time"! So if you change any of the default_options settings you *MUST* delete
Expand Down Expand Up @@ -275,8 +275,8 @@ testRunnerTargetName = mainExecutableTargetName + '_tests'
#=======================================================================================================================
#==================================================== Meson modules ====================================================
#=======================================================================================================================
# Import the Qt tools. See https://mesonbuild.com/Qt5-module.html
qt = import('qt5')
# Import the Qt tools. See https://mesonbuild.com/Qt6-module.html
qt = import('qt6')
# File System module - see https://mesonbuild.com/Fs-module.html
fs = import('fs')

Expand Down Expand Up @@ -325,16 +325,14 @@ sharedLibraryPaths = []
# Note that if you change the minimum Qt version, you need to make corresponding changes to the .github/workflows/*.yml
# files so that GitHub uses the appropriate version of Qt for the automated builds.
#
# 2024-05-19: Removed support for Ubuntu 20.04 because the latest version of Qt available in its packages is 5.12.8,
# which is no longer supported (and, amongst other things, has an old version of SQLite that does not
# support "DROP COLUMN"). Qt 5.15 is the long-term support version of Qt5.
# As of 2024-09-30:
# - Qt 6.2.4 is the maximum available in Ubuntu 22.04 (Jammy).
# - Qt 6.4.2 is the maximum available in Ubuntu 24.04 (Noble).
#
# For the moment, max version we can have here is 5.15.3, because that's what Ubuntu 22.04 topped out at. But note
# that Meson will be happy with newer versions (5.15.13 on Windows & Mac).

minVersionOfQt = '>=6.2.4'
# Tell meson which Qt modules we need
qtCommonDependencies = dependency('qt5',
version : '>=5.15.3',
qtCommonDependencies = dependency('qt6',
version : minVersionOfQt,
modules : ['Core',
'Gui', # Needed for QColor on Mac?
'Multimedia',
Expand All @@ -348,9 +346,9 @@ qtCommonDependencies = dependency('qt5',
static : true)
# The Qt Gui module is only needed for the main program. (We don't want the tests to try to load it or it could barf
# in a GitHub action that does not have a display running.)
qtMainExeDependencies = dependency('qt5', version : '>=5.15.3', modules: ['Gui'])
qtMainExeDependencies = dependency('qt6', version : minVersionOfQt, modules: ['Gui'])
# The Qt Test module is only needed for the unit tests
qtTestRunnerDependencies = dependency('qt5', version : '>=5.15.3', modules: ['Test'])
qtTestRunnerDependencies = dependency('qt6', version : minVersionOfQt, modules: ['Test'])

#===================================================== Find Boost ======================================================
# Boost is a collection of separate libraries, some, but not all, of which are header-only. We only specify the Boost
Expand Down Expand Up @@ -1232,17 +1230,35 @@ generatedFromMocForUnitTests = qt.compile_moc(headers : unitTestMocHeaders,
# manually from the command line with lrelease
# Calling qt.compile_translations will do only the latter, so we need to do the former directly
#
#
# NB: In Qt 5, the `lupdate` command line tool is just invoked as `lupdate` on all three of our build platforms. In
# Qt 6, it's a bit different. We still call `lupdate` on Mac, but, on Windows we need to call `lupdate-qt6` (see file
# list at https://packages.msys2.org/packages/mingw-w64-x86_64-qt6-tools). This is presumably to allow Qt 5 and Qt 6 to
# coexist, but we have to take account of it here.
#
lupdate_name = 'lupdate'
if host_machine.system() == 'windows'
lupdate_name = 'lupdate-qt6'
elif host_machine.system() == 'linux'
lupdate_name = 'lupdate'
endif
lupdate_executable = find_program(lupdate_name, required : true)

#
# Call lupdate to ensure the .ts files are synced with the source code. We need:
# lupdate meson.project_source_root()/src meson.project_source_root()/ui -ts [list of .ts files]
# This tells lupdate to recursively scan the src/ and ui/ subdirectories and update the specified ts files
# Fortunately, we can pass a list of File objects as a parameter to run_command and Meson does the right thing
#
# We make a point here of displaying the output of run_command because we want to show message emitted by lupdate about
# what it did.
message('Running lupdate on the following ts files:', run_command('ls', translationSourceFiles, check: true).stdout())
#
message(
'Running lupdate (', lupdate_executable.full_path(), ') on the following ts files:',
run_command('ls', translationSourceFiles, check: true).stdout()
)
message(
run_command('lupdate',
run_command(lupdate_executable,
meson.project_source_root() + '/src',
meson.project_source_root() + '/ui',
'-ts',
Expand Down
31 changes: 15 additions & 16 deletions packaging/linux/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,26 @@ Architecture: amd64
# Note that you can see the version of a package libfoobar by running the following command from the shell:
# apt-cache show foobar | grep Version
#
# Note too that we need either libqt5gui5 or libqt5gui5-gles, not both (which is not possible as they conflict).
#
# Normally, this field is (surprisingly) not allowed to be "folded" (ie split across multiple lines). However, we do
# our own folding in the bt build script, so the backslash line continuations are OK here!
#
# I _think_ libqt5core5a has been replaced by libqt5core5t64
# From trial-and-error, we discover which libraries have a "t64" version which is used instead of the "base" one (eg
# libqt6network6t64 instead of libqt6network6). This is to do with upgrades to 64-bit time (to fix the "year 2038
# problem") -- per https://wiki.debian.org/ReleaseGoals/64bit-time.
#
Depends: \
libc6 (>= 2.34 ), \
libgcc-s1 (>= 3.3 ), \
libqt5core5t64 (>= 5.15.3), \
libqt5gui5 (>= 5.15.3) | \
libqt5gui5-gles (>= 5.15.3), \
libqt5multimedia5 (>= 5.15.3), \
libqt5network5 (>= 5.15.3), \
libqt5printsupport5 (>= 5.15.3), \
libqt5sql5 (>= 5.15.3), \
libqt5widgets5 (>= 5.15.3), \
libstdc++6 (>= 11 ), \
libxalan-c112 (>= 1.12 ), \
libxerces-c3.2 (>= 3.2 )
libc6 (>= 2.35 ), \
libgcc-s1 (>= 12.3 ), \
libqt6core6t64 (>= 6.2.4), \
libqt6gui6t64 (>= 6.2.4) | \
libqt6multimedia6 (>= 6.2.4), \
libqt6network6t64 (>= 6.2.4), \
libqt6printsupport6t64 (>= 6.2.4), \
libqt6sql6t64 (>= 6.2.4), \
libqt6widgets6t64 (>= 6.2.4), \
libstdc++6 (>= 12.3 ), \
libxalan-c112t64 (>= 1.12 ), \
libxerces-c3.2t64 (>= 3.2.3)
#
# Installed-Size (Optional) : an estimate of the total amount of disk space required to install the named package
# The disk space is given as the integer value of the estimated installed size in bytes, divided by 1024 and rounded
Expand Down
14 changes: 7 additions & 7 deletions packaging/linux/rpm.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ BuildArch : x86_64
#
Requires : \
libgcc_s1 >= 3.3 , \
libqt5core5 >= 5.9.5, \
libqt5gui5 >= 5.9.5, \
libqt5multimedia5 >= 5.9.5, \
libqt5network5 >= 5.9.5, \
libqt5printsupport5 >= 5.9.5, \
libqt5sql5 >= 5.9.5, \
libqt5widgets5 >= 5.9.5, \
libqt6core6 >= 6.2.4, \
libqt6gui6 >= 6.2.4, \
libqt6multimedia6 >= 6.2.4, \
libqt6network6 >= 6.2.4, \
libqt6printsupport6 >= 6.2.4, \
libqt6sql6 >= 6.2.4, \
libqt6widgets6 >= 6.2.4, \
libstdc++6 >= 11 , \
libxalan-c112 >= 1.12 , \
libxerces-c3_2 >= 3.2
Expand Down
Loading

0 comments on commit 752df04

Please sign in to comment.