Update doc & use gitbook to enhance doc generation
[staging/xdg-launcher.git] / docs / dev_guide / 1_Quickstart.md
1
2 # Quickstart
3
4 ## Initialization
5
6 To use these templates files on your project just install the reference files using
7 **git submodule** then use `config.cmake` file to configure your project specificities :
8
9 ```bash
10 git submodule add https://gerrit.automotivelinux.org/gerrit/apps/app-templatesconf.d/app-templates conf.d/app-templates
11 mkdir conf.d/cmake
12 cp conf.d/app-templates/cmake/config.cmake.sample conf.d/cmake/config.cmake
13 ```
14
15 Edit the copied config.cmake file to fit your needs.
16
17 Now, create your top CMakeLists.txt file which include `config.cmake` file.
18
19 An example is available in **app-templates** submodule that you can copy and
20 use:
21
22 ```bash
23 cp conf.d/app-templates/cmake/CMakeLists.txt CMakeLists.txt
24 ```
25
26 ## Create your CMake targets
27
28 For each target part of your project, you need to use ***PROJECT_TARGET_ADD***
29 to include this target to your project.
30
31 Using it, make available the cmake variable ***TARGET_NAME*** until the next
32 ***PROJECT_TARGET_ADD*** is invoked with a new target name. 
33
34 So, typical usage defining a target is:
35
36 ```cmake
37 PROJECT_TARGET_ADD(SuperExampleName) --> Adding target to your project
38
39 add_executable/add_library(${TARGET_NAME}.... --> defining your target sources
40
41 SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES.... --> fit target properties
42 for macros usage
43
44 INSTALL(TARGETS ${TARGET_NAME}....
45 ```
46
47 ## Targets PROPERTIES
48
49 You should set properties on your targets that will be used to package your
50 apps in a widget file that could be installed on an AGL system.
51
52 Specify what is the type of your targets that you want to be included in the
53 widget package with the property **LABELS**:
54
55 Choose between:
56
57 - **BINDING**: Shared library that be loaded by the AGL Application Framework
58 - **HTDOCS**: Root directory of a web app
59 - **DATA**: Resources used by your application
60 - **EXECUTABLE**: Entry point of your application executed by the AGL
61  Application Framework
62
63 ```cmake
64 SET_TARGET_PROPERTIES(${TARGET_NAME}
65         PREFIX "afb-"
66         LABELS "BINDING"
67         OUTPUT_NAME "file_output_name")
68 ```
69
70 > **TIP** you should use the prefix _afb-_ with your **BINDING* targets which
71 > stand for **Application Framework Binding**.