Skip to content

Installation

Radhi Fadlillah edited this page Dec 2, 2019 · 6 revisions

Before installing this binding, make sure Go already installed on your system. There are three steps for installing Qamel :

Install Qamel

To install qamel, run these commands :

go get -u -v github.com/go-qamel/qamel/cmd/qamel
go get -u -d -v github.com/go-qamel/qamel

Wait until the installation finished. Once finished, you can run qamel -h to check :

$ qamel -h
qamel is tools and binding for creating GUI app in Go using Qt + QML

Usage:
  qamel [command]

Available Commands:
  build       Build QML app
  docker      Build QML app using Docker image
  help        Help about any command
  profile     Manage profiles for QML's binding

Flags:
  -h, --help   help for qamel

Use "qamel [command] --help" for more information about a command.

If it's error with message like "qamel: command not found", make sure $GOPATH/bin is accessible from your $PATH, because that's where qamel will be installed.

Install Qt

If you are on Linux, make sure the required dependencies already installed on your system. Download the official installer and follow along the steps. In this tutorial, I will install it to C:\Qt\Qt5.12.0.

When asked to choose Qt's components to install, make sure to choose at least one of Qt5 version. In Windows, I recommend you to install at least these :

Qt
├── Qt 5.12.0
|   ├── MinGW 7.3.0 64-bit
|   ├── Qt Charts
|   └── Qt Data Visualization
└── Tools
    ├── Qt Creator 4.8.0
    └── MinGW 7.3.0 64-bit

If you are using Linux, I recommend to install these components :

Qt
├── Qt 5.12.0
|   ├── Desktop gcc 64-bit
|   ├── Qt Charts
|   └── Qt Data Visualization
└── Tools
    └── Qt Creator 4.8.0

Set up new profile

Once Qt installed, we need to set up a profile for qamel to use. Do it by running :

qamel profile setup

The command above will ask you to submit the information about your OS, build mode, and path to the Qt that you've installed before. Once finished, it should look like this :

$ qamel profile setup
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 windows) : 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) : n

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 : C:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin
qmake        : found
moc          : found
rcc          : found

Please specify the *full path* to your compiler.
Keep it empty to use the default compiler on your system.

C compiler (default gcc.exe)   : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\gcc.exe
C++ compiler (default g++.exe) : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\g++.exe
Objdump (default objdump.exe)  : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\objdump.exe

Since you are targeting Windows, you might want to set icon for your executable file. To do so, please specify the *full path* to windres on your system. It's usually located in the directory where MinGW is installed.

Path to windres : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\windres.exe

Generating some code for binding...done
Saving profile default...done

Setup finished.
Now you can get started on your own QML app.

To check your saved profile, run qamel profile print :

$ qamel profile print
Details of profile default
OS      : windows
Arch    : amd64
Static  : false
Qmake   : C:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\qmake.exe
Moc     : C:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\moc.exe
Rcc     : C:\Qt\Qt5.12.0\5.12.0\mingw73_64\bin\rcc.exe
Gcc     : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\gcc.exe
G++     : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\g++.exe
Objdump : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\objdump.exe
Windres : C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\windres.exe