Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix MXE build
  • Loading branch information
elpaso committed Oct 12, 2018
1 parent 375afe5 commit 189dfc7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 127 deletions.
132 changes: 21 additions & 111 deletions ms-windows/mxe/README
@@ -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.
24 changes: 16 additions & 8 deletions ms-windows/mxe/build-mxe.sh
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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 \
Expand All @@ -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


Expand All @@ -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]
Expand All @@ -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

Expand Down
8 changes: 8 additions & 0 deletions src/gui/qgsgui.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/native/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 189dfc7

Please sign in to comment.