Running LittlevGL PC Simulator from Qt-Creator in Windows
Written by
ScarsFun
on
Qt-Creator is a powerful IDE and is easy manage non Qt project too. With the latest release Qt 5.12.0, GCC x64 compiler, Windows is also supported. This is a step by step tutorial
- to run LittlevGL PC simulator
- in Windows 10
- from Qt-Creator 4.8.0
- with Mingw 64 bit compiler.
Requirements
- Qt-Creator and Mingw-64bit environment. Refer to https://www.qt.io/ to install the open source version of Qt environment.
- SDL2 developement libraries for mingw: https://www.libsdl.org/download-2.0.php
- LittlevGL PC Simulator: https://littlevgl.com/pc-simulator
Copy SDL2 libraries
- In pc_simulator folder create a subfolder named SDL2.
- Copy sdl header files there.
- Create SDL2/lib subfolder and copy libraries for i686-w64 from SDL2 package.
Settin up Qt-Creator project
- Open Qt-Creator
- from file menu select new file or project.
- in the form select non-Qt-project and plain C application. Press choose button.
- in the project management form:
- location: select project directory location and type a project name (ex. : pc_sim). press next button.
- build system: select qmake. press next button.
- kits: select Mingw 64-bit. press next button.
- summary: press finish button.
A new subfolder is created with pc_sim.pro, pc_sim.pro.user and main.c template.
- close project from Qt-Creator.
- move pc_sim.pro, pc_sim.pro.user to main directory. remove pc_sim subfolder.
- from Qt-Creator: open project pc_sim.pro. Edit file pc_sim.pro and remove this two lines:
SOURCES += \ main.c
- save project
- in projects pane: right click on pc_sim project and select Add Existing Directory from menu.
All sources files and includes should be already selected by default.
- from file list: deselect folder lv_examples and SDL2. Then add only .c and .h files from folder lv_examples/demo.
- edit pc_sim.pro and add this lines to add SDL2 library and includes to the project:
LIBS += -L$$PWD/SDL2/lib/ -lmingw32 -lSDL2main -lSDL2 INCLUDEPATH += $$PWD/SDL2 DEPENDPATH += $$PWD/SDL2
- Save project.
Build and Run the project
- Select release build from left panel icon.
- Run demo
Qt-Creator is available also for Linux and MACOS. Adapting LittlevGL PC Simulator project on these OS should be simple. The complete project is available at this Github link: https://github.com/ScarsFun/pc_simulator