-
Notifications
You must be signed in to change notification settings - Fork 17
Build from Linux to Windows 64 bit Static
There are three steps for building static QML app from Linux for Windows 64-bit :
MXE (M cross environment) is a Makefile that compiles a cross compiler and cross compiles many free libraries such as SDL and Qt.
-
Download the latest version of MXE and save it to your preferred directory. In this tutorial, I'll save it to
/home/radhi/MXE
:git clone https://github.com/mxe/mxe.git /home/radhi/MXE
-
From terminal, enter the MXE directory :
cd /home/radhi/MXE
-
Inside the MXE directory, build static Qt for Windows 64-bit. It might take a long time, depending on your system. Fortunately,
qamel
only uses some Qt modules, i.e. moduleqml
,quick
,widgets
andsvg
, so we don't have to build all Qt modules :make MXE_TARGETS="x86_64-w64-mingw32.static" qtbase qtsvg qtquickcontrols qtquickcontrols2
-
Once build process finished, add
<MXE dir>/usr/bin
to your$PATH
. This can be done by adding your.profile
file with following line :export PATH=<MXE dir>/usr/bin:$PATH
-
Now static Qt5 for Windows 64-bit has been installed and ready to use.
Once static Qt installed, we need to create a new profile for qamel
. In this tutorial, we will create a profile named win_64_static
by running :
qamel profile setup win_64_static
The command above will ask you to submit the information about your OS, build mode, and path to the static Qt that you've installed before. Once finished, it should look like this :
Thanks for using qamel, QML's binding for Go.
Please specify the target OS for this profile. Possible values are "windows", "linux" and "darwin".
Keep it empty to use your system OS.
Target OS (default linux) : windows
Please specify the target architecture for this profile. Possible values are "386" and "amd64".
Keep it empty to use your system architecture.
Target arch (default amd64) : amd64
Please specify whether this profile used to build static or shared app.
Use static mode (y/n, default n) : y
Please specify the *full path* to your Qt's tools directory.
This might be different depending on your platform or your target. For example, in Linux with Qt 5.11.1, the tools are located in $HOME/Qt5.11.1/5.11.1/gcc_64/bin/
Qt tools dir : /home/radhi/MXE/usr/x86_64-w64-mingw32.static/qt5/bin/
qmake : found
moc : found
rcc : found
Please specify the *full path* to your C and C++ compiler.
Keep it empty to use the default compiler on your system.
C compiler (default gcc) : /home/radhi/MXE/usr/bin/x86_64-w64-mingw32.static-gcc
C++ compiler (default g++) : /home/radhi/MXE/usr/bin/x86_64-w64-mingw32.static-g++
Generating some code for binding...done
Saving profile win_64_static...done
Setup finished.
Now you can get started on your own QML app.
Once static Qt installed and the profile created, the last thing to do is to build our qamel
app using the static Qt. To do that, run qamel build
using profile that we've created before :
qamel build -p win_64_static