summaryrefslogtreecommitdiffstats
path: root/templates/service
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-18 17:49:35 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-18 17:49:35 +0200
commit162d50a33b8c72d09bd3dc82967c36d559f8278f (patch)
tree337b11ad4c7a9bfa9de46cde0a84a08411043845 /templates/service
parent6993026755563379e964966ee7fc73923a21828d (diff)
Git repo can be used as submodules
Clean templates files as they are useless for usage in submodules into a project. Change-Id: I24c71b64ab2b3a958494f3f190c014227a1da576 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'templates/service')
-rw-r--r--templates/service/.gitignore4
-rwxr-xr-xtemplates/service/AGLbuild47
-rw-r--r--templates/service/CMakeLists.txt33
-rw-r--r--templates/service/README.md66
-rw-r--r--templates/service/binding/CMakeLists.txt69
-rw-r--r--templates/service/binding/xxx-service-cb.c241
-rw-r--r--templates/service/binding/xxx-service-hat.c58
-rw-r--r--templates/service/binding/xxx-service-hat.h78
-rw-r--r--templates/service/etc/config.cmake109
-rw-r--r--templates/service/etc/export.map1
-rw-r--r--templates/service/etc/macros.cmake263
-rw-r--r--templates/service/packaging/wgt/config.xml.in11
-rw-r--r--templates/service/packaging/wgt/icon.png.inbin13273 -> 0 bytes
13 files changed, 0 insertions, 980 deletions
diff --git a/templates/service/.gitignore b/templates/service/.gitignore
deleted file mode 100644
index eef9ed9..0000000
--- a/templates/service/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-build
-config.xml
-*.so
-*.wgt
diff --git a/templates/service/AGLbuild b/templates/service/AGLbuild
deleted file mode 100755
index 5f8f595..0000000
--- a/templates/service/AGLbuild
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/make -f
-# Copyright (C) 2015, 2016 "IoT.bzh"
-# Author "Romain Forlot" <romain.forlot@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-BUILD_DIR := build
-PACKAGING_DIR := packaging/wgt
-
-VPATH = etc:$(PACKAGING_DIR):$(PACKAGING_DIR)/etc:$(BUILD_DIR)
-
-.PHONY: all clean mrproper package
-
-all: build
-
-clean:
- @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean
-
-mrproper:
- @rm -rf ${BUILD_DIR}
-
-build: ${BUILD_DIR}/Makefile
- @cmake --build ${BUILD_DIR} --target all
-
-package: config.xml.in icon.png.in build | $(PKG_FILELIST)
- @mkdir -p ${BUILD_DIR}/$@/bin
- @mkdir -p ${BUILD_DIR}/$@/etc
- @mkdir -p ${BUILD_DIR}/$@/lib
- @mkdir -p ${BUILD_DIR}/$@/htdocs
- @mkdir -p ${BUILD_DIR}/$@/data
- @mkdir -p package
- @cmake --build ${BUILD_DIR} --target widget
- @cp ${BUILD_DIR}/*wgt package
-
-${BUILD_DIR}/Makefile:
- @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
- @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CMAKE_OPTS} ..)
diff --git a/templates/service/CMakeLists.txt b/templates/service/CMakeLists.txt
deleted file mode 100644
index 1ddb659..0000000
--- a/templates/service/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Romain Forlot <romain.forlot@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
-
-include(${CMAKE_CURRENT_SOURCE_DIR}/etc/config.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/etc/macros.cmake)
-
-# Will add each subdirs with a CMakeLists.txt file
-project_subdirs_add()
-
-# Populate each target with LABELS specified.
-project_targets_populate()
-# Build package widget once populated.
-project_package_build()
-
-#Display CLOSING_MESSAGE specified in config.cmake file.
-project_closing_msg()
diff --git a/templates/service/README.md b/templates/service/README.md
deleted file mode 100644
index 17c9869..0000000
--- a/templates/service/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Application Framework - Service Template
-
-## Instructions
-
-Duplicate directory and adjust names. In particular, replace 'xxxxxx' by a proper service name.
-
-* adjust CMakeLists.txt (project name and version)
-* ajdust config.xml (description, author, license...)
-* rename xxxxxx-service-binding.c to something meaningful
-* store icon file in icons directory and update the variable PROJECT_ICON in CMakeLists.txt
-
-## Build
-
-Run:
-
-```
-mkdir build
-cd build
-cmake ..
-make
-```
-
-## Deployment
-
-Copy the .wgt file on the target through ssh and install it (adjust BOARDIP to your real IP address):
-
-```
-$ BOARDIP=1.2.3.4
-$ scp xxxxxx-service.wgt root@$BOARDIP:/tmp
-$ ssh root@$BOARDIP
-# afm-util install /tmp/xxxxxx-service.wgt
-# afm-util list
-```
-
-## Run service manually
-
-On the target board:
-
-```
-# afm-util start xxxxxx-server@0.1
-# ps -ef| grep afb-daemon | grep xxx
-```
-
-## Test using curl
-
-```
-# PORT=12345 # adjust the port depending in on afb-daemon instance: use ps -ef to check
-# curl -v http://localhost:$PORT/api/xxxxxx/ping
-* Trying 127.0.0.1...
-* Connected to localhost (127.0.0.1) port 5555 (#0)
-> GET /api/xxxxxx/ping HTTP/1.1
-> Host: localhost:5555
-> User-Agent: curl/7.44.0
-> Accept: */*
->
-< HTTP/1.1 200 OK
-< Connection: Keep-Alive
-< Content-Length: 184
-< Set-Cookie: x-afb-uuid-5555=30ab9573-cbc8-43f7-b385-0186feebc69a; Path=/api; Max-Age=3600; HttpOnly
-< Date: Sun, 10 Jul 2016 00:09:14 GMT
-<
-* Connection #0 to host localhost left intact
-{"response":"Some String","jtype":"afb-reply","request":{"status":"success","info":"Ping Binder Daemon tag=pingSample count=1 query={ }","uuid":"30ab9573-cbc8-43f7-b385-0186feebc69a"}}root@porter:~#
-```
-
-
diff --git a/templates/service/binding/CMakeLists.txt b/templates/service/binding/CMakeLists.txt
deleted file mode 100644
index 0d08b90..0000000
--- a/templates/service/binding/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Romain Forlot <romain.forlot@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-# Project target list
-# --------------------
-# Add target to project dependency list. Name specified as argument will be
-# added to the project target list and the variable ${TARGET_NAME} become
-# available with that value.
-PROJECT_TARGET_ADD(xxx-service)
-
- # Define project Targets
- add_library(${TARGET_NAME} MODULE
- ${TARGET_NAME}-hat.c
- ${TARGET_NAME}-cb.c
- )
-
- # Targets properties
- # ------------------
- # Target properties will be used to build package tree that will be
- # built using project_package_build.
- # OUTPUT_NAME: Depends what is the name of your output file, it is
- # mandatory to specify which is its name with target the property
- # OUTPUT_NAME for your target. If file name is same of your target then
- # use variable ${TARGET_NAME}.
- # LABELS: Choose between "BINDING", "HTDOCS", "EXECUTABLE" depending of
- # the type of your target.
- # PREFIX: This prefix will be added on the output file name specify with
- # OUTPUT_NAME. By default, there isn't PREFIX on target except on
- # library target with is "lib".
- SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
- PREFIX "afs-"
- LABELS "BINDING"
- LINK_FLAGS ${BINDINGS_LINK_FLAG}
- OUTPUT_NAME ${TARGET_NAME})
-
- # Link
- # ----
- # Library dependencies (include updates automatically). Linked to the
- # target.
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
- ${link_libraries})
-
- # Include
- # -------
- # Define target includes search and dependencies. Choose between PUBLIC,
- # PRIVATE or INTERFACE. PRIVATE and PUBLIC items will populate the
- # INCLUDE_DIRECTORIES property of <target>. PUBLIC and INTERFACE items
- # will populate the INTERFACE_INCLUDE_DIRECTORIES property of <target>.
- # The following arguments specify include directories.
- # INTERFACE_INCLUDE_DIRECTORIES will be read at the
- # TARGET_LINK_LIBRARIES step for others targets that link against this
- TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
diff --git a/templates/service/binding/xxx-service-cb.c b/templates/service/binding/xxx-service-cb.c
deleted file mode 100644
index 9b765ed..0000000
--- a/templates/service/binding/xxx-service-cb.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2015, 2016 "IoT.bzh"
- * Author "Fulup Ar Foll"
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <json-c/json.h>
-
-#include <afb/afb-binding.h>
- #include "xxx-service-hat.h"
-
- const struct afb_binding_interface *interface;
-
- static struct event *events = 0;
-
-/* searchs the event of tag */
- struct event *event_get(const char *tag)
-{
- struct event *e = events;
- while(e && strcmp(e->tag, tag))
- e = e->next;
- return e;
-}
-
-/* deletes the event of tag */
- int event_del(const char *tag)
-{
- struct event *e, **p;
-
- /* check exists */
- e = event_get(tag);
- if (!e) return -1;
-
- /* unlink */
- p = &events;
- while(*p != e) p = &(*p)->next;
- *p = e->next;
-
- /* destroys */
- afb_event_drop(e->event);
- free(e);
- return 0;
-}
-
-/* creates the event of tag */
- int event_add(const char *tag, const char *name)
-{
- struct event *e;
-
- /* check valid tag */
- e = event_get(tag);
- if (e) return -1;
-
- /* creation */
- e = malloc(strlen(tag) + sizeof *e);
- if (!e) return -1;
- strcpy(e->tag, tag);
-
- /* make the event */
- e->event = afb_daemon_make_event(interface->daemon, name);
- if (!e->event.closure) { free(e); return -1; }
-
- /* link */
- e->next = events;
- events = e;
- return 0;
-}
-
- int event_subscribe(struct afb_req request, const char *tag)
-{
- struct event *e;
- e = event_get(tag);
- return e ? afb_req_subscribe(request, e->event) : -1;
-}
-
- int event_unsubscribe(struct afb_req request, const char *tag)
-{
- struct event *e;
- e = event_get(tag);
- return e ? afb_req_unsubscribe(request, e->event) : -1;
-}
-
- int event_push(struct json_object *args, const char *tag)
-{
- struct event *e;
- e = event_get(tag);
- return e ? afb_event_push(e->event, json_object_get(args)) : -1;
-}
-
-// Sample Generic Ping Debug API
- static void ping(struct afb_req request, json_object *jresp, const char *tag)
-{
- static int pingcount = 0;
- json_object *query = afb_req_json(request);
- afb_req_success_f(request, jresp, "Ping Binder Daemon tag=%s count=%d query=%s", tag, ++pingcount, json_object_to_json_string(query));
-}
-
- void pingSample (struct afb_req request)
-{
- ping(request, json_object_new_string ("Some String"), "pingSample");
-}
-
- void pingFail (struct afb_req request)
-{
- afb_req_fail(request, "failed", "Ping Binder Daemon fails");
-}
-
- void pingNull (struct afb_req request)
-{
- ping(request, NULL, "pingNull");
-}
-
- void pingBug (struct afb_req request)
-{
- ping((struct afb_req){NULL,NULL}, NULL, "pingBug");
-}
-
- void pingEvent(struct afb_req request)
-{
- json_object *query = afb_req_json(request);
- afb_daemon_broadcast_event(interface->daemon, "event", json_object_get(query));
- ping(request, json_object_get(query), "event");
-}
-
-
-// For samples https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/
- void pingJson (struct afb_req request) {
- json_object *jresp, *embed;
-
- jresp = json_object_new_object();
- json_object_object_add(jresp, "myString", json_object_new_string ("Some String"));
- json_object_object_add(jresp, "myInt", json_object_new_int (1234));
-
- embed = json_object_new_object();
- json_object_object_add(embed, "subObjString", json_object_new_string ("Some String"));
- json_object_object_add(embed, "subObjInt", json_object_new_int (5678));
-
- json_object_object_add(jresp,"eobj", embed);
-
- ping(request, jresp, "pingJson");
-}
-
- void subcallcb (void *prequest, int iserror, json_object *object)
-{
- struct afb_req request = afb_req_unstore(prequest);
- if (iserror)
- afb_req_fail(request, "failed", json_object_to_json_string(object));
- else
- afb_req_success(request, object, NULL);
- afb_req_unref(request);
-}
-
- void subcall (struct afb_req request)
-{
- const char *api = afb_req_value(request, "api");
- const char *verb = afb_req_value(request, "verb");
- const char *args = afb_req_value(request, "args");
- json_object *object = api && verb && args ? json_tokener_parse(args) : NULL;
-
- if (object == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else
- afb_req_subcall(request, api, verb, object, subcallcb, afb_req_store(request));
-}
-
- void eventadd (struct afb_req request)
-{
- const char *tag = afb_req_value(request, "tag");
- const char *name = afb_req_value(request, "name");
-
- if (tag == NULL || name == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_add(tag, name))
- afb_req_fail(request, "failed", "creation error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
- void eventdel (struct afb_req request)
-{
- const char *tag = afb_req_value(request, "tag");
-
- if (tag == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_del(tag))
- afb_req_fail(request, "failed", "deletion error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
- void eventsub (struct afb_req request)
-{
- const char *tag = afb_req_value(request, "tag");
-
- if (tag == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_subscribe(request, tag))
- afb_req_fail(request, "failed", "subscription error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
- void eventunsub (struct afb_req request)
-{
- const char *tag = afb_req_value(request, "tag");
-
- if (tag == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 != event_unsubscribe(request, tag))
- afb_req_fail(request, "failed", "unsubscription error");
- else
- afb_req_success(request, NULL, NULL);
-}
-
- void eventpush (struct afb_req request)
-{
- const char *tag = afb_req_value(request, "tag");
- const char *data = afb_req_value(request, "data");
- json_object *object = data ? json_tokener_parse(data) : NULL;
-
- if (tag == NULL)
- afb_req_fail(request, "failed", "bad arguments");
- else if (0 > event_push(object, tag))
- afb_req_fail(request, "failed", "push error");
- else
- afb_req_success(request, NULL, NULL);
-} \ No newline at end of file
diff --git a/templates/service/binding/xxx-service-hat.c b/templates/service/binding/xxx-service-hat.c
deleted file mode 100644
index 2e172e8..0000000
--- a/templates/service/binding/xxx-service-hat.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015, 2016 "IoT.bzh"
- * Author "Fulup Ar Foll"
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <json-c/json.h>
-
-#include <afb/afb-binding.h>
-#include "xxx-service-hat.h"
-
-const struct afb_binding_interface *interface;
-
-// NOTE: this sample does not use session to keep test a basic as possible
-// in real application most APIs should be protected with AFB_SESSION_CHECK
-static const struct afb_verb_desc_v1 verbs[]= {
- {"ping" , AFB_SESSION_NONE, pingSample , "Ping the binder"},
- {"pingfail" , AFB_SESSION_NONE, pingFail , "Ping that fails"},
- {"pingnull" , AFB_SESSION_NONE, pingNull , "Ping which returns NULL"},
- {"pingbug" , AFB_SESSION_NONE, pingBug , "Do a Memory Violation"},
- {"pingJson" , AFB_SESSION_NONE, pingJson , "Return a JSON object"},
- {"pingevent", AFB_SESSION_NONE, pingEvent , "Send an event"},
- {"subcall", AFB_SESSION_NONE, subcall , "Call api/verb(args)"},
- {"eventadd", AFB_SESSION_NONE, eventadd , "adds the event of 'name' for the 'tag'"},
- {"eventdel", AFB_SESSION_NONE, eventdel , "deletes the event of 'tag'"},
- {"eventsub", AFB_SESSION_NONE, eventsub , "subscribes to the event of 'tag'"},
- {"eventunsub",AFB_SESSION_NONE, eventunsub , "unsubscribes to the event of 'tag'"},
- {"eventpush", AFB_SESSION_NONE, eventpush , "pushes the event of 'tag' with the 'data'"},
- {NULL}
-};
-
-static const struct afb_binding plugin_desc = {
- .type = AFB_BINDING_VERSION_1,
- .v1 = {
- .info = "xxxxxx service",
- .prefix = "xxxxxx",
- .verbs = verbs
- }
-};
-
-const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf)
-{
- interface = itf;
- return &plugin_desc;
-}
diff --git a/templates/service/binding/xxx-service-hat.h b/templates/service/binding/xxx-service-hat.h
deleted file mode 100644
index a80c0c2..0000000
--- a/templates/service/binding/xxx-service-hat.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2015, 2016 "IoT.bzh"
- * Author "Fulup Ar Foll"
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef SERVICEHAT_H
-#define SERVICEHAT_H
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <json-c/json.h>
-
-#include <afb/afb-binding.h>
-
-extern const struct afb_binding_interface *interface;
-
-struct event
-{
- struct event *next;
- struct afb_event event;
- char tag[1];
-};
-
-/* searchs the event of tag */
-struct event *event_get(const char *tag);
-
-/* deletes the event of tag */
-int event_del(const char *tag);
-
-/* creates the event of tag */
-int event_add(const char *tag, const char *name);
-
-int event_subscribe(struct afb_req request, const char *tag);
-
-int event_unsubscribe(struct afb_req request, const char *tag);
-
-int event_push(struct json_object *args, const char *tag);
-
-void pingSample (struct afb_req request);
-
-void pingFail (struct afb_req request);
-
-void pingNull (struct afb_req request);
-
-void pingBug (struct afb_req request);
-
-void pingEvent(struct afb_req request);
-
-// For samples https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/
-void pingJson (struct afb_req request);
-
-void subcallcb (void *prequest, int iserror, json_object *object);
-
-void subcall (struct afb_req request);
-
-void eventadd (struct afb_req request);
-
-void eventdel (struct afb_req request);
-
-void eventsub (struct afb_req request);
-
-void eventunsub (struct afb_req request);
-
-void eventpush (struct afb_req request);
-
-#endif \ No newline at end of file
diff --git a/templates/service/etc/config.cmake b/templates/service/etc/config.cmake
deleted file mode 100644
index e614619..0000000
--- a/templates/service/etc/config.cmake
+++ /dev/null
@@ -1,109 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Fulup Ar Foll <fulup@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-# Project Info
-# ------------------
-set(PROJECT_NAME service-example)
-set(VERSION "0.0")
-set(PROJECT_PRETTY_NAME "Service binding Example")
-set(PROJECT_DESCRIPTION "service binding AGL application example")
-set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/apps/app-templates")
-set(PROJECT_AUTHOR "Last Name, First Name")
-set(PROJECT_AUTHOR_MAIL "example.man@bigouden.bzh")
-set(PROJECT_ICON "icon.png")
-
-# Compilation Mode (DEBUG, RELEASE)
-# ----------------------------------
-set(CMAKE_BUILD_TYPE "DEBUG")
-
-# Compiler selection if needed. Impose a minimal version.
-# -----------------------------------------------
-set (gcc_minimal_version 4.9)
-
-# PKG_CONFIG required packages
-# -----------------------------
-set (PKG_REQUIRED_LIST
- json-c
- afb-daemon
-)
-
-# Static constante definition
-# -----------------------------
-add_compile_options()
-
-# LANG Specific compile flags set for all build types
-set(CMAKE_C_FLAGS "")
-set(CMAKE_CXX_FLAGS "")
-
-# Print a helper message when every thing is finished
-# ----------------------------------------------------
-set(CLOSING_MESSAGE "Test launching application with : afb-daemon --rootdir=\$\$(pwd)/package --ldpaths=\$\$(pwd)/package/lib --port=1234 --roothttp=\$\$(pwd)/package/htdocs --tracereq=common --token=\"1\" --verbose then using command 'afb-client-demo ws://localhost:1234/api?token=1' to communicate with the service")
-set(WIDGET_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
-
-# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
-# ---------------------------------------------------------------------
-set(CMAKE_INSTALL_PREFIX ${HOME}/opt)
-set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
-set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
-
-# Optional dependencies order
-# ---------------------------
-#set(EXTRA_DEPENDENCIES_ORDER)
-
-# Optional Extra global include path
-# -----------------------------------
-#set(EXTRA_INCLUDE_DIRS)
-
-# Optional extra libraries
-# -------------------------
-#set(EXTRA_LINK_LIBRARIES)
-
-# Optional force binding installation
-# ------------------------------------
-# set(BINDINGS_INSTALL_PREFIX PrefixPath )
-
-# Optional force widget prefix generation
-# ------------------------------------------------
-# set(WIDGET_PREFIX DestinationPath)
-
-# Optional Widget entry point file.
-# ---------------------------------------------------------
- # This is the file that will be executed, loaded,...
-# at launch time by the application framework
-
-# set(WIDGET_ENTRY_POINT EntryPoint_Path)
-
-# Optional Widget Mimetype specification
-# --------------------------------------------------
-# Choose between :
-# - application/x-executable
-# - application/vnd.agl.url
-# - application/vnd.agl.service
-# - application/vnd.agl.native
-# - text/vnd.qt.qml
-# - text/html
-# - application/vnd.agl.qml
-# - application/vnd.agl.qml.hybrid
-# - application/vnd.agl.html.hybrid
-#
-# set(WIDGET_TYPE MimeType)
-
-# Optional force binding Linking flag
-# ------------------------------------
-# set(BINDINGS_LINK_FLAG LinkOptions )
-
diff --git a/templates/service/etc/export.map b/templates/service/etc/export.map
deleted file mode 100644
index ee2f413..0000000
--- a/templates/service/etc/export.map
+++ /dev/null
@@ -1 +0,0 @@
-{ global: afbBindingV*; local: *; };
diff --git a/templates/service/etc/macros.cmake b/templates/service/etc/macros.cmake
deleted file mode 100644
index 18af27e..0000000
--- a/templates/service/etc/macros.cmake
+++ /dev/null
@@ -1,263 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Fulup Ar Foll <fulup@iot.bzh>
-# contrib: Romain Forlot <romain.forlot@iot.bzh>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-
-#--------------------------------------------------------------------------
-# WARNING:
-# Do not change this cmake template
-# Customise your preferences in "./etc/config.cmake"
-#--------------------------------------------------------------------------
-
-
-# Generic useful macro
-# -----------------------
-macro(PROJECT_TARGET_ADD TARGET_NAME)
- set_property(GLOBAL APPEND PROPERTY PROJECT_TARGETS ${TARGET_NAME})
- set(TARGET_NAME ${TARGET_NAME})
-endmacro(PROJECT_TARGET_ADD)
-
-# Check GCC minimal version version
-if (gcc_minimal_version)
- message ("-- Check gcc_minimal_version (found gcc version ${CMAKE_C_COMPILER_VERSION}) (found g++ version ${CMAKE_CXX_COMPILER_VERSION})")
-if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version} OR CMAKE_C_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version})
- message(FATAL_ERROR "**** FATAL: Require at least gcc-${gcc_minimal_version} please set CMAKE_C[XX]_COMPILER")
-endif()
-endif(gcc_minimal_version)
-
-macro(defstr name value)
- add_definitions(-D${name}=${value})
-endmacro(defstr)
-
-# WGT packaging
-macro(project_targets_populate)
- add_custom_target(MAIN_POPULATE)
- get_property(PROJECT_TARGETS GLOBAL PROPERTY PROJECT_TARGETS)
- foreach(TARGET ${PROJECT_TARGETS})
- get_target_property(T ${TARGET} LABELS)
- if(T)
- # Declaration of a custom command that will populate widget tree with the target
- set(POPULE_WIDGET_TARGET "project_populate_${TARGET}")
-
- get_target_property(P ${TARGET} PREFIX)
- get_target_property(BD ${TARGET} BINARY_DIR)
- get_target_property(OUT ${TARGET} OUTPUT_NAME)
-
- if(P MATCHES "NOTFOUND$")
- if (${T} STREQUAL "BINDING")
- set(P "lib")
- else()
- set(P "")
- endif()
- endif()
-
- if(${T} STREQUAL "BINDING")
- add_custom_command(OUTPUT ${WIDGET_LIBDIR}/${P}${TARGET}.so
- DEPENDS ${TARGET}
- COMMAND mkdir -p ${WIDGET_LIBDIR}
- COMMAND cp ${BD}/${P}${OUT}.so ${WIDGET_LIBDIR}
- )
- add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_LIBDIR}/${P}${TARGET}.so)
- add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
- elseif(${T} STREQUAL "EXECUTABLE")
- add_custom_command(OUTPUT ${WIDGET_BINDIR}/${P}${TARGET}
- DEPENDS ${TARGET}
- COMMAND mkdir -p ${WIDGET_BINDIR}
- COMMAND cp ${BD}/${P}${OUT} ${WIDGET_BINDIR}
- )
- add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_BINDIR}/${P}${TARGET})
- add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
- elseif(${T} STREQUAL "HTDOCS")
- add_custom_command(OUTPUT ${WIDGET_HTTPDIR}
- DEPENDS ${TARGET}
- COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_HTTPDIR}
- )
- add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_HTTPDIR})
- add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
- elseif(${T} STREQUAL "DATA")
- add_custom_command(OUTPUT ${WIDGET_DATADIR}
- DEPENDS ${TARGET}
- COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_DATADIR}
- )
- add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_HTTPDIR})
- add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
- endif(${T} STREQUAL "BINDING")
-# elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
-# MESSAGE(WARNING "This target, ${TARGET}, will be not be included in the package.")
- endif()
- endforeach()
-endmacro(project_targets_populate)
-
-macro(project_package_build)
- if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/config.xml.in OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/${PROJECT_ICON}.in)
- MESSAGE(FATAL_ERROR "Missing mandatory files: you need config.xml.in and ${PROJECT_ICON}.in files in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR} folder.")
- endif()
-
- if(NOT EXISTS ${WIDGET_DIR}/config.xml.in OR NOT EXISTS ${WIDGET_DIR}/${PROJECT_ICON}.in)
- configure_file(${PROJECT_WGT_DIR}/config.xml.in ${WIDGET_DIR}/config.xml)
- file(COPY ${PROJECT_WGT_DIR}/${PROJECT_ICON}.in DESTINATION ${WIDGET_DIR}/${PROJECT_ICON})
- endif(NOT EXISTS ${WIDGET_DIR}/config.xml.in OR NOT EXISTS ${WIDGET_DIR}/${PROJECT_ICON}.in)
-
- file(GLOB PROJECT_CONF_FILES "${PROJECT_WGT_DIR}/etc/*")
- if(${PROJECT_CONF_FILES})
- file(COPY "${PROJECT_WGT_DIR}/etc/*" DESTINATION ${WIDGET_ETCDIR}/)
- endif(${PROJECT_CONF_FILES})
-
- add_custom_command(OUTPUT ${PROJECT_NAME}.wgt
- DEPENDS ${PROJECT_TARGETS}
- COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${WIDGET_DIR}
- )
-
- add_custom_target(widget DEPENDS ${PROJECT_NAME}.wgt)
- add_dependencies(widget MAIN_POPULATE)
- set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.wgt")
-
- if(WIDGET_MESSAGE)
- add_custom_command(TARGET widget
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${WIDGET_MESSAGE}")
- endif()
-endmacro(project_package_build)
-
-macro(project_subdirs_add)
- if(${ARGV0})
- file(GLOB filelist "${ARGV0}")
- else()
- file(GLOB filelist "*")
- endif(${ARGV0})
-
- foreach(filename ${filelist})
- if(EXISTS "${filename}/CMakeLists.txt")
- add_subdirectory(${filename})
- endif(EXISTS "${filename}/CMakeLists.txt")
- endforeach()
-endmacro(project_subdirs_add)
-
-set(CMAKE_BUILD_TYPE Debug CACHE STRING "the type of build")
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(CMP0048 1)
-
-# Include project configuration
-# ------------------------------
-project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
-set(PROJECT_WGT_DIR "packaging/wgt" CACHE PATH "Subpath to the widget directory")
-set(PROJECT_LIBDIR "libs" CACHE PATH "Subpath to libraries")
-set(PROJECT_RESOURCES "data" CACHE PATH "Subpath to data")
-
-INCLUDE(FindPkgConfig)
-INCLUDE(CheckIncludeFiles)
-INCLUDE(CheckLibraryExists)
-INCLUDE(GNUInstallDirs)
-
-# Default compilation options
-############################################################################
-link_libraries(-Wl,--as-needed -Wl,--gc-sections)
-add_compile_options(-Wall -Wextra -Wconversion)
-add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
-add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
-add_compile_options(-Werror=maybe-uninitialized)
-add_compile_options(-Werror=implicit-function-declaration)
-add_compile_options(-ffunction-sections -fdata-sections)
-add_compile_options(-fPIC)
-add_compile_options(-g)
-
-set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for profiling")
-set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for debugging")
-set(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Flags for releasing")
-set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage" CACHE STRING "Flags for coverage test")
-
-set(CMAKE_CXX_FLAGS_PROFILING "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
-set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
-set(CMAKE_CXX_FLAGS_RELEASE "-g -O2")
-set(CMAKE_CXX_FLAGS_CCOV "-g -O2 --coverage")
-
-set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Install" CACHE PATH "The path where to install")
-
-# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable]
-set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON CACHE BOOLEAN "Flag for using prefix path")
-
-# Loop on required package and add options
-foreach (PKG_CONFIG ${PKG_REQUIRED_LIST})
- PKG_CHECK_MODULES(${PKG_CONFIG} REQUIRED ${PKG_CONFIG})
-
- INCLUDE_DIRECTORIES(${${PKG_CONFIG}_INCLUDE_DIRS})
- list (APPEND link_libraries ${${PKG_CONFIG}_LIBRARIES})
- add_compile_options (${${PKG_CONFIG}_CFLAGS})
-endforeach(PKG_CONFIG)
-
-# Optional LibEfence Malloc debug library
-IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
-CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
-IF(HAVE_LIBEFENCE)
- MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
- SET(libefence_LIBRARIES "-lefence")
- list (APPEND link_libraries ${libefence_LIBRARIES})
-ENDIF(HAVE_LIBEFENCE)
-ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
-
-# set default include directories
-INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS})
-
-# If no install dir try to guess some smart default
-if(BINDINGS_INSTALL_PREFIX)
- set(BINDINGS_INSTALL_DIR ${BINDINGS_INSTALL_PREFIX}/${PROJECT_NAME})
-else()
- set(BINDINGS_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
-endif()
-
-# Define a default package directory
-if(WIDGET_PREFIX)
- set(WIDGET_DIR ${WIDGET_PREFIX}/package)
-else()
- set(WIDGET_DIR ${CMAKE_CURRENT_BINARY_DIR}/package)
-endif()
-
-# and their subsequent subdir
-set(WIDGET_BINDIR ${WIDGET_DIR}/bin)
-set(WIDGET_ETCDIR ${WIDGET_DIR}/etc)
-set(WIDGET_LIBDIR ${WIDGET_DIR}/lib)
-set(WIDGET_HTTPDIR ${WIDGET_DIR}/htdocs)
-set(WIDGET_DATADIR ${WIDGET_DIR}/data)
-
-# Default Linkflag
-if(NOT BINDINGS_LINK_FLAG)
- set(BINDINGS_LINK_FLAG "-Wl,--version-script=${CMAKE_SOURCE_DIR}/etc/export.map")
-endif()
-
-# Add a dummy target to enable global dependency order
-# -----------------------------------------------------
-if(EXTRA_DEPENDENCIES_ORDER)
- set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies)
- add_custom_target(${DEPENDENCIES_TARGET} ALL
- DEPENDS ${EXTRA_DEPENDENCY_ORDER}
- )
-endif()
-
-# Print developer helper message when build is done
-# -------------------------------------------------------
-macro(project_closing_msg)
- get_property(PROJECT_TARGETS_SET GLOBAL PROPERTY PROJECT_TARGETS SET)
- get_property(PROJECT_TARGETS GLOBAL PROPERTY PROJECT_TARGETS)
- if(CLOSING_MESSAGE AND ${PROJECT_TARGETS_SET})
- add_custom_target(${PROJECT_NAME}_build_done ALL
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
- )
- add_dependencies(${PROJECT_NAME}_build_done
- ${DEPENDENCIES_TARGET} ${PROJECT_TARGETS})
- endif()
-endmacro()
diff --git a/templates/service/packaging/wgt/config.xml.in b/templates/service/packaging/wgt/config.xml.in
deleted file mode 100644
index fab0b9d..0000000
--- a/templates/service/packaging/wgt/config.xml.in
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
- <name>@PROJECT_NAME@</name>
- <icon src="icon.png"/>
- <content src="lib/@PROJECT_NAME@" type="application/vnd.agl.service"/>
- <description>@PROJECT_DESCRIPTION@</description>
- <author>@PROJECT_AUTHOR@ &lt;@PROJECT_AUTHOR_MAIL@&gt;</author>
- <license>APL 2.0</license>
-</widget>
-
-
diff --git a/templates/service/packaging/wgt/icon.png.in b/templates/service/packaging/wgt/icon.png.in
deleted file mode 100644
index 3aeb6f0..0000000
--- a/templates/service/packaging/wgt/icon.png.in
+++ /dev/null
Binary files differ