Skip to content

Commit

Permalink
Build fixes 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Young committed Jan 2, 2025
1 parent de9fff6 commit 866fd37
Show file tree
Hide file tree
Showing 166 changed files with 676 additions and 336 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,16 @@ endif()
# declarations etc.
set(CMAKE_AUTOMOC ON)

# Although AUTOMOC is pretty neat when it works, it can be problematic. Part of what it does is #include all the
# generated files (eg "moc_AboutDialog.cpp") into a single intermediate source file, which it then compiles. We have
# sometimes had compiler errors from this because of various Qt headers complaining about things being redefined. The
# brute-force workaround is, on CMake builds, to manually include these generated files in our corresponding .cpp file
# (eg "AboutDialog.cpp"), which then stops CMake pulling those generated files into its intermediate source file.
#
# (We don't want to do this extra manual include on the Meson builds because then we'd get duplicate symbols at the
# linking stage.)
add_compile_definitions(BUILDING_WITH_CMAKE)

# Set the AUTOUIC property on all targets. This tells CMake to automatically handle the Qt uic code generator, without
# having to use commands such as QT4_WRAP_UI(), QT5_WRAP_UI(), etc.
set(CMAKE_AUTOUIC ON)
Expand Down
6 changes: 4 additions & 2 deletions src/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@

#include "config.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AboutDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AboutDialog.cpp"
#endif

AboutDialog::AboutDialog(QWidget * parent) :
QDialog(parent),
Expand Down
6 changes: 4 additions & 2 deletions src/AlcoholTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
#include "measurement/SystemOfMeasurement.h"
#include "widgets/ToggleSwitch.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AlcoholTool.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AlcoholTool.cpp"
#endif

// Settings we only use in this file under the PersistentSettings::Sections::alcoholTool section
#define AddSettingName(name) namespace { BtStringConst const name{#name}; }
Expand Down
6 changes: 4 additions & 2 deletions src/AncestorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
#include "model/NamedEntity.h"
#include "model/Recipe.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AncestorDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_AncestorDialog.cpp"
#endif

