4 Files used to build an application, or binding, project with the
5 AGL Application Framework.
7 To build your AGL project using these templates, you have to install
8 them within your project and adjust compilation option in `config.cmake`.
9 For technical reasons, you also have to specify **cmake** target in
10 sub CMakeLists.txt installed. Make a globbing search to find source files
11 isn't recommended now to handle project build especially in a multiuser
12 project because CMake will not be aware of new or removed source files.
14 You'll find simple usage example for different kind of target under the `examples` folder.
15 More advanced usage can be saw with the [CAN_signaling binding](https://github.com/iotbzh/CAN_signaling)
16 which mix external libraries, binding, and html5 hybrid demo application.
18 Typical project architecture
19 -----------------------------
21 A typical project architecture would be :
24 * \<root-path\>/<libs>
25 * \<root-path\>/packaging
26 * \<root-path\>/packaging/wgt
27 * \<root-path\>/packaging/wgt/etc
28 * \<root-path\>/\<target\>/
30 | # | Parent | Description | Files |
31 | - | -------| ----------- | ----- |
32 | \<root-path\> | - | Path to your project | Hold master CMakeLists.txt and general files of your projects. |
33 | \<libs\> | \<root-path\> | External dependencies libraries. This isn't to be used to include header file but build and link statically specifics libraries. | Library sources files. Can be a decompressed library archive file or project fork. |
34 | \<target\> | \<root-path\> | A sub component between: tool, binding, html5, html5-hybrid type. | ----- |
35 | packaging | \<root-path\> | Contains folder by package type (rpms, deb, wgt...) | Directory for each packaging type. |
36 | wgt | packaging | Files used to build project widget that can be installed on an AGL target. | config.xml.in, icon.png.in files. |
37 | etc | wgt | Configuration files for your project. This will be installed in the application root directory under etc/ folder once installed by Application Framework. | specific project configuration files |
42 Once installed, use them by customize depending on your project with file
43 `\<root-path\>/etc/config.cmake`.
45 Specify manually your targets, you should look at samples provided in this
46 repository to make yours. Then when you are ready to build, using `AGLbuild`
47 that will wrap CMake build command:
53 Or with the classic way :
56 mkdir -p build && cd build
60 ### Create a CMake target
62 For each target part of your project, you need to use ***PROJECT_TARGET_ADD***
63 to include this target to your project, using it make available the cmake
64 variable ***TARGET_NAME*** until the next ***PROJECT_TARGET_ADD*** is invoked
65 with a new target name. Be aware that ***populate_widget*** macro will also use
66 ***PROJECT_TARGET_ADD*** so ***TARGET_NAME*** will change after using
67 ***populate_widget*** macro.
69 So, typical usage defining a target is:
72 PROJECT_TARGET_ADD(SuperExampleName) --> Adding target to your project
74 add_executable/add_library(${TARGET_NAME}.... --> defining your target sources
76 SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES.... --> fit target properties for macros usage
78 INSTALL(TARGETS ${TARGET_NAME}....
80 populate_widget() --> add target to widget tree depending upon target properties
83 ### Build a widget using provided macros
85 To leverage all macros features, you have to specify ***properties*** on your
86 targets. Some macros will not works without specifying which is the target type.
87 As the type is not always specified for some custom target, like an ***HTML5***
88 application, macros make the difference using ***LABELS*** property.
91 SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
97 If your target output is not named as the ***TARGET_NAME***, you need to specify
98 ***OUTPUT_NAME*** property that will be used by the ***populate_widget*** macro.
100 Use the ***populate_widget*** macro as latest statement of your target
101 definition. Then at the end of your project definition you should use the macro
102 ***build_widget*** that make an archive from the populated widget tree using the
103 `wgtpkg-pack` Application Framework tools.
108 ### PROJECT_TARGET_ADD
110 Typical usage would be to add the target to your project using macro
111 `PROJECT_TARGET_ADD` with the name of your target as parameter. Example:
114 PROJECT_TARGET_ADD(low-can-demo)
117 This will make available the variable `${TARGET_NAME}` set with the specificied
122 This macro will search in all subfolder any `CMakeLists.txt` file. If found then
123 it will be added to your project. This could be use in an hybrid application by
124 example where the binding lay in a sub directory.
134 Macro use to populate widget tree. To make this works you have to specify some properties to your target :
136 - LABELS : specify *BINDING*, *HTDOCS*, *EXECUTABLE*, *DATA*
137 - PREFIX : must be empty **""** when target is a *BINDING* else default prefix *lib* will be applied
138 - OUTPUT_NAME : Name of the output file generated, useful when generated file name is different from `${TARGET_NAME}`
140 Always specify `populate_widget()` macro as the last statement, especially if
141 you use ${TARGET_NAME} variable. Else variable will be set at wrong value with
142 the **populate_** target name.
152 Use at project level, to gather all populated targets in the widget tree plus
153 widget specifics files into a **WGT** archive. Generated under your `build`