DALi Development Guide

Dynamic Animation Library

Home Page

Setting up the NUI development environment on Ubuntu

This guide explains how to setup, build and run NUI (DALi C#) applications using Visual Studio Code (VSC).

It assumes the starting point is a completely ‘clean’ system, though that is not essential.

VSC can be be installed on Ubuntu 14.04 and onwards.

The NUI Hello World tutorial provides an introduction into NUI application development, describing how to display text in a text label.

Overview

This document covers:

Installation of .NET Core and VSC
Getting NUI source code
NUI build environment
Building NUI source code
Build and run the Hello World tutorial
Appendix A - Configuring firewall proxy settings
Appendix B - Clean build

Step-by-step guide

Installation of .NET Core and Visual Studio Code (VSC)

    $ code            // Open VSC
    $ code .          // Open VSC in current directory
    $ code myfile     // Open file in VSC

VSC requires installation of required packages and libraries. It may be necessary to configure the firewall proxy settings to enable download via http. The procedures for firewall setup are described in Appendix A.

Getting started with Visual Studio code will give you a basic understanding of projects in VSC.

Back to top

Get NUI source code from Git

    $ git clone git@github.com:dalihub/dali-core
    $ git clone git@github.com:dalihub/dali-adaptor
    $ git clone git@github.com:dalihub/dali-csharp-binder
    $ git clone git@github.com:dalihub/dali-toolkit
    $ git clone git@github.com:dalihub/app-stub
    $ git clone git@github.com:dalihub/nui

Back to top

NUI build environment

    $ cd ~/DALiNUI
    $ dali-core/build/scripts/dali_env -c
    $ dali-env/opt/bin/dali_env -s > setenv
    $ . setenv

These steps only need to be done once.

You will have to source your environment variables every time you open up a new terminal (or you can add to .bashrc if you prefer). You can do this by sourcing the ‘‘setenv’’ script you created above:

    $ . setenv

Back to top

Building NUI source code

The shared library files (.so) will be built and installed into the ~/DALiNUI/dali-env/opt/lib folder.

    $ git clone git@github.com:dalihub/dali-demo
    $ cd ~/DALiNUI/dali-demo
    $ git checkout devel/master

    Build from README

    $ cd ~/DALiNUI/dali-env/opt/bin
    $ dali-demo

If ok, DALi demo window will appear.

    $ cd dali-csharp-binder
    $ autoreconf --install
    $ ./configure --prefix=$DESKTOP_PREFIX
    $ make install -j8
    $ cd ~/DALiNUI/app-stub
    $ dotnet restore
    $ dotnet build
    $ cd ~/DALiNUI/nui
    $ ~/bin/build-nui-as-lib.sh

This creates a separate Tizen.NUI.Code folder which is used to build the NUI toolkit as a separate library. It does not build any of the example code within the sample folders.

Back to top

Build your own application

    $ cd ~/DALiNUI
    $ mkdir tutorials
    $ cp hello-world.cs ~/DALiNUI/tutorials
    $ cd ~/DALiNUI
    $ . setenv
    $ cd ~/DALiNUI/tutorials
    $ dotnet new console

The ‘setenv’ will not be necessary, if the environment has been set up in your .bashrc as described in Build environment)

The ‘dotnet new console’ creates a Project, with a Project file tutorials.csproj and a Program.cs file.

    <ItemGroup>
      <ProjectReference Include="..\nui\Tizen.NUI.Code\Tizen.NUI.csproj" />
      <ProjectReference Include="..\app-stub\Tizen.Applications.csproj" />
    </ItemGroup>
2. Add the following line inside the 'PropertyGroup' element:
    <DefineConstants>DOT_NET_CORE</DefineConstants>
    $ dotnet restore

Running dotnet restore gives you access to the required .NET Core packages that are needed to build your project.

A tasks.json file is essential, or else will get “No task runner configured”, or “Error Could not find the Pre Launch Task ‘build’” message pane on building.

Note: This step builds the ‘tutorials’ executable.

The screenshot shows the key files associated with the “hello world” project in VSC Explorer.

Modify Hello World Application window size

This section provides an insight into the configuration of the application “Launch” profile.

In VSC, Open launch.json via the Explorer. In the “configurations” section, add the required width and height to the environment variable:

    "name": ".NET Core Launch (console)",

    ...
    ...
    "env": {
        "DALI_WINDOW_WIDTH":"600",
        "DALI_WINDOW_HEIGHT":"800"
    },

These settings will be picked up if the application is run via F5.

Back to top

Appendix A - Configuring Firewall proxy settings

The proxy settings are saved to the settings.json file.

The screenshot shows the installed C# extension package, and also the proxy settings for the library packages in the settings.json file.

These export variables could also be set in your .bashrc file.

Back to top