Created
June 27, 2017 15:32
-
-
Save DavidEGrayson/5732a2a68cef9942ebdccb0037fbeaf4 to your computer and use it in GitHub Desktop.
Script for building the Qt 5.8.0 dynamic layouts example in MSYS2, with static linking. Posted here for StackOverflow question.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -ue | |
pacman -S --needed "${MINGW_PACKAGE_PREFIX}-qt5-static" | |
if [ ! -d qt ]; then | |
wget https://download.qt.io/official_releases/qt/5.8/5.8.0/submodules/qtbase-opensource-src-5.8.0.tar.xz -O qt.tar.xz | |
tar -xf qt.tar.xz | |
mv qtbase-opensource-src-5.8.0 qt | |
fi | |
qtbase="${MINGW_PREFIX}/qt5-static" | |
rm -r build | |
mkdir build | |
cd build | |
mkdir bin moc obj | |
cat > obj/plugins.cpp <<EOF | |
#include <QtPlugin> | |
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin); | |
EOF | |
echo "compiling reference to plugins" | |
g++ \ | |
-I $qtbase/include \ | |
-I $qtbase/include/QtCore \ | |
-c obj/plugins.cpp \ | |
-o obj/plugins.o | |
CFLAGS=" | |
-mwindows | |
-I. | |
-I$qtbase/include/ | |
-I$qtbase/include/QtWidgets | |
-I$qtbase/include/QtGui | |
-I$qtbase/include/QtCore | |
" | |
LDFLAGS="-L$qtbase/lib -L$qtbase/share/qt5/plugins/platforms -Wl,-gc-sections" | |
LIBS=" | |
-lqwindows | |
-lQt5Widgets -lQt5Gui -lQt5ThemeSupport -lQt5FontDatabaseSupport | |
-lQt5EventDispatcherSupport -lQt5Core | |
-lqtpcre -lqtlibpng -lqtharfbuzz -lqtfreetype | |
-lole32 -luuid -lwinmm -lws2_32 -loleaut32 -limm32 -ldwmapi -lmpr -lwinmm -lopengl32 | |
-luxtheme | |
" | |
echo "compiling dynamiclayouts" | |
$qtbase/bin/moc ../qt/examples/widgets/layouts/dynamiclayouts/dialog.h > moc/dynamiclayouts.cpp | |
g++ -mwindows $CFLAGS $LDFLAGS \ | |
../qt/examples/widgets/layouts/dynamiclayouts/dialog.cpp \ | |
../qt/examples/widgets/layouts/dynamiclayouts/main.cpp \ | |
moc/dynamiclayouts.cpp \ | |
obj/plugins.o \ | |
$LIBS -o bin/dynamiclayouts.exe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment