0.8
Getting Started

There are various ways to get started with EGT depending on your requirements.

If building for a Microchip MPU Xplained or EK type board, visit Linux4SAM. If you are building EGT on a PC, you can start by just fetching the source of the EGT project. If you are developing for and deploying to a target board, the easiest way to work with EGT is part of a buildroot SDK which already includes a cross compiler and all of the necessary dependencies and tools.

Also, see Eclipse Development Environment Setup for how to setup the Eclipse IDE for host or cross compiling.

Fetching Source

Fetch the source:

git clone --recursive https://github.com/linux4sam/egt.git
Note
Note the --recursive option. This option is necessary to initialize any git submodules in the project.

Building

EGT uses the GNU autotools, like autoconf and automake, for building on Linux platforms.

To build for a PC, first install the recommended dependencies:

sudo apt-get install build-essential automake autoconf libtool pkg-config \
libdrm-dev libinput-dev libcairo-dev libjpeg-dev libmagic-dev gettext

Optional dependencies include:

sudo apt-get install librsvg2-dev liblua5.3-dev libcurl4-openssl-dev \
libxkbcommon-dev xkb-data libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install libasound2-dev libsndfile1-dev

Then clone the source and build.

git clone --recursive https://github.com/linux4sam/egt.git
cd egt
./autogen.sh
./configure
make

Then run.

cd examples/basic
./basic

EGT also supports cross compilation for target systems. If you already have a cross compiler available with dependent libraries available, add it to your PATH and follow the standard instructions.

./autogen.sh
./configure --prefix=/nfsroot/root/egt/ --host=arm-buildroot-linux-gnueabi
make

Configure Options

You can run "./configure --help" to see more options. Some non-standard options are listed here.

--enable-code-coverage
Whether to enable code coverage support
--disable-debug
build without debugging support [default=no]
--enable-gcov
turn on code coverage analysis tools
--enable-profile
turn on profiling tools
--enable-examples
build examples [default=yes]
--enable-lto
enable gcc's LTO [default=no]

Cross Compiling With Buildroot

EGT is included as a package as part of the buildroot-external-microchip project. To build a complete SDK and target filesystem for a board, follow the instructions found in that project's README with the following versions.

git clone https://github.com/linux4sam/buildroot-external-microchip.git -b egt_devel
git clone https://git.buildroot.net/buildroot -b 2019.05.1
cd buildroot
BR2_EXTERNAL=../buildroot-external-microchip/ make sam9x60ek_egt_defconfig
make

See the configs directory in the buildroot-external-microchip project for alternate EGT defconfigs.

First Application

The examples folder of the EGT project contains various examples. This is the basic example which shows the minimum necessary to create a window with a button on it.

The include file <egt/ui> contains most basic functionality needed.

#include <egt/ui>
int main(int argc, const char** argv)
{
egt::Application app(argc, argv);
egt::TopWindow window;
egt::Button button(window, "Press Me");
egt::center(button);
window.show();
return app.run();
}

If you want to use a UI file instead.

#include <egt/detail/imagecache.h>
#include <egt/ui>
#include <egt/uiloader.h>
int main(int argc, const char** argv)
{
egt::Application app(argc, argv, "basicui");
egt::experimental::UiLoader loader;
auto window = loader.load(egt::detail::resolve_file_path("ui.xml"));
window->show();
return app.run();
}
egt::v1::alignmask::center