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*). Or you can choose the name, without the
61 extension, by setting the *CACHE* cmake variable *OPENAPI_DEF* (***CAUTION***:
62 setting a CACHE variable is needed, or set a normal variable with the
63 *PARENT_SCOPE* option to make it visible for the parent scope where the target
64 is defined) JSON file will be used to generate header file using `afb-genskel`
66 - **PLUGIN**: Shared library meant to be used as a binding plugin. Binding
67 would load it as a plugin to extend its functionnalities. It should be named
68 with a special extension that you choose with SUFFIX cmake target property or
69 it'd be **.ctlso** by default.
70 - **HTDOCS**: Root directory of a web app. This target has to build its
71 directory and puts its files in the ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
72 - **DATA**: Resources used by your application. This target has to build its
73 directory and puts its files in the ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
74 - **EXECUTABLE**: Entry point of your application executed by the AGL
76 - **LIBRARY**: An external 3rd party library bundled with the binding for its
77 own purpose because platform doesn't provide it.
79 > **TIP** you should use the prefix _afb-_ with your **BINDING* targets which
80 > stand for **Application Framework Binding**.
83 SET_TARGET_PROPERTIES(${TARGET_NAME}
86 OUTPUT_NAME "file_output_name")
89 > **NOTE**: You doesn't need to specify an **INSTALL** command for these
90 > targets. This is already handle by template and will be installed in the
91 > following path : **${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}**