Skip to content

Commit 189dfc7

Browse files
committedOct 12, 2018
Fix MXE build
1 parent 375afe5 commit 189dfc7

File tree

4 files changed

+53
-127
lines changed

4 files changed

+53
-127
lines changed
 

‎ms-windows/mxe/README

Lines changed: 21 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,30 @@
1-
2-
Scripts to cross build a windows QGIS binary from Linux using MXE:
1+
Scripts to cross build a windows QGIS binary from Linux using MXE:
32
(M cross environment) http://mxe.cc/
43

5-
For now, Python bindings cannot be built with mxe.
4+
Limitations:
5+
- No Python support
6+
- No OpenCL
67

78
Follow the instructions on the website to prepare the mxe environment, you
89
will need to build all required dependencies for QGIS.
910

10-
Note that some of the packages listed below are dependencies of other
11-
packages, you will probably not need to build them all explicitly.
11+
The following command will select the posix threads enabled target and install
12+
the dependencies required by QGIS:
1213

14+
make MXE_TARGETS=i686-w64-mingw32.shared.posix -j 16 \
15+
qca \
16+
qtlocation \
17+
qscintilla2 \
18+
qwt \
19+
gdal \
20+
qtkeychain \
21+
qtserialport \
22+
qtwebkit \
23+
qtwinextras \
24+
libzip \
25+
gsl \
26+
libspatialindex
1327

14-
armadillo
15-
bfd
16-
bzip2
17-
cairo
18-
cmake
19-
curl
20-
dbus
21-
dlfcn-win32
22-
expat
23-
fontconfig
24-
freetds
25-
freetype
26-
freexl
27-
gcc
28-
gdal
29-
gendef
30-
geos
31-
gettext
32-
giflib
33-
glib
34-
gmp
35-
gnutls
36-
gsl
37-
gta
38-
harfbuzz
39-
hdf4
40-
hdf5
41-
icu4c
42-
isl
43-
jasper
44-
jpeg
45-
json-c
46-
lcms
47-
libffi
48-
libgcrypt
49-
libgeotiff
50-
libgnurx
51-
libgpg_error
52-
libiconv
53-
libidn2
54-
libmng
55-
libmysqlclient
56-
libpng
57-
libspatialindex
58-
libssh2
59-
libunistring
60-
libwebp
61-
libxml2
62-
libzip
63-
lzo
64-
mpc
65-
mpfr
66-
netcdf
67-
nettle
68-
openblas
69-
openjpeg
70-
openssl
71-
pcre
72-
pcre2
73-
pixman
74-
pkgconf
75-
portablexdr
76-
postgresql
77-
proj
78-
qca
79-
qscintilla2
80-
qt3d
81-
qtactiveqt
82-
qtbase
83-
qtcanvas3d
84-
qtcharts
85-
qtconnectivity
86-
qtdatavis3d
87-
qtdeclarative
88-
qtgamepad
89-
qtgraphicaleffects
90-
qtimageformats
91-
qtkeychain
92-
qtlocation
93-
qtmultimedia
94-
qtpurchasing
95-
qtquickcontrols
96-
qtquickcontrols2
97-
qtscript
98-
qtscxml
99-
qtsensors
100-
qtserialbus
101-
qtserialport
102-
qtspeech
103-
qtsvg
104-
qttools
105-
qttranslations
106-
qtvirtualkeyboard
107-
qtwebchannel
108-
qtwebkit
109-
qtwebsockets
110-
qtwebview
111-
qtwinextras
112-
qtxmlpatterns
113-
qwt
114-
spatialite
115-
sqlite
116-
tiff
117-
xz
118-
zlib
11928

120-
When done, you can edit the build-mxe.sh script to set the path to your mxe installation.
29+
When done, you can edit the build-mxe.sh script and set the MXE path to your
30+
mxe installation directory.

‎ms-windows/mxe/build-mxe.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ RELEASE_DIR=$(pwd)/release-mxe
4141

4242
# End configuration
4343

44-
45-
44+
# Original target (does not support posix threads)
45+
# TARGET=${TARGET}
46+
TARGET=i686-w64-mingw32.shared.posix
4647

4748
if [[ "$COMMAND" != *"package"* ]]; then
4849
[ -d ${BUILD_DIR} ] && rm -rf ${BUILD_DIR}
@@ -54,6 +55,13 @@ if [[ "$COMMAND" != *"package"* ]]; then
5455

5556
fi
5657

58+
# Patch for 5.11
59+
echo '#include "qwebframe.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebFrame
60+
echo '#include "qwebview.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebView
61+
echo '#include "qwebpage.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebPage
62+
echo '#include "qwebelement.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebElement
63+
cp ${MXE}/usr/${TARGET}/include/windows.h ${MXE}/usr/${TARGET}/include/Windows.h
64+
cp ${MXE}/usr/${TARGET}/include/shlobj.h ${MXE}/usr/${TARGET}/include/ShlObj.h
5765
pushd .
5866

5967
cd ${BUILD_DIR}
@@ -62,7 +70,7 @@ cd ${BUILD_DIR}
6270

6371
if [[ "$COMMAND" != *"package"* ]]; then
6472

