5 To use these templates files on your project just install the reference files using
6 **git submodule** then use `config.cmake` file to configure your project specificities :
9 git submodule add https://gerrit.automotivelinux.org/gerrit/p/apps/app-templates.git conf.d/app-templates
11 cp conf.d/app-templates/samples.d/config.cmake.sample conf.d/cmake/config.cmake
14 Edit the copied config.cmake file to fit your needs.
16 Now, create your top CMakeLists.txt file which include `config.cmake` file.
18 An example is available in **app-templates** submodule that you can copy and
22 cp conf.d/app-templates/samples.d/CMakeLists.txt.sample CMakeLists.txt
25 ## Create your CMake targets
27 For each target part of your project, you need to use ***PROJECT_TARGET_ADD***
28 to include this target to your project.
30 Using it, make available the cmake variable ***TARGET_NAME*** until the next
31 ***PROJECT_TARGET_ADD*** is invoked with a new target name.
33 So, typical usage defining a target is:
36 PROJECT_TARGET_ADD(SuperExampleName) --> Adding target to your project
38 add_executable/add_library(${TARGET_NAME}.... --> defining your target sources
40 SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES.... --> fit target properties
43 INSTALL(TARGETS ${TARGET_NAME}....
48 You should set properties on your targets that will be used to package your
49 apps in a widget file that could be installed on an AGL system.
51 Specify what is the type of your targets that you want to be included in the
52 widget package with the property **LABELS**:
56 - **BINDING**: Shared library that be loaded by the AGL Application Framework
57 - **BINDINGV2**: Shared library that be loaded by the AGL Application Framework
58 This has to be accompagnied with a JSON file named like the
59 *${OUTPUT_NAME}-apidef* of the target that describe the API with OpenAPI
60 syntax (e.g: *mybinding-apidef*).
61 Or Alternatively, you can choose the name, without the extension, using macro
62 **set_openapi_filename**. If you use C++, you have to set
63 **PROJECT_LANGUAGES** with *CXX*.
64 - **PLUGIN**: Shared library meant to be used as a binding plugin. Binding
65 would load it as a plugin to extend its functionnalities. It should be named
66 with a special extension that you choose with SUFFIX cmake target property or
67 it'd be **.ctlso** by default.
68 - **HTDOCS**: Root directory of a web app. This target has to build its
69 directory and puts its files in the ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
70 - **DATA**: Resources used by your application. This target has to build its
71 directory and puts its files in the ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
72 - **EXECUTABLE**: Entry point of your application executed by the AGL
74 - **LIBRARY**: An external 3rd party library bundled with the binding for its
75 own purpose because platform doesn't provide it.
77 > **TIP** you should use the prefix _afb-_ with your **BINDING* targets which
78 > stand for **Application Framework Binding**.
81 SET_TARGET_PROPERTIES(${TARGET_NAME}
84 OUTPUT_NAME "file_output_name")
87 > **NOTE**: You doesn't need to specify an **INSTALL** command for these
88 > targets. This is already handle by template and will be installed in the
89 > following path : **${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}**