Merge branch 'devel/master' into tizen_6.5
[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-android-builds)
15       * [4. Building for MS Windows](#4-windows-builds)
16          * Build with the Visual Studio project.
17          * 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 ## 2. GBS Builds
56
57 ### NON-SMACK Targets
58
59          $ gbs build -A [TARGET_ARCH]
60
61 ### SMACK enabled Targets
62
63          $ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
64
65 ### DEBUG Builds
66
67          $ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
68
69 ### Raspberry Pi builds
70
71          $ gbs build -A [TARGET_ARCH] --define "%rpi_style 1"
72
73 # Creating an example
74
75  - Make a directory in the "examples" directory. Only one example will be created per directory.
76  - The executable installed will have a ".example" appended to it, e.g. a "blocks" directory produces "blocks.example".
77  - Add all source files for the required example in this directory.
78  - Modify "com.samsung.dali-demo.xml" to include your example so that it can be launched on target.
79  - No changes are required to the make system as long as the above is followed, your example will be automatically built & installed.
80
81 ## 3. Building for Android
82
83 ### Requirements
84
85  - Ubuntu 16.04 or later
86  - Android DALi dependencies
87  - If you are behind a proxy, please set up the "http_proxy" and "https_proxy" environment variables appropriately
88  - Clone dali-core, dali-adaptor, dali-toolkit & android-dependencies to the same folder as dali-demo
89    - Android dependencies can be cloned from: https://github.com/dalihub/android-dependencies
90
91 ### Building the Repository
92 To build the repository enter the 'build/android' folder:
93
94          $ cd dali-demo/build/android
95
96 Then run the following command:
97
98          $ ./build.sh
99
100 For debug build:
101
102          $ DEBUG=1 ./build.sh
103
104 To debug from Android Studio set Android DALi enviroment using setenv script in 'build/android' and launch Android Studio from the enviroment:
105
106          $ . setenv
107          $ <path/to/androidstudio>/bin/studio.sh
108
109 To clean the build:
110
111          $ ./build.sh clean
112
113 To install apks:
114
115          $ adb install -r ./app/build/outputs/apk/debug/dali-demo-debug.apk
116          $ adb install -r ./app/build/outputs/apk/release/dali-demo-release.apk
117
118 Manually granting permission for accessing Storage before running the demo
119          1. Long press the DALi demo app icon => App Info
120          2. Permissions => Storage => Enable
121
122 ## 4. Building for MS Windows
123
124 Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
125 vcpkg-script folder in the windows-dependencies repository.
126
127 - Download the windows-dependencies repository from DaliHub
128
129          $ git clone https://github.com/dalihub/windows-dependencies.git
130
131 - Read the windows-dependencies/vcpkg-script/Readme.md file for more instructions on how to build and install the third-party dependencies.
132
133 ### Build with the Visual Studio project
134   Read the windows-dependencies/README.md file for more instructions on how to build and run DALi for MS Windows.
135
136 ### Build with CMake
137
138   * Requirements
139     It's required the version 3.12.2 of CMake and a Git Bash Shell.
140
141   * Notes and troubleshoting:
142     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.
143     However, the CMake version installed with MS Visual Studio 2017 is a bit out of date and some VCPKG modules require a higher version.
144     This instructions have been tested with CMake 3.12.2 on a Git Bash shell.
145
146   * Define an environment variable to set the path to the VCPKG folder
147
148     $ export VCPKG_FOLDER=C:/Users/username/Workspace/VCPKG_TOOL
149
150   * Define an environment variable to set the path where DALi is going to be installed.
151
152     $ export DALI_ENV_FOLDER=C:/Users/username/Workspace/dali-env
153
154   * Execute the following commands to create the makefiles, build and install DALi.
155
156     $ 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
157     $ cmake --build . --target install
158
159   * Options:
160     - CMAKE_TOOLCHAIN_FILE  ---> Needed to find packages installed by VCPKG.
161     - ENABLE_PKG_CONFIGURE  ---> Whether to install pkg configure files (not currently working on MS Windows. CMake modules used instead).
162     - INTERNATIONALIZATION  ---> Whether to generate and install internazionalization '.po' Portable Object files.
163     - CMAKE_INSTALL_PREFIX  ---> Were DALi is installed.
164     - ENABLE_DEBUG          ---> Whether to build with debug enabled.
165
166   * 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.
167
168     i.e
169     $ setx DALI_ENV_FOLDER C:/Users/username/dali-env
170     $ setx DALI_IMAGE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/images/
171     $ setx DALI_SOUND_DIR $DALI_ENV_FOLDER/share/dali/toolkit/sounds/
172     $ setx DALI_STYLE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/styles/
173     $ setx DALI_STYLE_IMAGE_DIR $DALI_ENV_FOLDER/share/dali/toolkit/styles/images/
174     $ setx DALI_DATA_READ_ONLY_DIR $DALI_ENV_FOLDER/share/dali/
175
176 ## 5. Building for MacOS
177
178 It is assumed that the DALi environment has been set up & that DALi Core, Adaptor & Toolkit have been built accordingly.
179
180 To build the repository enter the 'build/tizen' folder:
181 ```zsh
182 % cd dali-demo/build/tizen
183 ```
184 Then run the following command to set up the build:
185 ```zsh
186 % cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DCMAKE_TOOLCHAIN_FILE=$VCPKG_FOLDER/scripts/buildsystems/vcpkg.cmake -DINTERNATIONALIZATION=OFF
187 ```
188 If a Debug build is required, then add `-DCMAKE_BUILD_TYPE=Debug`
189
190 To build, run:
191 ```zsh
192 % make install -j8
193 ```
194
195 # Creating an example
196 In the dali-demo/examples folder, add another folder. This will become the name of your example executable, so for example the "hello-world" folder generates a "hello-world.example" binary.
197 In this folder, you can add as many source code files as you need.
198
199 Usually, create a single class file containing a main function that instantiates an Application. Usually, the class is named after your example, followed by "Controller", e.g. hello-world.cpp contains a class called HelloWorldController.
200
201 There is a DemoHelper::CreateView method, which enables you to easiliy set up a title bar and buttons.
202
203 Add at least a key handler such that Escape or Back keys can be used to quit the application. Some apps that only present a single thing also add a touch handler that quits the application.
204
205 Add a launcher line to one of demo/dali-demo.cpp, examples-reel/dali-examples-reel.cpp or tests-reel/dali-tests-reel.cpp, depending on the nature of what you are demonstrating. Generally, dali-demo is for graphical showcase demos, dali-examples-reel is for reasonable examples that look ok, and dali-tests is for examples that are only for testing. This needs a language string defining for the title.
206
207 Add 2 lines to shared/dali-demo-strings.h for the title of your application, please keep in alphabetic ordering. Add english strings and translations to each of the language files in resources/po.
208
209 To ensure your application can run on a Tizen device through the launcher, add an entry to com.samsung.dali-demo.xml, ensuring that only tabs are used for XML indent.
210
211
212
213