Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-demo.git] / README.md
1 <img src="https://dalihub.github.io/images/DaliLogo320x200.png">
2
3 # Table of Contents
4
5    * [Build Instructions](#build-instructions)
6       * [1. Building for Ubuntu desktop](#1-building-for-ubuntu-desktop)
7          * [Minimum Requirements](#minimum-requirements)
8          * [Building the Repository](#building-the-repository)
9          * [DEBUG Builds](#debug-builds)
10       * [2. GBS Builds](#2-gbs-builds)
11          * [NON-SMACK Targets](#non-smack-targets)
12          * [SMACK enabled Targets](#smack-enabled-targets)
13          * [DEBUG Builds](#debug-builds-1)
14       * [3. Building for Android](#3-building-for-android)
15       * [4. Building for MS Windows](#4-building-for-ms-windows)
16          * [Build with the Visual Studio project](#build-with-the-visual-studio-project)
17          * [Build with CMake](#build-with-cmake)
18       * [5. Building for MacOS](#5-building-for-macos)
19    * [Creating an Example](#creating-an-example)
20
21 # Build Instructions
22
23 ## 1. Building for Ubuntu desktop
24
25 ### Requirements
26
27  - Ubuntu 16.04 or later
28  - Environment created using dali_env script in dali-core repository
29  - GCC version 9
30  - Cmake version 3.8.2 or later
31
32 DALi requires a compiler supporting C++17 features.
33
34 ### Building the Repository
35
36 To build the repository enter the 'build/tizen' folder:
37
38          $ cd dali-demo/build/tizen
39
40 Then run the following commands:
41
42          $ cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX .
43          $ make install -j8
44
45 ### DEBUG Builds
46
47 Specify a debug build when building for desktop by passing the following parameter to cmake:
48
49          $ cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DCMAKE_BUILD_TYPE=Debug .
50
51 Before running make install as normal:
52
53          $ make install -j8
54
55 ### Build Only specific sample
56
57 You can set the sample's name and can build that sample only. For example, If you want to build 'hello-world',
58
59          $ cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DBUILD_EXAMPLE_NAME=hello-world
60          $ make install -j9
61
62 ## 2. GBS Builds
63
64 ### NON-SMACK Targets
65
66          $ gbs build -A [TARGET_ARCH]
67
68 ### SMACK enabled Targets
69
70          $ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
71
72 ### DEBUG Builds
73
74          $ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
75
76 ### Raspberry Pi builds
77
78          $ gbs build -A [TARGET_ARCH] --define "%rpi_style 1"
79
80 ### Build specific sample only
81
82          $ gbs build -A [TARGET_ARCH] --define "build_example_name hello-world"
83
84 ## 3. Building for Android
85
86 ### Requirements
87
88  - Ubuntu 20.04 or later
89  - Open JDK Version 17 or above
90  - Android DALi dependencies
91  - If you are behind a proxy, please set up the "http_proxy" and "https_proxy" environment variables appropriately
92  - Clone dali-core, dali-adaptor, dali-toolkit & android-dependencies to the same folder as dali-demo
93    - Android dependencies can be cloned from: https://github.com/dalihub/android-dependencies
94
95 ### Building the Repository
96 To build the repository enter the 'build/android' folder:
97
98          $ cd dali-demo/build/android
99
100 Then run the following command:
101
102          $ ./build.sh
103
104 For debug build:
105
106          $ DEBUG=1 ./build.sh
107
108 To debug from Android Studio set Android DALi enviroment using setenv script in 'build/android' and launch Android Studio from the enviroment:
109
110          $ . setenv
111          $ <path/to/androidstudio>/bin/studio.sh
112
113 To clean the build:
114
115          $ ./build.sh clean
116
117 To install apks:
118
119          $ adb install -r ./app/build/outputs/apk/debug/dali-demo-debug.apk
120          $ adb install -r ./app/build/outputs/apk/release/dali-demo-release.apk
121
122 Manually granting permission for accessing Storage before running the demo
123          1. Long press the DALi demo app icon => App Info
124          2. Permissions => Storage => Enable
125
126 ## 4. Building for MS Windows
127
128 Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
129 vcpkg-script folder in the windows-dependencies repository.
130
131 - Download the windows-dependencies repository from DaliHub
132
133          $ git clone https://github.com/dalihub/windows-dependencies.git
134
135 - Read the windows-dependencies/vcpkg-script/Readme.md file for more instructions on how to build and install the third-party dependencies.
136
137 ### Build with the Visual Studio project
138   Read the windows-dependencies/README.md file for more instructions on how to build and run DALi for MS Windows.
139
140 ### Build with CMake
141
142   * Requirements
143     It's required the version 3.12.2 of CMake and a Git Bash Shell.
144
145   * Notes and troubleshoting:
146     It should be possible to use the MS Visual studio Developer Command Prompt (https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs) to build DALi from the command line.
147     However, the CMake version installed with MS Visual Studio 2017 is a bit out of date and some VCPKG modules require a higher version.
148     This instructions have been tested with CMake 3.12.2 on a Git Bash shell.
149
150   * Define an environment variable to set the path to the VCPKG folder
151
152     $ export VCPKG_FOLDER=C:/Users/username/Workspace/VCPKG_TOOL
153
154   * Define an environment variable to set the path where DALi is going to be installed.
155
156     $ export DALI_ENV_FOLDER=C:/Users/username/Workspace/dali-env
157
158   * Execute the following commands to create the makefiles, build and install DALi.
159
160     $ cmake -g Ninja . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_FOLDER/vcpkg/scripts/buildsystems/vcpkg.cmake -DENABLE_PKG_CONFIGURE=OFF -DINTERNATIONALIZATION=OFF -DCMAKE_INSTALL_PREFIX=$DALI_ENV_FOLDER
161     $ cmake --build . --target install
162
163   * Options:
164     - CMAKE_TOOLCHAIN_FILE  ---> Needed to find packages installed by VCPKG.
165     - ENABLE_PKG_CONFIGURE  ---> Whether to install pkg configure files (not currently working on MS Windows. CMake modules used instead).
166     - INTERNATIONALIZATION  ---> Whether to generate and install internazionalization '.po' Portable Object files.
167     - CMAKE_INSTALL_PREFIX  ---> Were DALi is installed.
168     - ENABLE_DEBUG          ---> Whether to build with debug enabled.
169     - BUILD_EXAMPLE_NAME    ---> The name of sample what you want to build. To reduce the memory of rpm file, we didn't copy resources now.
170
171   * If dali-toolkit has been compiled with the USE_DEFAULT_RESOURCE_DIR option disabled then is needed to set global environment variables in order to find the default toolkit resources.
172
173     i.e
174     $ setx DALI_ENV_FOLDER C:/Users/username/dali-env
175     $ setx DALI_IMAGE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/images/
176     $ setx DALI_SOUND_DIR $DALI_ENV_FOLDER/share/dali/toolkit/sounds/
177     $ setx DALI_STYLE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/styles/
178     $ setx DALI_STYLE_IMAGE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/styles/images/
179     $ setx DALI_DATA_READ_ONLY_DIR $DALI_ENV_FOLDER/share/dali/
180
181 ## 5. Building for MacOS
182
183 It is assumed that the DALi environment has been set up & that DALi Core, Adaptor & Toolkit have been built accordingly.
184
185 To build the repository enter the 'build/tizen' folder:
186 ```zsh
187 % cd dali-demo/build/tizen
188 ```
189 Then run the following command to set up the build:
190 ```zsh
191 % cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DCMAKE_TOOLCHAIN_FILE=$VCPKG_FOLDER/scripts/buildsystems/vcpkg.cmake -DINTERNATIONALIZATION=OFF
192 ```
193 If a Debug build is required, then add `-DCMAKE_BUILD_TYPE=Debug`
194
195 To build, run:
196 ```zsh
197 % make install -j8
198 ```
199
200 # Creating an Example
201
202 - Make a directory in the `examples` directory. Only one example will be created per directory.
203 - The executable installed will have a `.example` appended to it, e.g. a `blocks` directory produces `blocks.example`.
204 - Add all source files for the required example in this directory.
205 - Modify `com.samsung.dali-demo.xml` to include your example so that it can be launched on target.
206 - No changes are required to the make system as long as the above is followed, your example will be automatically built & installed.
207 - Add a key handler so that the `ESC` or `Back` keys can be used to quit the application.
208 - Depending on the nature of what you are demonstrating, add a launcher line to either:
209   - `demo/dali-demo.cpp`: for graphical showcase demos.
210   - `examples-reel/dali-examples-reel.cpp`: generic examples of how to use various features.
211   - `tests-reel/dali-tests-reel.cpp`: for testing purposes.
212 - Add 2 lines to `shared/dali-demo-strings.h` for the title of your application, please keep in alphabetic order,
213 - Add as many translations of the title as possible to the files in `resources/po`. Currently, this only works on Ubuntu.
214 - In each example folder, create a README.md with images and a description of what the example is demonstrating.
215   Look at [this](examples/particle-system/README.md) for reference.