Skip to content

Commit 4c40864

Browse files
committed
build: remove highgui, fixes for ci
- highgui compile problems on mxe, so just remove it. It was used for some debugging which users never need - add CV_BUILD environment support for ci
1 parent 48087a9 commit 4c40864

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

cbird.pri

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,40 @@ QTCORE_PRIVATE_HEADERS="$$[QT_INSTALL_HEADERS]/QtCore/$$QT_VERSION"
6767
INCLUDEPATH += $$QTCORE_PRIVATE_HEADERS
6868

6969
win32 {
70-
!exists( ../libs-win32 ) { error("win32 libs missing") }
71-
!exists( ../libs-win32/build-opencv ) { error("win32 opencv libs missing") }
72-
!exists( ../libs-win32/build-mxe ) { error("win32 mxe libs missing") }
70+
# opencv for mingw doesn't use unix-like install
71+
CV_BUILD=../libs-win32/build-opencv
72+
!equals('',$$(CV_BUILD)) { # take from environment
73+
CV_BUILD=$$(CV_BUILD)
74+
}
75+
!exists( $${CV_BUILD} ) { error("win32 opencv2 build missing, tried <$${CV_BUILD}>") }
7376

74-
INCLUDEPATH += ../libs-win32/build-opencv/install/include
75-
LIBS += -L../libs-win32/build-opencv/install/x64/mingw/lib
77+
INCLUDEPATH += $${CV_BUILD}/install/include
78+
LIBS += -L$${CV_BUILD}/install/x64/mingw/lib
7679
OPENCV_VERSION = 2413
77-
OPENCV_LIBS *= ml objdetect stitching superres videostab calib3d
78-
OPENCV_LIBS *= features2d highgui video photo imgproc flann core
80+
OPENCV_LIBS *= core features2d imgproc video flann
81+
#OPENCV_LIBS *= highgui video photo imgproc
82+
#OPENCV_LIBS *= ml objdetect stitching superres videostab calib3d
7983
for (CVLIB, OPENCV_LIBS) {
8084
LIBS *= -lopencv_$${CVLIB}$${OPENCV_VERSION}
8185
}
8286

83-
INCLUDEPATH = ../libs-win32/build-mxe/include $$INCLUDEPATH # ensure this precedes mxe
84-
LIBS += -L../libs-win32/build-mxe/lib
85-
86-
INCLUDEPATH += ../libs-win32/build-mxe/include/QuaZip-Qt6-1.4
87+
# install prefix for extra deps (in unix convention) we want to keep out of mxe
88+
EXTRA_PREFIX=../libs-win32/build-mxe
89+
!equals('',$$(EXTRA_PREFIX)) {
90+
EXTRA_PREFIX=$$(EXTRA_PREFIX)
91+
}
92+
exists( $${EXTRA_PREFIX} ) {
93+
INCLUDEPATH = $${EXTRA_PREFIX}/include $$INCLUDEPATH # ensure this precedes mxe
94+
LIBS += -L$${EXTRA_PREFIX}/lib
95+
}
96+
97+
QUAZIP_PATH=$${EXTRA_PREFIX}/include/QuaZip-Qt6-6.1.5
98+
!exists( $${QUAZIP_PATH} ) {
99+
QUAZIP_PATH=$(MXE_DIR)/usr/$(MXE_TARGET)/include/QuaZip-Qt6-1.5
100+
}
101+
!exists( $${QUAZIP_PATH} ) { error("quazip missing, tried $${QUAZIP_PATH}") }
102+
103+
INCLUDEPATH += $${QUAZIP_PATH}
87104
LIBS += -lquazip1-qt6
88105

89106
LIBS *= -lz -lpsapi -ldwmapi

src/cvutil.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
#include "ioutil.h"
2626
#include "profile.h"
2727

28+
#ifdef ENABLE_HIGHGUI
2829
#include "opencv2/highgui/highgui.hpp"
30+
#endif
31+
2932
#include "opencv2/imgproc/imgproc.hpp"
3033

3134
#include <QtCore/QMutexLocker>
@@ -159,6 +162,7 @@ void saveMatrix(const cv::Mat& mat, const QString& path) {
159162
});
160163
}
161164

