19251207c2bef1ab5e6f7067d0c180b84c3de65a
[platform/core/uifw/dali-core.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          * [Creating a DALi Environment](#creating-a-dali-environment)
9          * [Building the Repository](#building-the-repository)
10          * [Building and executing test cases](#building-and-executing-test-cases)
11       * [2. GBS Builds](#2-gbs-builds)
12          * [NON-SMACK Targets](#non-smack-targets)
13          * [SMACK enabled Targets](#smack-enabled-targets)
14          * [DEBUG Builds](#debug-builds)
15       * [3. Building for MS Windows](#3-building-for-ms-windows)
16          * Build with the Visual Studio project.
17          * Build with CMake.
18       * [4. Building for MacOS](#4-building-for-macos)
19          * [Get dependencies](#get-dependencies)
20          * [Set a DALi Environment](#set-a-dali-environment)
21          * [Build the repository](#build-the-repository)
22
23 # Build Instructions
24
25 ## 1. Building for Ubuntu desktop
26
27 ### Minimum Requirements
28
29  - Ubuntu 16.04 or later
30  - GCC version 9
31  - Cmake version 3.8.2 or later
32
33 DALi requires a compiler supporting C++17 features.
34
35 ### Creating a DALi Environment
36
37 To build for desktop first ensure ALL sources are selected:
38  - Go to Ubuntu Settings and then to "Software & Updates"
39  - In the "Ubuntu Software" tab, ensure ALL software sources are ticked
40
41 (This is required because we install some community-maintained free & open-source software)
42
43 Then you can create a dali-env folder in your home folder with:
44
45          $ dali-core/build/scripts/dali_env -c
46
47 This will also download any dependencies that the dali repositories require.
48
49 You can save the environment variables to a file:
50
51          $ dali-env/opt/bin/dali_env -s > setenv
52
53 This process only needs to be done once.
54
55 Next source these variables:
56
57          $ . setenv
58
59 You will have to source these variables every time you open up a new terminal (or you can add to .bashrc if you prefer).
60
61
62 ### Building the Repository
63
64 To build the repository enter the 'build/tizen' folder:
65
66          $ cd dali-core/build/tizen
67
68 Then run the following command to set up the build:
69
70          $ cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX .
71
72 If a Debug build is required, then add -DCMAKE_BUILD_TYPE=Debug
73
74 To build run:
75
76          $ make install -j8
77
78 ### Building and executing test cases
79
80 See the README.md in dali-core/automated-tests.
81
82 ## 2. GBS Builds
83
84 ### NON-SMACK Targets
85
86          $ gbs build -A [TARGET_ARCH]
87
88 ### SMACK enabled Targets
89
90          $ gbs build -A [TARGET_ARCH] --define "%enable_dali_smack_rules 1"
91
92 ### DEBUG Builds
93
94          $ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
95
96 ## 3. Building for MS Windows
97
98 Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
99 vcpkg-script folder in the windows-dependencies repository.
100
101 - Download the windows-dependencies repository from DaliHub
102
103          $ git clone https://github.com/dalihub/windows-dependencies.git
104
105 - Read the windows-dependencies/vcpkg-script/Readme.md file for more instructions on how to build and install the third-party dependencies.
106
107 ### Build with the Visual Studio project
108   Read the windows-dependencies/README.md file for more instructions on how to build and run DALi for MS Windows.
109
110 ### Build with CMake
111
112   * Requirements
113     It's required the version 3.12.2 of CMake and a Git Bash Shell.
114
115   * Notes and troubleshoting:
116     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.
117     However, the CMake version installed with MS Visual Studio 2017 is a bit out of date and some VCPKG modules require a higher version.
118     This instructions have been tested with CMake 3.12.2 on a Git Bash shell.
119
120   * Define an environment variable to set the path to the VCPKG folder
121
122     $ export VCPKG_FOLDER=C:/Users/username/Workspace/VCPKG_TOOL
123
124   * Define an environment variable to set the path where DALi is going to be installed.
125
126     $ export DALI_ENV_FOLDER=C:/Users/username/Workspace/dali-env
127
128   * Execute the following commands to create the makefiles, build and install DALi.
129
130     $ cmake -g Ninja . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_FOLDER/vcpkg/scripts/buildsystems/vcpkg.cmake -DENABLE_PKG_CONFIGURE=OFF -DENABLE_LINK_TEST=OFF -DCMAKE_INSTALL_PREFIX=$DALI_ENV_FOLDER -DINSTALL_CMAKE_MODULES=ON
131     $ cmake --build . --target install
132
133
134   * Options:
135     - CMAKE_TOOLCHAIN_FILE  ---> Needed to find packages installed by VCPKG.
136     - ENABLE_PKG_CONFIGURE  ---> Whether to install pkg configure files (not currently working on MS Windows. CMake modules used instead).
137     - ENABLE_LINK_TEST      ---> Whether to enable the link test (not currently working on MS Windows).
138     - CMAKE_INSTALL_PREFIX  ---> Were DALi is installed.
139     - INSTALL_CMAKE_MODULES ---> Whether to install the CMake modules (Used by the CMake command find_package() to find previously installed libraries).
140     - ENABLE_DEBUG          ---> Whether to build with debug enabled.
141
142 ## 4. Building for MacOS
143
144 ### Get dependencies
145
146 Dependencies are obtained through [vcpkg](https://github.com/Microsoft/vcpkg#quick-start-unix) and [homebrew](https://docs.brew.sh/Installation.html).
147 Follow each installation guide, to then be able to install the dependencies.
148
149 From `homebrew` install:
150  - `cairo`
151  - `cmake`
152  - `fontconfig`
153  - `pkg-config`
154 ```bash
155         $ brew install cairo cmake fontconfig pkg-config
156 ```
157 And through `vcpkg` install:
158  - `angle`
159  - `bzip2`
160  - `curl`
161  - `dirent`
162  - `egl-registry`
163  - `expat`
164  - `fribidi`
165  - `getopt`
166  - `gettext`
167  - `giflib`
168  - `glib`_¹_
169  - `harfbuzz`
170  - `libexif`
171  - `libffi`
172  - `libiconv`
173  - `libjpeg-turbo`
174  - `libpng`
175  - `libwebp`
176  - `opengl`
177  - `pcre`
178  - `pixman`
179  - `pthreads`
180  - `ragel`
181  - `tool-meson`
182  - `zlib`
183
184 From `vcpkg` folder, run:
185 ```bash
186         $ ./vcpkg install angle bzip2 curl dirent egl-registry expat fribidi getopt gettext giflib glib harfbuzz libexif libffi libiconv libjpeg-turbo libpng libwebp opengl pcre pixman pthreads ragel tool-meson zlib
187 ```
188
189 _¹_:  At this time, there's a reported bug with the latest MacOS and `vcpkg`'s
190 `glib`, if you got a problem compiling it try adding the following line to
191 `CMakeLists.txt` in the `glib` ports folder:
192 ```
193         set(ENV{SDKROOT} ${CMAKE_OSX_SYSROOT})
194 ```
195
196 ### Set a DALi Environment
197 Now you need to create a `dali-env` folder and then set some environment variables.
198 First of all:
199 - `VCPKG_FOLDER` should contain the absolute path to your `vcpkg` installation
200 - `DESKTOP_PREFIX` should contain the absolute path to `dali-env`
201 ```bash
202         $ export VCPKG_FOLDER="${HOME}/path/to/vcpkg"
203         $ export DESKTOP_PREFIX="${HOME}/path/to/dail-env"
204 ```
205 Acordingly to `VCPKG_FOLDER` and `DESKTOP_PREFIX` set:
206 ```bash
207         $ export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${VCPKG_FOLDER}/installed/x64-osx/lib"
208         $ export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${DESKTOP_PREFIX}/lib/"
209         $ export DALI_APPLICATION_PACKAGE="${DESKTOP_PREFIX}/share/com.samsung.dali-demo/res/"
210         $ export DALI_WINDOW_WIDTH="480"
211         $ export DALI_WINDOW_HEIGHT="800"
212 ```
213 If you are going to build `dali` libs with debug option you should also set:
214 ```bash
215         $ export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${VCPKG_FOLDER}/installed/x64-osx/debug/lib"
216         $ export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${DESKTOP_PREFIX}/lib/debug"
217 ```
218 Because we aren't installing at the default resource folder, if you install
219 `dali-toolkit` or `dali-demo` we should first set:
220 ```bash
221         $ export DALI_IMAGE_DIR="${DESKTOP_PREFIX}/share/dali/toolkit/images/"
222         $ export DALI_SOUND_DIR="${DESKTOP_PREFIX}/share/dali/toolkit/sounds/"
223         $ export DALI_STYLE_DIR="${DESKTOP_PREFIX}/share/dali/toolkit/styles/"
224         $ export DALI_STYLE_IMAGE_DIR="${DESKTOP_PREFIX}/share/dali/toolkit/styles/images/"
225         $ export DALI_DATA_READ_ONLY_DIR="${DESKTOP_PREFIX}/share/dali/"
226 ```
227 You will need these variables every time you open up a new terminal. So you may put the exports on a file, here `setenv`, to just source it:
228 ```bash
229         $ source setenv
230 ```
231 ### Build the repository
232
233 To build the repository enter the 'build/tizen' folder:
234 ```bash
235          $ cd dali-core/build/tizen
236 ```
237 Then run the following command to set up the build:
238 ```bash
239          $ cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DCMAKE_TOOLCHAIN_FILE=$VCPKG_FOLDER/scripts/buildsystems/vcpkg.cmake -DINSTALL_CMAKE_MODULES=ON
240 ```
241 If a Debug build is required, then add `-DCMAKE_BUILD_TYPE=Debug -DENABLE_DEBUG=ON`
242
243 To build run:
244 ```bash
245          $ make install -j8
246 ```