Simplified doc-site generation
[AGL/documentation.git] / docs / 3_Developer_Guides / 3_Using_the_CMAKE_Applications_Module / 3_Using_CMake_Templates.md
1 ---
2 edit_link: ''
3 title: Using CMake Templates
4 origin_url: >-
5   https://git.automotivelinux.org/src/cmake-apps-module/plain/docs/dev_guide/using-cmake.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/cmake-apps-module-guides-devguides-book.yml -->
9
10 # Using CMake Templates
11
12 You can use CMake templates in a cross-compilation environment
13 or from BitBake recipes.
14
15 ## Using CMake Templates in a Cross-Compilation Environment
16
17 Beginning with the `Grumpy Guppy`, version 7, the CMakeAfbTemplates CMake module
18 is installed by default in the SDKs supplied by AGL.
19 Consequently, you do not need to take steps to install the modules.
20
21 Following are links to the latest SDKs on the AGL master branch:
22
23 * [dra7xx-evm](https://download.automotivelinux.org/AGL/snapshots/master/latest/dra7xx-evm/deploy/sdk/)
24 * [intel-corei7-64](https://download.automotivelinux.org/AGL/snapshots/master/latest/intel-corei7-64/deploy/sdk/)
25 * [m3ulcb-nogfx](https://download.automotivelinux.org/AGL/snapshots/master/latest/m3ulcb-nogfx/deploy/sdk/)
26 * [qemux86-64](https://download.automotivelinux.org/AGL/snapshots/master/latest/qemux86-64/deploy/sdk/)
27 * [raspberrypi3](https://download.automotivelinux.org/AGL/snapshots/master/latest/raspberrypi3/deploy/sdk/)
28
29 ## Using CMake Templates from BitBake Recipes
30
31 If you have developed an application and you want to include it in an AGL image,
32 you must add a BitBake recipe in one of the following layers:
33
34 * [meta-agl](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl):
35  meta-agl layer (core AGL)
36 * [meta-agl-cluster-demo](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-cluster-demo):
37  cluster demo specific recipes and configuration
38 * [meta-agl-demo](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo):
39  meta-agl-demo layer (demo/staging/"one-shot")
40 * [meta-agl-devel](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-devel):
41  meta-agl-devel (Development and Community BSPs)
42 * [meta-agl-extra](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-extra):
43  meta-agl-extra (additional/optional components for AGL)
44
45 Once you have the recipe in place, edit it to include the following
46 line to cause the `aglwgt` class to be inherited:
47
48 ```bb
49 inherit aglwgt
50 ```
51
52 Following is an example that uses the HVAC application recipe (i.e. `hvac.bb`), which
53 builds the HVAC application:
54
55 ```bb
56 SUMMARY     = "HVAC Service Binding"
57 DESCRIPTION = "AGL HVAC Service Binding"
58 HOMEPAGE    = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/agl-service-hvac"
59 SECTION     = "apps"
60
61 LICENSE     = "Apache-2.0"
62 LIC_FILES_CHKSUM = "file://LICENSE;md5=ae6497158920d9524cf208c09cc4c984"
63
64 SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/apps/agl-service-hvac;protocol=https;branch=${AGL_BRANCH}"
65 SRCREV  = "${AGL_APP_REVISION}"
66
67 PV = "1.0+git${SRCPV}"
68 S  = "${WORKDIR}/git"
69
70 DEPENDS = "json-c"
71 RDEPENDS_${PN} += "agl-service-identity-agent"
72
73 inherit cmake aglwgt pkgconfig
74 ```
75
76 The following links provide more examples of recipes that use the
77 CMake templates:
78
79 * [agl-service-helloworld](https://gerrit.automotivelinux.org/gerrit/admin/repos/apps/agl-service-helloworld)
80 * [agl-service-audio-4a](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/agl-service-audio-4a)
81 * [agl-service-unicens](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/agl-service-unicens)
82 * [4a-hal-unicens](https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/4a-hal-unicens)