Merge pull request #8173 from elpaso/mxe-reborn

Fix MXE build
This commit is contained in:
Alessandro Pasotti 2018-10-12 16:55:24 +02:00 committed by GitHub
commit d6a863b0a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 128 deletions

View File

@ -1,120 +1,30 @@
Scripts to cross build a windows QGIS binary from Linux using MXE:
Scripts to cross build a windows QGIS binary from Linux using MXE:
(M cross environment) http://mxe.cc/
For now, Python bindings cannot be built with mxe.
Limitations:
- No Python support
- No OpenCL
Follow the instructions on the website to prepare the mxe environment, you
will need to build all required dependencies for QGIS.
Note that some of the packages listed below are dependencies of other
packages, you will probably not need to build them all explicitly.
The following command will select the posix threads enabled target and install
the dependencies required by QGIS:
make MXE_TARGETS=i686-w64-mingw32.shared.posix -j 16 \
qca \
qtlocation \
qscintilla2 \
qwt \
gdal \
qtkeychain \
qtserialport \
qtwebkit \
qtwinextras \
libzip \
gsl \
libspatialindex
armadillo
bfd
bzip2
cairo
cmake
curl
dbus
dlfcn-win32
expat
fontconfig
freetds
freetype
freexl
gcc
gdal
gendef
geos
gettext
giflib
glib
gmp
gnutls
gsl
gta
harfbuzz
hdf4
hdf5
icu4c
isl
jasper
jpeg
json-c
lcms
libffi
libgcrypt
libgeotiff
libgnurx
libgpg_error
libiconv
libidn2
libmng
libmysqlclient
libpng
libspatialindex
libssh2
libunistring
libwebp
libxml2
libzip
lzo
mpc
mpfr
netcdf
nettle
openblas
openjpeg
openssl
pcre
pcre2
pixman
pkgconf
portablexdr
postgresql
proj
qca
qscintilla2
qt3d
qtactiveqt
qtbase
qtcanvas3d
qtcharts
qtconnectivity
qtdatavis3d
qtdeclarative
qtgamepad
qtgraphicaleffects
qtimageformats
qtkeychain
qtlocation
qtmultimedia
qtpurchasing
qtquickcontrols
qtquickcontrols2
qtscript
qtscxml
qtsensors
qtserialbus
qtserialport
qtspeech
qtsvg
qttools
qttranslations
qtvirtualkeyboard
qtwebchannel
qtwebkit
qtwebsockets
qtwebview
qtwinextras
qtxmlpatterns
qwt
spatialite
sqlite
tiff
xz
zlib
When done, you can edit the build-mxe.sh script to set the path to your mxe installation.
When done, you can edit the build-mxe.sh script and set the MXE path to your
mxe installation directory.

View File

