# Building Own Application for R-Car D3 Custom Integrity

#### <a class="anchor" id="bkmrk-"></a>Generate Makefiles with CMake

For general information about CGI Studio Build System and CMake properties available to configure Candera applications refer to <span style="color: rgb(230, 126, 35);">[CGI Studio Build System](https://doc316en.candera.eu/books/build-system-setup)</span>.

To configure and generate makefiles for compiling the Player, follow below steps:

<div class="contents" id="bkmrk-point-cmake-to-sourc"><div class="contents"><div class="textblock">1. Point CMake to source directory 
    - Folder containing top-level "CMakeLists.txt", e.g. \\cmake\\Candera\\Player
2. Point CMake to binary directory 
    - May not exist, create folder with CMake if necessary
    - Root directory for generated makefiles / solutions
    - Root directory for build artifacts
3. Configure 
    - Specify MinGW Makefiles as generator for the project
    - Specify tool-chain file for cross-compiling
4. Select the toolchain-file from the delivery (adapt for your toolchain installation and application specific needs) 
    - \\cgi\_studio\_devices\\src\\RCarD3\\ToolchainFiles\\MULTI-toolchain-RCarD3\_custom.txt
5. Adapt the CMake settings if necessary, e.g.: 
    - CMAKE\_BUILD\_TYPE-&gt; Debug or Release
    - Press Configure
6. Press Generate

</div></div></div>#### <a class="anchor" id="bkmrk--0"></a>Building Application

Via the CMake variable CGIDEVICE\_BSP\_CFG\_NAME, it is possible to choose the BSP library configuration. By default this is set to release (rel), however, it is also possible to choose debug (dbg), checked (chk) resp. coverage (cov).

On the custom board display id 1 was used for all our. Please make sure to have set display id to 1 in Scene Composer. If you want to change this, this also has to be changed for our samples in CMake via the variable CGIDEVICE\_DISPLAY\_ID.

For this board it is intended to use a shader compiler. By default, the 2D shaders are pre-compiled and already linked to the sample. This is done via the CMake variables CANDERA\_EXTERNAL\_SHADER\_BUILDER\_HEADER\_INCLUDE, CANDERA\_EXTERNAL\_SHADER\_BUILDER\_HEADER\_PATH and CANDERA\_EXTERNAL\_SHADER\_BUILDER\_SOURCE\_PATH. If you want to change this, first uncheck RCARD3\_EXTERNAL\_SHADER\_BUILDER\_USAGE\_DEFAULT, then it is possible to e.g. delete the value of the above mentioned variables in order to not use pre-compiled shaders. For all the other shaders, the compilation is done via plugin in CGI Studio. Please make sure to have the RCarD3 Shader Compiler Plugin (can be found under File/Preferences) set to “Binary”. Additionally, set the absolute path to the shader compiler \*.exe. If the RCarD3 Shader Compiler Plugin is set to “Text”, the shader compiler is not used at all.

It is possible to have the asset stored in the eMMC resp. QSPI flash instead of having it linked to the monolith. Use the writing tool to store the asset into the flash. Make also sure to copy the flash wrapper layer to "cgi\_studio\_3psw\\internal\\Devices\\RCarD3\\storage\_driver\_wrapper\_layer" where it is expected to be when using eMMC resp. QSPI as asset repository. In CMake it is required to change the variable RCARD3\_ASSET\_LOCATION from “Monolith” to “eMMC” resp. “QSPI”. Additionally, it is necessary to verify the path to the Flash tool (RCARD3\_FLASH\_TOOL\_PATH) in order to link the correct libraries.