165+
#ifdef ENABLE_HIGHGUI
162166
void showImage(const cv::Mat& img) {
163167
const char* title = "showImage";
164168
cv::namedWindow(title, CV_WINDOW_AUTOSIZE);
@@ -167,6 +171,7 @@ void showImage(const cv::Mat& img) {
167171
cv::waitKey();
168172
cv::destroyWindow(title);
169173
}
174+
#endif
170175

171176
void cImgToCvImg(const CImg<uint8_t>& img, cv::Mat& cvImg) {
172177
if (img.spectrum() >= 3) {
@@ -824,10 +829,12 @@ void ColorDescriptor::create(const cv::Mat& cvImg, ColorDescriptor& desc) {
824829
// this only works if pure black is removed
825830
Q_ASSERT(!histFilter(0, 96, 136));
826831

832+
#ifdef ENABLE_HIGHGUI
827833
if (debug) {
828834
cv::imshow("mask", mask);
829835
cv::moveWindow("mask", mask.cols, 0);
830836
}
837+
#endif
831838

832839
// apply mask
833840
for (int row = 0; row < rgb.rows; row++) {
@@ -1074,6 +1081,7 @@ void ColorDescriptor::create(const cv::Mat& cvImg, ColorDescriptor& desc) {
10741081
}
10751082

10761083
if (debug) {
1084+
#ifdef ENABLE_HIGHGUI
10771085
cv::cvtColor(luv, rgb, convToRgb);
10781086
cv::cvtColor(graph, graph, convToRgb);
10791087

@@ -1086,6 +1094,7 @@ void ColorDescriptor::create(const cv::Mat& cvImg, ColorDescriptor& desc) {
10861094
cv::moveWindow("colors", 0, rgb.rows);
10871095
cv::imshow("colors", graph);
10881096
cv::waitKey(0);
1097+
#endif
10891098
}
10901099
}
10911100

src/cvutil.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ struct ColorDescriptor {
116116
void cImgToCvImg(const CImg<uint8_t>& img, cv::Mat& cvImg);
117117
void cvImgToCImg(const cv::Mat& cvImg, CImg<uint8_t>& cImg);
118118

119+
#ifdef ENABLE_HIGHGUI
119120
// show image viewer and wait for key press
120121
void showImage(const cv::Mat& img);
122+
#endif
121123

122124
// convert QImage to cv::Mat
123125
// unless QImage is manipulated in some way,

windows/mxe-pkg.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
VERSION=$1
33
ARCH=$2
44
BUILD=_win32
55
PKG_DIR=$BUILD/cbird-win
66
ZIP=cbird-windows-$VERSION-$ARCH.zip
77
MXE_BIN="$MXE_DIR/usr/$MXE_TARGET/bin"
8-
OPENCV_BIN=../libs-win32/build-opencv/install/x64/mingw/bin
9-
CROSS_BIN=../libs-win32/build-mxe/bin
8+
OPENCV_BIN="$CV_BUILD/install/x64/mingw/bin"
109
QT_DIR="$MXE_DIR/usr/$MXE_TARGET/qt6"
1110
QT_BIN="$QT_DIR/bin"
1211
STRIP="$MXE_DIR/usr/bin/$MXE_TARGET-strip"
1312

13+
CROSS_BIN="$MXE_BIN"
14+
if [[ ! -d "$EXTRA_PREFIX/bin" ]]; then
15+
CROSS_BIN="$EXTRA_PREFIX/bin";
16+
fi
17+
1418
echo building $VERSION $ARCH in $PKG_DIR
1519

1620
# we need this for dll discovery

0 commit comments

Comments
 (0)