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

+72
-29
lines changed

CMakeLists.txt

+4-3
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

+1-1
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

+2
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

+1
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

+3-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+1-1
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

src/imageproc/BinaryThreshold.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <QDebug>
77
#include <cassert>
88
#include <iostream>
9+
#include <stdexcept>
910

1011
#include "Grayscale.h"
1112
#include "Morphology.h"
@@ -171,4 +172,4 @@ BinaryThreshold BinaryThreshold::mokjiThreshold(const QImage& image,
171172
const double threshold = 0.5 * nominator / denominator;
172173
return BinaryThreshold((int) (threshold + 0.5));
173174
} // BinaryThreshold::mokjiThreshold
174-
} // namespace imageproc
175+
} // namespace imageproc

src/imageproc/ColorSegmenter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <QImage>
77
#include <cmath>
8+
#include <stdexcept>
89

910
#include "BinaryImage.h"
1011
#include "BinaryThreshold.h"
@@ -404,4 +405,4 @@ GrayImage ColorSegmenter::segment(const BinaryImage& image, const GrayImage& gra
404405
ConnectivityMap segmentsMap = buildMapFromGrayscale(image);
405406
return buildGrayImage(segmentsMap, grayImage);
406407
}
407-
} // namespace imageproc
408+
} // namespace imageproc

src/imageproc/ConnectivityMap.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <QDebug>
77
#include <QImage>
8+
#include <stdexcept>
89

910
#include "BinaryImage.h"
1011
#include "BitOps.h"
@@ -571,4 +572,4 @@ void ConnectivityMap::remapIds(const std::vector<uint32_t>& map) {
571572
}
572573
}
573574
}
574-
} // namespace imageproc
575+
} // namespace imageproc

src/imageproc/DrawOver.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <QImage>
77
#include <cassert>
8+
#include <stdexcept>
89

910
#include "BinaryImage.h"
1011
#include "RasterOp.h"
@@ -52,4 +53,4 @@ void drawOver(QImage& dst, const QRect& dstRect, const QImage& src, const QRect&
5253
srcLine += srcBpl;
5354
}
5455
} // drawOver
55-
} // namespace imageproc
56+
} // namespace imageproc

src/imageproc/Grayscale.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "Grayscale.h"
55

6+
#include <stdexcept>
7+
68
#include "BinaryImage.h"
79
#include "BitOps.h"
810

@@ -443,4 +445,4 @@ void GrayscaleHistogram::fromAnyImage(const QImage& img, const BinaryImage& mask
443445
}
444446
}
445447
}
446-
} // namespace imageproc
448+
} // namespace imageproc

src/imageproc/ImageCombination.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// Copyright (C) 2019 Joseph Artsimovich <[email protected]>, 4lex4 <[email protected]>
22
// Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file.
33

4+
45
#include "ImageCombination.h"
56

67
#include <QImage>
78
#include <unordered_map>
89
#include <unordered_set>
10+
#include <stdexcept>
911

1012
#include "BinaryImage.h"
1113

@@ -403,4 +405,4 @@ void applyMask(QImage& image, const BinaryImage& bwMask, const BWColor fillingCo
403405

404406
impl::applyMask(image, bwMask, fillingColor);
405407
}
406-
} // namespace imageproc
408+
} // namespace imageproc

src/imageproc/InfluenceMap.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "InfluenceMap.h"
55

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

89
#include "BinaryImage.h"
910
#include "BitOps.h"
@@ -254,4 +255,4 @@ QImage InfluenceMap::visualized() const {
254255
}
255256
return dst;
256257
} // InfluenceMap::visualized
257-
} // namespace imageproc
258+
} // namespace imageproc

src/imageproc/Morphology.cpp

+2-1
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 "GrayImage.h"
@@ -1110,4 +1111,4 @@ BinaryImage blackTopHatTransform(const BinaryImage& src,
11101111
BinaryImage blackTopHatTransform(const BinaryImage& src, const QSize& brick, BWColor srcSurroundings) {
11111112
return blackTopHatTransform(src, brick, src.rect(), srcSurroundings);
11121113
}
1113-
} // namespace imageproc
1114+
} // namespace imageproc