@ -41,8 +41,9 @@ RELEASE_DIR=$(pwd)/release-mxe
# End configuration
# Original target (does not support posix threads)
# TARGET=${TARGET}
TARGET=i686-w64-mingw32.shared.posix
if [[ "$COMMAND" != *"package"* ]]; then
[ -d ${BUILD_DIR} ] && rm -rf ${BUILD_DIR}
@ -54,6 +55,13 @@ if [[ "$COMMAND" != *"package"* ]]; then
fi
# Patch for 5.11
echo '#include "qwebframe.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebFrame
echo '#include "qwebview.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebView
echo '#include "qwebpage.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebPage
echo '#include "qwebelement.h"' > ${MXE}/usr/${TARGET}/qt5/include/QtWebKitWidgets/QWebElement
cp ${MXE}/usr/${TARGET}/include/windows.h ${MXE}/usr/${TARGET}/include/Windows.h
cp ${MXE}/usr/${TARGET}/include/shlobj.h ${MXE}/usr/${TARGET}/include/ShlObj.h
pushd .
cd ${BUILD_DIR}
@ -62,7 +70,7 @@ cd ${BUILD_DIR}
if [[ "$COMMAND" != *"package"* ]]; then
${MXE}/usr/bin/i686-w64-mingw32.shared-cmake .. \
${MXE}/usr/bin/${TARGET}-cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_INSTALL_PREFIX=${RELEASE_DIR} \
-DENABLE_TESTS=OFF \
@ -72,7 +80,7 @@ if [[ "$COMMAND" != *"package"* ]]; then
-DWITH_ASTYLE=OFF \
-DWITH_SERVER=OFF \
-DWITH_BINDINGS=FALSE \
-DQT_LRELEASE_EXECUTABLE=${MXE}/usr/i686-w64-mingw32.shared/qt5/bin/lrelease \
-DQT_LRELEASE_EXECUTABLE=${MXE}/usr/${TARGET}/qt5/bin/lrelease \
$ARGS
@ -82,12 +90,12 @@ fi
# Collect deps
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/i686-w64-mingw32.shared-objdump ${RELEASE_DIR}/qgis.exe
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/${TARGET}-objdump ${RELEASE_DIR}/qgis.exe
for dll in $(ls ${RELEASE_DIR}/*.dll); do \
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/i686-w64-mingw32.shared-objdump $dll; \
$PYDEPLOY --build=${RELEASE_DIR} --objdump=${MXE}/usr/bin/${TARGET}-objdump $dll; \
done
cp -r ${MXE}/usr/i686-w64-mingw32.shared/qt5/plugins ${RELEASE_DIR}/qt5plugins
cp -r ${MXE}/usr/${TARGET}/qt5/plugins ${RELEASE_DIR}/qt5plugins
cat <<__TXT__ > ${RELEASE_DIR}/qt.conf
[Paths]
@ -99,7 +107,7 @@ __TXT__
cd ${RELEASE_DIR}/..
ZIP_NAME=mxe-release-$(date +%Y-%m-%d-%H-%I-%S).zip
zip -r ${ZIP_NAME} $(basename ${RELEASE_DIR})
cp ${ZIP_NAME} ${DIR}
mv ${ZIP_NAME} ${DIR}
popd

View File

@ -26,7 +26,11 @@
#ifdef Q_OS_MACX
#include "qgsmacnative.h"
#elif defined (Q_OS_WIN)
#ifndef __MINGW32__
#include "qgswinnative.h"
#else
#include "qgsnative.h"
#endif
#elif defined (Q_OS_LINUX)
#include "qgslinuxnative.h"
#else
@ -130,7 +134,11 @@ QgsGui::QgsGui()
macNative->setIconPath( QgsApplication::iconsPath() + QStringLiteral( "qgis-icon-macos.png" ) );
mNative = macNative;
#elif defined (Q_OS_WIN)
#ifndef __MINGW32__
mNative = new QgsWinNative();
#else
mNative = new QgsNative();
#endif
#elif defined(Q_OS_LINUX)
mNative = new QgsLinuxNative();
#else

View File

@ -53,7 +53,7 @@ IF(APPLE)
)
ENDIF(APPLE)
IF(WIN32)
IF(MSVC)
SET(QGIS_APP_WIN32_SRCS
../../external/wintoast/src/wintoastlib.cpp
win/qgswinnative.cpp
@ -65,7 +65,7 @@ IF(WIN32)
SET(QGIS_NATIVE_SRCS ${QGIS_NATIVE_SRCS}
${QGIS_APP_WIN32_SRCS}
)
ENDIF(WIN32)
ENDIF(MSVC)
IF(UNIX AND NOT APPLE AND NOT ANDROID)
SET(QGIS_APP_LINUX_SRCS
@ -91,11 +91,11 @@ IF(APPLE)
)
ENDIF(APPLE)
IF(WIN32)
IF(MSVC)
SET (QGIS_NATIVE_HDRS ${QGIS_NATIVE_HDRS}
win/qgswinnative.h
)
ENDIF(WIN32)
ENDIF(MSVC)
IF(UNIX)
SET (QGIS_NATIVE_HDRS ${QGIS_NATIVE_HDRS}
@ -108,11 +108,11 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
)
IF(WIN32)
IF(MSVC)
INCLUDE_DIRECTORIES(SYSTEM
../../external/wintoast/src
)
ENDIF(WIN32)
ENDIF(MSVC)
#############################################################
# qgis_native library
@ -168,13 +168,13 @@ IF (APPLE)
TARGET_LINK_LIBRARIES(qgis_native Qt5::MacExtras)
ENDIF (APPLE)
IF (WIN32)
IF (MSVC)
FIND_PACKAGE(Qt5WinExtras)
TARGET_LINK_LIBRARIES(qgis_native shell32)
TARGET_LINK_LIBRARIES(qgis_native ${Qt5Widget_LIBRARIES} ${QT_QTMAIN_LIBRARY})
TARGET_LINK_LIBRARIES(qgis_native Qt5::WinExtras)
ENDIF (WIN32)
ENDIF (MSVC)
# install
INSTALL(TARGETS qgis_native