Skip to content

Commit 4df65ca

Browse files
committed
Enable compilation with Qt6 and MSVC
Add missing headers, account for the different target path, change the Qt binary dir determination method.
1 parent a4c655f commit 4df65ca

35 files changed

Lines changed: 72 additions & 29 deletions

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,15 @@ find_package(
210210
Qt6
211211
COMPONENTS Core Gui Widgets Xml Network LinguistTools OpenGL Svg OpenGLWidgets
212212
CONFIG)
213-
if (NOT Qt6_FOUND)
213+
if (Qt6_FOUND)
214+
set(QT_BINDIR "${QT6_INSTALL_PREFIX}/bin")
215+
else()
214216
find_package(Qt5 ${qt_min_version}
215217
COMPONENTS Core Gui Widgets Xml Network LinguistTools OpenGL Svg
216218
CONFIG REQUIRED)
219+
set(QT_BINDIR "${QT5_INSTALL_PREFIX}/bin")
217220
endif()
218221

219-
get_filename_component(QT_BINDIR ${QT_QMAKE_EXECUTABLE} DIRECTORY)
220-
221222
if(Qt6_FOUND)
222223
set(Qt_Core_lib Qt::Core)
223224
set(Qt_Gui_lib Qt::Gui)

src/app/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if (Qt6_FOUND AND WIN32)
8484
add_custom_command(
8585
TARGET scantailor
8686
POST_BUILD
87-
COMMAND ${QT_BINDIR}/windeployqt ${CMAKE_BINARY_DIR}
87+
COMMAND ${QT_BINDIR}/windeployqt $<TARGET_FILE_DIR:scantailor>
8888
COMMENT "deploy qt files alongside binary (e.g. plugins)"
8989
)
9090
install(CODE "execute_process(COMMAND ${QT_BINDIR}/windeployqt ${CMAKE_INSTALL_PREFIX})")

src/core/BlackOnWhiteEstimator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "BlackOnWhiteEstimator.h"
55

6+
#include <stdexcept>
7+
68
#include <imageproc/Binarize.h>
79
#include <imageproc/Grayscale.h>
810
#include <imageproc/Morphology.h>

src/core/filters/output/OutputGenerator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <boost/bind/bind.hpp>
5050
#include <boost/function.hpp>
5151
#include <cmath>
52+
#include <stdexcept>
5253

5354
#include "ColorParams.h"
5455
#include "DebugImages.h"

src/core/filters/output/OutputImageBuilder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "OutputImageBuilder.h"
55

6+
#include <stdexcept>
7+
68
#include <imageproc/BinaryImage.h>
79

810
#include "ForegroundType.h"
@@ -69,4 +71,4 @@ OutputImageBuilder& OutputImageBuilder::setForegroundType(const ForegroundType&
6971
m_foregroundType = std::make_unique<ForegroundType>(foregroundImage);
7072
return *this;
7173
}
72-
} // namespace output
74+
} // namespace output

src/dewarping/RasterDewarper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <QDebug>
1010
#include <cmath>
11+
#include <stdexcept>
1112

1213
#include "CylindricalSurfaceDewarper.h"
1314

@@ -527,4 +528,4 @@ QImage RasterDewarper::dewarp(const QImage& src,
527528
return dewarpRgb(src.convertToFormat(QImage::Format_RGB32), dstSize, distortionModel, modelDomain, bgColor);
528529
}
529530
} // RasterDewarper::dewarp
530-
} // namespace dewarping
531+
} // namespace dewarping

src/imageproc/AdjustBrightness.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "AdjustBrightness.h"
55

66
#include <QImage>
7+
#include <stdexcept>
78

89
namespace imageproc {
910
void adjustBrightness(QImage& rgbImage, const QImage& brightness, const double wr, const double wb) {
@@ -73,4 +74,4 @@ void adjustBrightnessYUV(QImage& rgbImage, const QImage& brightness) {
7374
void adjustBrightnessGrayscale(QImage& rgbImage, const QImage& brightness) {
7475
adjustBrightness(rgbImage, brightness, 11.0 / 32.0, 5.0 / 32.0);
7576
}
76-
} // namespace imageproc
77+
} // namespace imageproc

src/imageproc/BackgroundColorCalculator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "BackgroundColorCalculator.h"
55

66
#include <cassert>
7+
#include <stdexcept>
78

89
#include "Binarize.h"
910
#include "BinaryImage.h"
@@ -197,4 +198,4 @@ QColor BackgroundColorCalculator::calcDominantColor(const QImage& img, const Bin
197198
return QColor(dominantRed, dominantGreen, dominantBlue);
198199
}
199200
}
200-
} // namespace imageproc
201+
} // namespace imageproc

src/imageproc/Binarize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <QDebug>
77
#include <cassert>
88
#include <cmath>
9+
#include <stdexcept>
910

1011
#include "BinaryImage.h"
1112
#include "Grayscale.h"
@@ -199,4 +200,4 @@ BinaryImage binarizeWolf(const QImage& src,
199200
BinaryImage peakThreshold(const QImage& image) {
200201
return BinaryImage(image, BinaryThreshold::peakThreshold(image));
201202
}
202-
} // namespace imageproc
203+
} // namespace imageproc

src/imageproc/BinaryImage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,4 +1051,4 @@ void* BinaryImage::SharedData::operator new(size_t, const NumWords numWords) {
10511051
void BinaryImage::SharedData::operator delete(void* addr, NumWords) {
10521052
free(addr);
10531053
}
1054-
} // namespace imageproc
1054+
} // namespace imageproc

0 commit comments

Comments
 (0)