Skip to content

Compile

Muchamad Arifin Dwi P edited this page Oct 10, 2023 · 12 revisions

How to compile and run

Important: currently the Sultan POS supported by Qt 5.x only. And have no plan of supporting Qt 6.x. For Windows please use Qt MinGW version.

There are 2 ways to compile the project

  1. Using Qt Framework Bundle
  2. Using Qt from OS (Only for Linux)

Using Qt Framework Bundle

This can be work on Mac, Windows and Linux

  • Clone the project to your local computer
  • On Ubuntu need to install : $ sudo apt-get install build-essential libcups2-dev
  • Download and install the latest framework based on your architecture here : download
  • Open Qt Creator and go to 'File' -> 'Open Project'. Navigate to sultan.pro.
  • When show the configuration window, just click on configure
  • Click Run icon at the bottom left of the Qt Creator window.

Using Qt from OS

This is for Ubuntu distribution

  • Install requirement software
    $ sudo apt-get install build-essential qt5-default libqt5sql5-mysql libqt5sql5-sqlite libqt5websockets5-dev libqt5printsupport5 libqt5webkit5-dev libcups2-dev sqlite3
  • Clone the project to your local computer
  • CD to root directory project and create a build directory
    $ mkdir build
  • CD to build folder
    $ cd build
  • run qmake
    $ qmake CONFIG+=debug ../sultan.pro
  • run make
    $ make -j4
  • add execute permission
    $ chmod +x bin/Sultan.sh
  • run the app
    $ bin/Sultan.sh

Single binary compile

By default the project will compile the project separated on each lib (libdb, libserver, libgui, libprint), this setup actually for development purpose because it is easier to track the files. When on release the project can be compile into only 1 file binary which is Sultan file only (no shared library). This can achieve by pass SINGLEBIN option to the config when calling the qmake.
$ qmake CONFIG+=release CONFIG+=SINGLEBIN ../sultan.pro

When using the Qt Creator, just go to project -> build steps and add additional arguments on qmake step
CONFIG+=SINGLEBIN

qmake available flag

  • SINGLEBIN : described above
  • USE_EMBED_BROWSER : this will use internal browser (QWebView or QWebEngine)
  • USE_WEBENGINE : this can be use when USE_EMBED_BROWSER is activated. Use QWebEngine instead of QWebView.
  • NO_PRINTER_SPOOL : disable printer spool (winspool printer / cups)
  • NO_PRINTER_DEVICE : disable printer device lp (on linux usually /dev/lp or /dev/usb/lp0)
  • USE_LIBUSB : enable printer using libusb (direct send the printer command to usb - no need usb driver on linux)

Mysql

Currently the app support for SQlite and Mysql. Using SQlite is the easier way to make the app running. But if you want to use Mysql, it will need several steps :

  • Install mysql server
  • When start the Sultan app on configuration window. Select database to MySql and setup the value as your mysql setting.

Note

Sultan POS use web view to get OAuth2 login from Google. There are 2 options to use:

  1. QWebView : deprecated since Qt 5.6. If you want to use it on latest version of Qt, please compile it on your own. Or just use Qt 5.5 for easier.
  2. QWebEngineView : on Windows available only on Qt with MVC 2015+ compiler

Update version 1712xx the oauth request will be send to OS web browser, so no need QWebView or QWebEngine unless the USE_EMBED_BROWSER flag activated