62de818ec003812966dc66dae5c69cd842b79165
[AGL/documentation.git] / docs / 3_Developer_Guides / 6_AFB_Helper_Guide / 3.7.1_Usage.md
1 ---
2 edit_link: ''
3 title: Usage
4 origin_url: >-
5   https://git.automotivelinux.org/src/libafb-helpers/plain/docs/usage.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/afb-helpers-function-references-afb-helpers-book.yml -->
9
10 # Usage
11
12 ## Installation
13
14 The afb-helpers library is integrated by default in the AGL SDK since the Guppy
15 version (>=7) and is also available as a package for the AGL supported linux
16 distributions.
17
18 You could find the SDK build from Yocto which embed the afb-helpers library
19 here:
20
21 * For the [releases](https://download.automotivelinux.org/AGL/release/) >= Guppy
22  in the latest machine's deploy directory. (e.g for Guppy in
23  `latest/<yourmachine>/deploy/sdk` directory)
24 * For the [master](https://download.automotivelinux.org/AGL/snapshots/master/)
25  development branch, in the latest machine's deploy directory. (e.g in
26  `latest/<yourmachine>/deploy/sdk` directory)
27
28 To install the native package please refer to [this chapter](../1-verify-build-host.html)
29 in the AGL documentation to install the AGL repository for your distribution.
30
31 Then use your package manager to install the library.
32
33 ### OpenSuse
34
35 ```bash
36 sudo zypper ref
37 sudo zypper install agl-libafb-helpers-devel
38 ```
39
40 ### Fedora
41
42 ```bash
43 sudo dnf ref
44 sudo dnf install agl-libafb-helpers-devel
45 ```
46
47 ### Ubuntu/Debian
48
49 ```bash
50 sudo apt-get update
51 sudo apt-get install agl-libafb-helpers-dev
52 ```
53
54 ## (Optional) Remove the git submodule version
55
56 If you already use the afb-helpers component but using the submodule version
57 then you have to get rid of it to be sure to link and use the library version.
58 To do so, you have to do the following:
59
60 * Deinitialize the submodule using `git`
61
62 ```bash
63 # This example assumes that the git submodule is named app-afb-helpers-submodule
64 # and is located at your root project repository.
65 git submodule deinit app-afb-helpers-submodule
66 ```
67
68 * Remove the submodule relatives lines from the `.gitmodules` file
69
70 ```bash
71 vim .gitmodules
72 ```
73
74 * Remove the `afb-helpers` target link from any CMake target you specified.
75  Those lines look like:
76
77 ```bash
78 TARGET_LINK_LIBRARIES(${TARGET_NAME}
79     afb-helpers # REMOVE THIS LINE
80     ${link_libraries}
81     )
82 ```
83
84 ## Add the libafb-helpers as a static library to your binding
85
86 In your `config.cmake` file, add a dependency to the controller library, i.e:
87
88 ```cmake
89 set(PKG_REQUIRED_LIST
90         json-c
91         afb-daemon
92         afb-helpers --> this is the afb-helpers library dependency name.
93 )
94 ```
95
96 Or you can also use the [FIND_PACKAGE](https://cmake.org/cmake/help/v3.6/command/find_package.html?highlight=find_package)
97 CMake command to add it if you don't use the [cmake-apps-module](../cmakeafbtemplates/dev_guide/cmake-overview.html)