src/imageproc/OrthogonalRotation.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "OrthogonalRotation.h"
55

6+
#include <stdexcept>
7+
68
#include "BinaryImage.h"
79
#include "RasterOp.h"
810

@@ -151,4 +153,4 @@ BinaryImage orthogonalRotation(const BinaryImage& src, const QRect& srcRect, con
151153
BinaryImage orthogonalRotation(const BinaryImage& src, const int degrees) {
152154
return orthogonalRotation(src, src.rect(), degrees);
153155
}
154-
} // namespace imageproc
156+
} // namespace imageproc

src/imageproc/PolygonRasterizer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <QPolygonF>
99
#include <boost/foreach.hpp>
1010
#include <cassert>
11+
#include <stdexcept>
1112

1213
#include "BinaryImage.h"
1314
#include "PolygonUtils.h"

src/imageproc/PolynomialSurface.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (C) 2019 Joseph Artsimovich <[email protected]>, 4lex4 <[email protected]>
22
// Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file.
33

4+
#include <stdexcept>
5+
46
#include "PolynomialSurface.h"
57

68
#include <QDebug>

src/imageproc/Posterizer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "Posterizer.h"
55

6+
#include <stdexcept>
67
#include <cassert>
78
#include <set>
89
#include <unordered_set>

src/imageproc/RastLineFinder.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "RastLineFinder.h"
55

6+
#include <stdexcept>
67
#include <boost/foreach.hpp>
78
#include <cassert>
89
#include <cmath>

src/imageproc/RastLineFinder.h

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <QLineF>
88
#include <QPointF>
9+
#include <stdexcept>
910
#include <cstddef>
1011
#include <string>
1112
#include <vector>

src/imageproc/ReduceThreshold.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "ReduceThreshold.h"
55

6+
#include <stdexcept>
67
#include <cassert>
78

89
namespace imageproc {
@@ -272,4 +273,4 @@ void ReduceThreshold::reduceVertLine(const int threshold) {
272273

273274
m_image = dst;
274275
} // ReduceThreshold::reduceVertLine
275-
} // namespace imageproc
276+
} // namespace imageproc

src/imageproc/SavGolFilter.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "SavGolFilter.h"
55

6+
#include <stdexcept>
7+
68
#include "Grayscale.h"
79
#include "SavGolKernel.h"
810

@@ -274,4 +276,4 @@ QImage savGolFilter(const QImage& src, const QSize& windowSize, const int horDeg
274276
}
275277
return savGolFilterGrayToGray(toGrayscale(src), windowSize, horDegree, vertDegree);
276278
}
277-
} // namespace imageproc
279+
} // namespace imageproc

src/imageproc/Scale.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "Scale.h"
55

6+
#include <stdexcept>
67
#include <cassert>
78

89
#include "GrayImage.h"
@@ -355,4 +356,4 @@ GrayImage scaleToGray(const GrayImage& src, const QSize& dstSize) {
355356
}
356357
return scaleGrayToGray(src, dstSize);
357358
}
358-
} // namespace imageproc
359+
} // namespace imageproc

src/imageproc/SeedFill.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "SeedFill.h"
55

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

89
#include "GrayImage.h"
910
#include "SeedFillGeneric.h"
@@ -448,4 +449,4 @@ GrayImage seedFillGraySlow(const GrayImage& seed, const GrayImage& mask, const C
448449
}
449450
return img;
450451
}
451-
} // namespace imageproc
452+
} // namespace imageproc

src/imageproc/Shear.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "Shear.h"
55

6+
#include <stdexcept>
67
#include <cassert>
78
#include <cmath>
89

@@ -168,4 +169,4 @@ void hShearInPlace(BinaryImage& image, const double shear, const double yOrigin,
168169
void vShearInPlace(BinaryImage& image, const double shear, const double xOrigin, const BWColor backgroundColor) {
169170
vShearFromTo(image, image, shear, xOrigin, backgroundColor);
170171
}
171-
} // namespace imageproc
172+
} // namespace imageproc

0 commit comments

Comments
 (0)