65-
${MXE}/usr/bin/i686-w64-mingw32.shared-cmake .. \
73+
${MXE}/usr/bin/${TARGET}-cmake .. \
6674
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
6775
-DCMAKE_INSTALL_PREFIX=${RELEASE_DIR} \
6876
-DENABLE_TESTS=OFF \
@@ -72,7 +80,7 @@ if [[ "$COMMAND" != *"package"* ]]; then
7280
-DWITH_ASTYLE=OFF \
7381
-DWITH_SERVER=OFF \
7482
-DWITH_BINDINGS=FALSE \
75-
-DQT_LRELEASE_EXECUTABLE=${MXE}/usr/i686-w64-mingw32.shared/qt5/bin/lrelease \
83+
-DQT_LRELEASE_EXECUTABLE=${MXE}/usr/${TARGET}/qt5/bin/lrelease \
7684
$ARGS
7785

7886

@@ -82,12 +90,12 @@ fi
8290

8391
# Collect deps
8492

85-
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/i686-w64-mingw32.shared-objdump ${RELEASE_DIR}/qgis.exe
93+
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/${TARGET}-objdump ${RELEASE_DIR}/qgis.exe
8694
for dll in $(ls ${RELEASE_DIR}/*.dll); do \
87-
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/i686-w64-mingw32.shared-objdump $dll; \
95+
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/${TARGET}-objdump $dll; \
8896
done
8997

90-
cp -r ${MXE}/usr/i686-w64-mingw32.shared/qt5/plugins ${RELEASE_DIR}/qt5plugins
98+
cp -r ${MXE}/usr/${TARGET}/qt5/plugins ${RELEASE_DIR}/qt5plugins
9199

92100
cat <<__TXT__ > ${RELEASE_DIR}/qt.conf
93101
[Paths]
@@ -99,7 +107,7 @@ __TXT__
99107
cd ${RELEASE_DIR}/..
100108
ZIP_NAME=mxe-release-$(date +%Y-%m-%d-%H-%I-%S).zip
101109
zip -r ${ZIP_NAME} $(basename ${RELEASE_DIR})
102-
cp ${ZIP_NAME} ${DIR}
110+
mv ${ZIP_NAME} ${DIR}
103111

104112
popd
105113

‎src/gui/qgsgui.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
#ifdef Q_OS_MACX
2727
#include "qgsmacnative.h"
2828
#elif defined (Q_OS_WIN)
29+
#ifndef __MINGW32__
2930
#include "qgswinnative.h"
31+
#else
32+
#include "qgsnative.h"
33+
#endif
3034
#elif defined (Q_OS_LINUX)
3135
#include "qgslinuxnative.h"
3236
#else
@@ -130,7 +134,11 @@ QgsGui::QgsGui()
130134
macNative->setIconPath( QgsApplication::iconsPath() + QStringLiteral( "qgis-icon-macos.png" ) );
131135
mNative = macNative;
132136
#elif defined (Q_OS_WIN)
137+
#ifndef __MINGW32__
133138
mNative = new QgsWinNative();
139+
#else
140+
mNative = new QgsNative();
141+
#endif
134142
#elif defined(Q_OS_LINUX)
135143
mNative = new QgsLinuxNative();
136144
#else

‎src/native/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ IF(APPLE)
5353
)
5454
ENDIF(APPLE)
5555

56-
IF(WIN32)
56+
IF(MSVC)
5757
SET(QGIS_APP_WIN32_SRCS
5858
../../external/wintoast/src/wintoastlib.cpp
5959
win/qgswinnative.cpp
@@ -65,7 +65,7 @@ IF(WIN32)
6565
SET(QGIS_NATIVE_SRCS ${QGIS_NATIVE_SRCS}
6666
${QGIS_APP_WIN32_SRCS}
6767
)
68-
ENDIF(WIN32)
68+
ENDIF(MSVC)
6969

7070
IF(UNIX AND NOT APPLE AND NOT ANDROID)
7171
SET(QGIS_APP_LINUX_SRCS
@@ -91,11 +91,11 @@ IF(APPLE)
9191
)
9292
ENDIF(APPLE)
9393

94-
IF(WIN32)
94+
IF(MSVC)
9595
SET (QGIS_NATIVE_HDRS ${QGIS_NATIVE_HDRS}
9696
win/qgswinnative.h
9797
)
98-
ENDIF(WIN32)
98+
ENDIF(MSVC)
9999

100100
IF(UNIX)
101101
SET (QGIS_NATIVE_HDRS ${QGIS_NATIVE_HDRS}
@@ -108,11 +108,11 @@ INCLUDE_DIRECTORIES(
108108
${CMAKE_CURRENT_BINARY_DIR}
109109
)
110110

111-
IF(WIN32)
111+
IF(MSVC)
112112
INCLUDE_DIRECTORIES(SYSTEM
113113
../../external/wintoast/src
114114
)
115-
ENDIF(WIN32)
115+
ENDIF(MSVC)
116116

117117
#############################################################
118118
# qgis_native library
@@ -168,13 +168,13 @@ IF (APPLE)
168168
TARGET_LINK_LIBRARIES(qgis_native Qt5::MacExtras)
169169
ENDIF (APPLE)
170170

171-
IF (WIN32)
171+
IF (MSVC)
172172
FIND_PACKAGE(Qt5WinExtras)
173173

174174
TARGET_LINK_LIBRARIES(qgis_native shell32)
175175
TARGET_LINK_LIBRARIES(qgis_native ${Qt5Widget_LIBRARIES} ${QT_QTMAIN_LIBRARY})
176176
TARGET_LINK_LIBRARIES(qgis_native Qt5::WinExtras)
177-
ENDIF (WIN32)
177+
ENDIF (MSVC)
178178
# install
179179

180180
INSTALL(TARGETS qgis_native

0 commit comments

Comments
 (0)
Please sign in to comment.