[Tuto01Basic] Create an application

The first tutorial represents a basic application that launches a simple empty frame.

../../_images/tuto01Basic.png

Prerequisites

Before reading this tutorial, you should have seen :

Structure

An application is organized around three main files :
  • CMakeLists.txt
  • Properties.cmake
  • plugin.xml

CMakeLists.txt

The CMakeLists is parsed by CMake. For the aplication it should contain the line :

fwLoadProperties()

This line allows to load Properties.cmake file.

Properties.cmake

This file describes the project information and requirements :

set( NAME Tuto01Basic ) # Name of the application
set( VERSION 0.1 ) # Version of the application
set( TYPE APP ) # Type APP represent "Application"
set( DEPENDENCIES  ) # For an application we have no dependencies (libraries to link)
set( REQUIREMENTS # The bundles used by this application
    dataReg # to load the data registry
    servicesReg # to load the service registry
    gui # to load gui
    guiQt # to load qt implementation of gui
    fwlauncher # executable to run the application
    appXml # to parse the application configuration
)

# Set the configuration to use : 'tutoBasicConfig'
bundleParam(appXml PARAM_LIST config PARAM_VALUES tutoBasicConfig)

This file contains the minimal requirements to launch an application with a Qt user interface.

Note

The Properties.cmake file of the application is used by CMake to compile the application but also to generate the profile.xml: the file used to launch the application.

plugin.xml

This file is located in the rc/ directory of the application. It defines the services to run.

<!-- Application name and version (the version is automatically replaced by CMake
     using the version defined in the Properties.cmake) -->
<plugin id="Tuto01Basic" version="@DASH_VERSION@">

    <!-- The bundles in requirements are automatically started when this
         Application is launched. -->
    <requirement id="dataReg" />
    <requirement id="servicesReg" />
    <requirement id="guiQt" />

    <!-- Defines the App-config -->
    <extension implements="::fwServices::registry::AppConfig">
        <id>tutoBasicConfig</id><!-- identifier of the configuration -->
        <config>

            <!-- Frame service -->
            <service uid="myFrame" type="::gui::frame::SDefaultFrame">
                <gui>
                    <frame>
                        <name>tutoBasicApplicationName</name>
                        <icon>@BUNDLE_PREFIX@/Tuto01Basic_0-1/tuto.ico</icon>
                        <minSize width="800" height="600" />
                    </frame>
                </gui>
            </service>

            <start uid="myFrame" /><!-- start the frame service -->

        </config>
    </extension>
</plugin>

The ::fwServices::registry::AppConfig extension defines the configuration of an application.

id:
The configuration identifier.
config:

Contains the list of objects and services used by the application.

For this tutorial, we have no object and only one service ::gui::frame::DefaultFrame.

There are others tags that will be described in the next tutorials.

Run

To run the application, you must call the following line into the install or build directory:

bin/fwlauncher Bundles/Tuto01Basic_0-1/profile.xml