From f564d467a7ea0f79c1fca5c98079a0e2a9397ac1 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 3 Jan 2019 17:43:32 +0100 Subject: New installation instructions New installation instructions for the appcontroller library And remove the the submodule occurences. Bug-AGL: SPEC-1689 Change-Id: Idaa6f9191ce521b551ddd7e7d4aa4430f0aeb399 Signed-off-by: Romain Forlot --- CMakeLists.txt | 3 +-- ctl-lib/CMakeLists.txt | 2 +- docs/Usage.md | 52 +++++++++++++++++++++++++++++++++++++----------- docs/controller.md | 36 ++++++++++++++++++++++++++++++--- docs/controllerConfig.md | 4 ++-- 5 files changed, 77 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9804022..fd7f3cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ # limitations under the License. ########################################################################### -# This component should be included as a submodule and wont compile as standalone -CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) include(GNUInstallDirs) add_subdirectory("ctl-lib") diff --git a/ctl-lib/CMakeLists.txt b/ctl-lib/CMakeLists.txt index e2fd683..bfe546c 100644 --- a/ctl-lib/CMakeLists.txt +++ b/ctl-lib/CMakeLists.txt @@ -18,7 +18,7 @@ set(TARGET_NAME "ctl-utilities") set(PROJECT_PRETTY_NAME "Controller") set(PROJECT_DESCRIPTION "controller") -set(PROJECT_URL "https://gerrit.automotivelinux.org:29418/apps/app-controller-submodule") +set(PROJECT_URL "https://gerrit.automotivelinux.org:29418/src/libappcontroller") set(PROJECT_AUTHOR "Ar Foll, Fulup") set(PROJECT_AUTHOR_MAIL "fulup@iot.bzh") set(PROJECT_LICENSE "APL2.0") diff --git a/docs/Usage.md b/docs/Usage.md index 65f1ce9..a85d9f1 100644 --- a/docs/Usage.md +++ b/docs/Usage.md @@ -1,22 +1,50 @@ # Usage -## 1) Add app-controller-submodule as a submodule to include in your project +## (Optionnal) Remove the git submodule version + +If you already use the controller component but using the submodule version then +you have to get rid of it to be sure to link and use the library version. To do +so, you have to do the following: + +* deinitialize the submodule using `git` ```bash -git submodule add https://gerrit.automotivelinux.org/gerrit/apps/app-controller-submodule +# This example assumes that the git submodule is named app-afb-helpers-submodule +# and is located at your root project repository. +git submodule deinit app-afb-helpers-submodule ``` -## 2) Add app-controller-submodule as a static library to your binding +* remove the submodule relatives lines from the `.gitmodules` file -```cmake - # Library dependencies (include updates automatically) - TARGET_LINK_LIBRARIES(${TARGET_NAME} - ctl-utilities - ... other dependencies .... +```bash +vim .gitmodules +``` + +* remove the `ctl-utilities` target link from any CMake target you specified. + Those lines looks like: + +```bash +TARGET_LINK_LIBRARIES(${TARGET_NAME} + ctl-utilities # REMOVE THIS LINE + ${link_libraries} ) ``` -## 3) Declare your controller config section in your binding +## Add libappcontroller as a static library to your binding + +In your `config.cmake` file, add a dependency to the controller library, i.e: + +```cmake +set(PKG_REQUIRED_LIST + json-c + afb-daemon + ctl-utilities --> this is the controller library dependency name +) +``` + +Or you can also use the `FIND_PACKAGE` CMake command to add it. + +## Declare your controller config section in your binding ```C // CtlSectionT syntax: @@ -32,7 +60,7 @@ static CtlSectionT ctlSections[]= { ``` -## 4) Do the controller config parsing at binding pre-init +## Do the controller config parsing at binding pre-init ```C // check if config file exist @@ -46,8 +74,8 @@ static CtlSectionT ctlSections[]= { if (!ctlConfig) return -1; ``` -## 5) Execute the controller config during binding init +## Execute the controller config during binding init ```C int err = CtlConfigExec (ctlConfig); -``` \ No newline at end of file +``` diff --git a/docs/controller.md b/docs/controller.md index 4012455..47a9cfd 100644 --- a/docs/controller.md +++ b/docs/controller.md @@ -16,13 +16,43 @@ ## Installation -* Controller can easily be included as a git submodule in any AGL service or application binder. -* Dependencies: the only dependencies are AGL application framework (https://gerrit.automotivelinux.org/gerrit/p/src/app-framework-binder.git) and app-afb-helpers-submodule (https://gerrit.automotivelinux.org/gerrit/p/apps/app-afb-helpers-submodule.git). +* Controller can easily be included as a separate libray in any AGL service or application binder. +* Dependencies: the only dependencies are [AGL application framework](https://gerrit.automotivelinux.org/gerrit/p/src/app-framework-binder.git) + and [libafb-helpers](https://gerrit.automotivelinux.org/gerrit/p/src/libafb-helpers.git). * Controller relies on Lua-5.3, when not needed Lua might be removed at compilation time. +The controller library is integrated by default in the AGL SDK since GG (>=7) +and is also available as a package for the AGL supported linux distributions. + +To install the native package please refer to [this chapter](../host-configuration/docs/1_Prerequisites.md) +in the AGL documentation to install the AGL repository for your distribution. + +Then use your package manager to install the library. + +### OpenSuse + +```bash +sudo zypper ref +sudo zypper install agl-libappcontroller-devel +``` + +### Fedora + +```bash +sudo dnf ref +sudo dnf install agl-libappcontroller-devel +``` + +### Ubuntu/Debian + +```bash +sudo apt-get update +sudo apt-get install agl-libappcontroller-dev +``` + ## Monitoring * The default test HTML page expect the monitoring HTML page to be accessible under /monitoring with the --monitoring option. * The monitoring HTML pages are installed with the app framework binder in a subdirectory called monitoring. * You can add other HTML pages with the alias options e.g. afb-daemon --port=1234 --monitoring --alias=/path1/to/htmlpages:/path2/to/htmlpages --ldpaths=. --workdir=. --roothttp=../htdocs -* The monitoring is accessible at http://localhost:1234/monitoring. \ No newline at end of file +* The monitoring is accessible at http://localhost:1234/monitoring. diff --git a/docs/controllerConfig.md b/docs/controllerConfig.md index 6a21fd2..f87e53e 100644 --- a/docs/controllerConfig.md +++ b/docs/controllerConfig.md @@ -43,7 +43,7 @@ Each block in the configuration file is defined with * **event**: a collection of actions meant to be executed when receiving a given signal * **personnal sections**: personnal section -Callbacks to parse sections are documented in [Declare your controller config section in your binding](<#3_Declare_your_controller_config_section_in_your_binding>) section. You can use the callback defined in controller or define your own callback. +Callbacks to parse sections are documented in [Declare your controller config section in your binding](./Usage.html#declare-your-controller-config-section-in-your-binding) section. You can use the callback defined in controller or define your own callback. ## Metadata @@ -238,4 +238,4 @@ afb-daemon --name=yourname --port=1234 --workdir=. --roothttp=./htdocs --tracere Afb-Daemon only loads controller bindings without searching for the other binding. In this case, the controller binding will search for a configuration file name '(prefix-)bindermiddlename*.json'. This model can be used to implement for testing -purpose or simply to act as the glue between a UI and other binder/services. \ No newline at end of file +purpose or simply to act as the glue between a UI and other binder/services. -- cgit 1.2.3-korg