AncestorDialog::AncestorDialog(QWidget * parent) : QDialog(parent) {

Expand Down
6 changes: 4 additions & 2 deletions src/BeerColorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

#include "config.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BeerColorWidget.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BeerColorWidget.cpp"
#endif

// TODO: make the size adjust inside the container.
BeerColorWidget::BeerColorWidget(QWidget* parent) : QWidget(parent) {
Expand Down
6 changes: 4 additions & 2 deletions src/BrewDayFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
#include "model/Style.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewDayFormatter.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewDayFormatter.cpp"
#endif

BrewDayFormatter::BrewDayFormatter(QObject * parent)
: QObject(parent) {
Expand Down
6 changes: 4 additions & 2 deletions src/BrewDayScrollWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
#include "PersistentSettings.h"
#include "TimerWidget.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewDayScrollWidget.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewDayScrollWidget.cpp"
#endif

namespace {
QString styleName(Style const * style) {
Expand Down
6 changes: 4 additions & 2 deletions src/BrewNoteWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
#include "model/BrewNote.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewNoteWidget.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BrewNoteWidget.cpp"
#endif

namespace {
double const lowLimitPct = 0.95;
Expand Down
6 changes: 4 additions & 2 deletions src/BtDatePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
#include <QtGui>
#include "BtDatePopup.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtDatePopup.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtDatePopup.cpp"
#endif

//! \brief set up the popup window.
BtDatePopup::BtDatePopup(QWidget* parent) : QDialog(parent, Qt::Popup)
Expand Down
6 changes: 4 additions & 2 deletions src/BtSplashScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

#include "config.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtSplashScreen.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtSplashScreen.cpp"
#endif

namespace {
static QString const logoFile = QString{":images/%1.svg"}.arg(CONFIG_APPLICATION_NAME_LC);
Expand Down
6 changes: 4 additions & 2 deletions src/BtTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
#include "model/Recipe.h"
#include "model/Style.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtTabWidget.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtTabWidget.cpp"
#endif


//! \brief set up the popup window.
Expand Down
6 changes: 4 additions & 2 deletions src/BtTextEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#include <QDebug>
#include <QSettings>

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtTextEdit.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_BtTextEdit.cpp"
#endif

BtTextEdit::BtTextEdit([[maybe_unused]] QWidget * parent) : wasModified{false} {

Expand Down
6 changes: 4 additions & 2 deletions src/ConverterTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

#include "measurement/Unit.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_ConverterTool.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_ConverterTool.cpp"
#endif

ConverterTool::ConverterTool(QWidget* parent) : QDialog(parent) {
this->doLayout();
Expand Down
6 changes: 4 additions & 2 deletions src/HelpDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
#include "Logging.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_HelpDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_HelpDialog.cpp"
#endif

// This private implementation class holds all private non-virtual members of HelpDialog
class HelpDialog::impl {
Expand Down
6 changes: 4 additions & 2 deletions src/HydrometerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#include "Algorithms.h"
#include "measurement/Unit.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_HydrometerTool.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_HydrometerTool.cpp"
#endif

HydrometerTool::HydrometerTool(QWidget* parent) : QDialog(parent) {
this->doLayout();
Expand Down
6 changes: 4 additions & 2 deletions src/IbuGuSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

#include "IbuGuSlider.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_IbuGuSlider.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_IbuGuSlider.cpp"
#endif

IbuGuSlider::IbuGuSlider(QWidget* parent)
: RangedSlider(parent)
Expand Down
6 changes: 4 additions & 2 deletions src/LatestReleaseFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

#include "config.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_LatestReleaseFinder.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_LatestReleaseFinder.cpp"
#endif

void LatestReleaseFinder::checkMainRespository() {

Expand Down
6 changes: 4 additions & 2 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@
#include "utils/BtStringConst.h"
#include "utils/OptionalHelpers.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MainWindow.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MainWindow.cpp"
#endif

namespace {

Expand Down
6 changes: 4 additions & 2 deletions src/MashDesigner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#include "model/Fermentable.h"
#include "PhysicalConstants.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MashDesigner.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MashDesigner.cpp"
#endif

MashDesigner::MashDesigner(QWidget * parent) : QDialog {parent},
m_recObs {nullptr},
Expand Down
6 changes: 4 additions & 2 deletions src/MashWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
#include "model/MashStep.h"
#include "PhysicalConstants.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MashWizard.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_MashWizard.cpp"
#endif

MashWizard::MashWizard(QWidget* parent) :
QDialog(parent),
Expand Down
6 changes: 4 additions & 2 deletions src/NamedEntitySortProxyModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
#include <QDebug>
#include <QAbstractItemModel>

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_NamedEntitySortProxyModel.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_NamedEntitySortProxyModel.cpp"
#endif

NamedEntitySortProxyModel::NamedEntitySortProxyModel(QAbstractItemModel* sourceModel)
: QSortFilterProxyModel(sourceModel)
Expand Down
6 changes: 4 additions & 2 deletions src/OgAdjuster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
#include "model/Equipment.h"
#include "model/Recipe.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_OgAdjuster.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_OgAdjuster.cpp"
#endif

OgAdjuster::OgAdjuster( QWidget* parent ) :
QDialog{parent},
Expand Down
6 changes: 4 additions & 2 deletions src/OptionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
#include "measurement/UnitSystem.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_OptionDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_OptionDialog.cpp"
#endif

//
// Anonymous namespace for constants, global variables and functions used only in this file
Expand Down
6 changes: 4 additions & 2 deletions src/PitchDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
#include "measurement/Unit.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PitchDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PitchDialog.cpp"
#endif

PitchDialog::PitchDialog(QWidget* parent) : QDialog(parent) {
setupUi(this);
Expand Down
6 changes: 4 additions & 2 deletions src/PrimingDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@

#include "measurement/Unit.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PrimingDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PrimingDialog.cpp"
#endif

PrimingDialog::PrimingDialog(QWidget* parent) : QDialog(parent) {
this->setupUi(this);
Expand Down
6 changes: 4 additions & 2 deletions src/PrintAndPreviewDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@

#include "InventoryFormatter.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PrintAndPreviewDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_PrintAndPreviewDialog.cpp"
#endif

/**
* @brief Construct a new Print And Preview Dialog:: Print And Preview Dialog object
Expand Down
6 changes: 4 additions & 2 deletions src/RangedSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
#include <QRectF>
#include <QToolTip>

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RangedSlider.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RangedSlider.cpp"
#endif

RangedSlider::RangedSlider(QWidget* parent)
: QWidget(parent),
Expand Down
6 changes: 4 additions & 2 deletions src/RecipeExtrasWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include "undoRedo/Undoable.h"
#include "utils/OptionalHelpers.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RecipeExtrasWidget.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RecipeExtrasWidget.cpp"
#endif

RecipeExtrasWidget::RecipeExtrasWidget(QWidget* parent) :
QWidget(parent),
Expand Down
6 changes: 4 additions & 2 deletions src/RecipeFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
#include "model/Yeast.h"
#include "PersistentSettings.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RecipeFormatter.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RecipeFormatter.cpp"
#endif

namespace {
//! Get the maximum number of characters in a list of strings.
Expand Down
6 changes: 4 additions & 2 deletions src/RefractoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
#include "Algorithms.h"
#include "measurement/Measurement.h"

// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RefractoDialog.cpp"
#ifdef BUILDING_WITH_CMAKE
// Explicitly doing this include reduces potential problems with AUTOMOC when compiling with CMake
#include "moc_RefractoDialog.cpp"
#endif

RefractoDialog::RefractoDialog(QWidget* parent) : QDialog(parent) {
setupUi(this);
Expand Down
Loading

0 comments on commit 866fd37

Please sign in to comment.