Skip to content

Commit

Permalink
Merge pull request #867 from matty0ung/usability
Browse files Browse the repository at this point in the history
Rework how version check request is done
  • Loading branch information
matty0ung authored Oct 30, 2024
2 parents cc47b5e + 307a502 commit 44bdd03
Show file tree
Hide file tree
Showing 17 changed files with 508 additions and 242 deletions.
5 changes: 3 additions & 2 deletions CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ Bug fixes and minor enhancements.
* None

### Bug Fixes
* None
* Crash (stack overflow in Qt) on some Windows builds during "check for new version" [866](https://github.com/Brewtarget/brewtarget/issues/866)

### Release Timestamp
Sat, 26 Oct 2024 04:00:09 +0100
Tue, 29 Oct 2024 04:00:09 +0100

## v4.0.8
Bug fixes and minor enhancements.
Expand Down
89 changes: 49 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ set(RUNTIME_INSTALL_COMPONENT "Runtime")
# We use different compilers on different platforms. Where possible, we want to let CMake handle the actual compiler
# settings
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# We need C++20 for std::map::contains() and concepts, C++17 or later for nested namespaces and structured bindings, and
# C++11 or later for lambdas.
set(CMAKE_CXX_STANDARD 20)
# We need C++23 for std::ranges::zip_view, C++20 for std::map::contains() and concepts, C++17 or later for nested
# namespaces and structured bindings, and C++11 or later for lambdas.
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -580,47 +580,48 @@ if(WIN32)
get_filename_component(QT_BIN_DIR "${_qmake_executable}" DIRECTORY)
message("QT_BIN_DIR = ${QT_BIN_DIR}")

#
# Per https://doc.qt.io/qt-6/windows-deployment.html, the windeployqt executable creates all the necessary folder
# tree "containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run
# the application from that folder".
#
# On some systems at least, looks like Qt6::windeployqt is already available in CMake (when Qt5::windeployqt) was
# not. If it is, then we can't try to set it up again as we'll get an error ("add_executable cannot create imported
# target "Qt6::windeployqt" because another target with the same name already exists").
#
if (NOT TARGET Qt6::windeployqt)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
if(EXISTS ${WINDEPLOYQT_EXECUTABLE})
# Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
# convenient reference from commands like add_custom_command()".
add_executable(Qt6::windeployqt IMPORTED)
set_target_properties(Qt6::windeployqt PROPERTIES IMPORTED_LOCATION ${WINDEPLOYQT_EXECUTABLE})
endif()
endif()
### #
### # Per https://doc.qt.io/qt-6/windows-deployment.html, the windeployqt executable creates all the necessary folder
### # tree "containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run
### # the application from that folder".
### #
### # On some systems at least, looks like Qt6::windeployqt is already available in CMake (when Qt5::windeployqt) was
### # not. If it is, then we can't try to set it up again as we'll get an error ("add_executable cannot create imported
### # target "Qt6::windeployqt" because another target with the same name already exists").
### #
### if (NOT TARGET Qt6::windeployqt)
### find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
### if(EXISTS ${WINDEPLOYQT_EXECUTABLE})
### # Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
### # convenient reference from commands like add_custom_command()".
### add_executable(Qt6::windeployqt IMPORTED)
### set_target_properties(Qt6::windeployqt PROPERTIES IMPORTED_LOCATION ${WINDEPLOYQT_EXECUTABLE})
### endif()
### endif()

# International Components for Unicode
file(GLOB IcuDlls "${QT_BIN_DIR}/libicu*.dll")
elseif(APPLE)
#====================================================================================================================
#=================================================== Mac Qt Stuff ===================================================
#====================================================================================================================

# The macdeployqt executable shipped with Qt does for Mac what windeployqt does for Windows -- see
# https://doc.qt.io/qt-6/macos-deployment.html#the-mac-deployment-tool
#
# At first glance, you might thanks that, with a few name changes, we might share all the CMake code for macdeployqt
# and windeployqt. However, as you will see below, the two programs share _only_ a top-level goal ("automate the
# process of creating a deployable [folder / applicaiton bundle] that contains [the necessary Qt dependencies]" - ie
# so that the end user does not have to install Qt to run our software). They have completely different
# implementations and command line options, so it would be unhelpful to try to treat them identically.
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
if(EXISTS ${MACDEPLOYQT_EXECUTABLE})
# Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
# convenient reference from commands like add_custom_command()".
add_executable(Qt6::macdeployqt IMPORTED)
set_target_properties(Qt6::macdeployqt PROPERTIES IMPORTED_LOCATION ${MACDEPLOYQT_EXECUTABLE})
endif()
###elseif(APPLE)
### #====================================================================================================================
### #=================================================== Mac Qt Stuff ===================================================
### #====================================================================================================================
###
### # The macdeployqt executable shipped with Qt does for Mac what windeployqt does for Windows -- see
### # https://doc.qt.io/qt-6/macos-deployment.html#the-mac-deployment-tool
### #
### # At first glance, you might thanks that, with a few name changes, we might share all the CMake code for macdeployqt
### # and windeployqt. However, as you will see below, the two programs share _only_ a top-level goal ("automate the
### # process of creating a deployable [folder / applicaiton bundle] that contains [the necessary Qt dependencies]" - ie
### # so that the end user does not have to install Qt to run our software). They have completely different
### # implementations and command line options, so it would be unhelpful to try to treat them identically.
### find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
### if(EXISTS ${MACDEPLOYQT_EXECUTABLE})
### # Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
### # convenient reference from commands like add_custom_command()".
### add_executable(Qt6::macdeployqt IMPORTED)
### set_target_properties(Qt6::macdeployqt PROPERTIES IMPORTED_LOCATION ${MACDEPLOYQT_EXECUTABLE})
### endif()

endif()

Expand Down Expand Up @@ -766,6 +767,13 @@ include_directories(${XalanC_INCLUDE_DIRS})
message("Xalan-C++ include directories: ${XalanC_INCLUDE_DIRS}")
message("Xalan-C++ libraries: ${XalanC_LIBRARIES}")

#===================================================== Find OpenSSL ====================================================
# This is needed for us to use https with Boost.Asio
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
message("OpenSSL include directories: ${OPENSSL_INCLUDE_DIR}")
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")

if(APPLE)
# TBD: Is this also needed when static linking Xerces on MacOS?
find_package(CURL REQUIRED)
Expand Down Expand Up @@ -1137,6 +1145,7 @@ set(appAndTestCommonLibraries
${DL_LIBRARY}
${XalanC_LIBRARIES}
${XercesC_LIBRARIES}
${OPENSSL_LIBRARIES}
)
if(APPLE)
# Static linking Xerces and Xalan on MacOS means we have to explicitly say what libraries and frameworks they in turn
Expand Down
7 changes: 3 additions & 4 deletions bt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
# need to be for a local install). Then creates a distributable package, making use
# of various build variables passed back from Meson.
#
# NOTE: This tool, used in conjunction with Meson, is now the official way to build and package the software. We
# continue to support CMake for local compiles and installs, but not for packaging.
# NOTE: This tool, used in conjunction with Meson, is now the official way to build and package the software. We will
# continue to support CMake indefinitely for local compiles and installs, since it is such a widespread and
# familiar build system for C++ projects. However, we no longer attempt to support packaging via CPack.
#
# .:TODO:. At some point we should be able to retire:
# configure
# setupgit.sh
# CMakeLists.txt
# src/CMakeLists.txt
#
# **********************************************************************************************************************
# *
Expand Down
28 changes: 23 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
#
# Default options (mostly ultimately controlling compiler settings):
#
# - cpp_std We need C++20 for std::map::contains(), C++17 or later for nested namespaces and structured
# bindings, and C++11 or later for lambdas.
# - cpp_std We need C++23 for std::ranges::zip_view, C++20 for std::map::contains(), C++17 or later for nested
# namespaces and structured bindings, and C++11 or later for lambdas.
#
# - warning_level 3 is the highest level ie warns about the most things. For gcc it translates to
# -Wall -Winvalid-pch -Wextra -Wpedantic
Expand Down Expand Up @@ -192,13 +192,13 @@ project('brewtarget', 'cpp',
version: '4.0.9',
license: 'GPL-3.0-or-later',
meson_version: '>=0.63.0',
default_options : ['cpp_std=c++20',
default_options : ['cpp_std=c++23',
'warning_level=3',
# 'prefer_static=true', See comment above for why this is commented-out for now
'buildtype=plain'])

#
# Although Meson itself is written in Python, Meson build files uses a slihgtly different syntax and have less
# Although Meson itself is written in Python, Meson build files uses a slightly different syntax and have less
# functionality than Python. See
# https://mesonbuild.com/FAQ.html#why-is-meson-not-just-a-python-module-so-i-could-code-my-build-setup-in-python and
# links therefrom for the rationale for avoiding being a full programming language.
Expand Down Expand Up @@ -516,6 +516,21 @@ message('Xalan Library:', xalanDependency.name(), 'found =', xalanDependency.fou
'version =', xalanDependency.version(), 'path(s)=', xalanLibPaths)
sharedLibraryPaths += xalanLibPaths

#======================================================= OpenSSL =======================================================
# This is needed for us to use https with Boost.Asio
#
# As of 2024-10-29, 3.0.2 is the most recent version of OpenSSL available on Ubuntu 22.04, so that's the minimum we
# specify here.
#
openSslDependency = dependency('OpenSSL',
version : '>=3.0.2',
required : true,
static : true)
#openSslLibPaths = openSslDependency.get_variable(cmake : 'PACKAGE_LIBRARIES')
message('OpenSSL Library:', openSslDependency.name(), 'found =', openSslDependency.found(),
'version =', openSslDependency.version())
#sharedLibraryPaths += openSslLibPaths

#====================================================== Valijson =======================================================
# Don't need to do anything special, other than set include directories below, as it's header-only and we pull it in as
# a Git submodule.
Expand Down Expand Up @@ -615,6 +630,7 @@ commonSourceFiles = files([
'src/HydrometerTool.cpp',
'src/IbuGuSlider.cpp',
'src/InventoryFormatter.cpp',
'src/LatestReleaseFinder.cpp',
'src/Localization.cpp',
'src/Logging.cpp',
'src/MainWindow.cpp',
Expand Down Expand Up @@ -850,6 +866,7 @@ mocHeaders = files([
'src/HelpDialog.h',
'src/HydrometerTool.h',
'src/IbuGuSlider.h',
'src/LatestReleaseFinder.h',
'src/MainWindow.h',
'src/MashDesigner.h',
'src/MashWizard.h',
Expand Down Expand Up @@ -1278,6 +1295,7 @@ commonDependencies = [qtCommonDependencies,
xalanDependency,
boostDependency,
dlDependency,
openSslDependency, # This isn't strictly needed for the testRunner, but no harm comes from including it
backtraceDependency]
mainExeDependencies = commonDependencies + qtMainExeDependencies
testRunnerDependencies = commonDependencies + qtTestRunnerDependencies
Expand Down Expand Up @@ -1345,7 +1363,7 @@ exportedVariables = {
'CONFIG_DESCRIPTION_STRING' : 'Open source brewing software',

# Some installers, eg NSIS on Windows, want a brief copyright string
'CONFIG_COPYRIGHT_STRING' : 'Copyright 2009-2023. Distributed under the terms of the GNU General Public License (version 3).',
'CONFIG_COPYRIGHT_STRING' : 'Copyright 2009-2024. Distributed under the terms of the GNU General Public License (version 3).',

# Installers often want the name of the organisation supplying the product, so we need something to put there
'CONFIG_ORGANIZATION_NAME' : 'The ' + capitalisedProjectName + ' Team',
Expand Down
Loading

0 comments on commit 44bdd03

Please sign in to comment.