From: Romain Forlot Date: Wed, 4 Oct 2017 23:34:33 +0000 (+0200) Subject: External mXML project library inclusion X-Git-Tag: 4.99.3~19 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=81e5dad8294f20c3cb69383d0a6e8b04c3579094;p=apps%2Fagl-service-unicens.git External mXML project library inclusion Change-Id: I7ed0a21f3aa79cc007ff224eec66a048f53ba98f Signed-off-by: Romain Forlot --- diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 0000000..ba0f803 --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,42 @@ +########################################################################### +# Copyright 2015, 2016, 2017 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. +########################################################################### + +set(MXML external-mxml) +set(MXML_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mxml) +include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) +ExternalProject_Add(${MXML} + GIT_REPOSITORY https://github.com/michaelrsweet/mxml.git + GIT_TAG release-2.10 + SOURCE_DIR ${MXML_SOURCE_DIR} + CONFIGURE_COMMAND ./configure --build x86_64 --host aarch64 + BUILD_COMMAND make libmxml.so.1.5 + BUILD_IN_SOURCE 1 + INSTALL_COMMAND "" +) + +PROJECT_TARGET_ADD(mxml) + +add_library(${TARGET_NAME} SHARED IMPORTED GLOBAL) + +SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS LIBRARY + IMPORTED_LOCATION ${MXML_SOURCE_DIR}/libmxml.so.1 + INTERFACE_INCLUDE_DIRECTORIES ${MXML_SOURCE_DIR} +) + +add_dependencies(${TARGET_NAME} ${MXML}) diff --git a/conf.d/app-templates b/conf.d/app-templates index aa763dd..17456de 160000 --- a/conf.d/app-templates +++ b/conf.d/app-templates @@ -1 +1 @@ -Subproject commit aa763ddec685dc44bcb5d44718d78f3692d4f0dc +Subproject commit 17456de19e50f63348d42c4ae26dda156ddec53d diff --git a/conf.d/autobuild/agl/autobuild b/conf.d/autobuild/agl/autobuild index 759f6be..3a1ba5f 100755 --- a/conf.d/autobuild/agl/autobuild +++ b/conf.d/autobuild/agl/autobuild @@ -18,7 +18,7 @@ THISFILE := $(lastword $(MAKEFILE_LIST)) BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build) DEST := ${BUILD_DIR}/target -.PHONY: all clean distclean configure build package help +.PHONY: all clean distclean configure build package help update all: help @@ -29,12 +29,16 @@ help: @echo "- clean" @echo "- distclean" @echo "- configure" - @echo "- build" - @echo "- package" + @echo "- build: compilation, link and prepare files for package into a widget" + @echo "- package: output a widget file '*.wgt'" + @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory" @echo "" @echo "Usage: ./conf.d/autobuild/agl/autobuild package DEST=${HOME}/opt" @echo "Don't use your build dir as DEST as wgt file is generated at this location" +update: configure + @cmake --build ${BUILD_DIR} --target autobuild + clean: @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean @@ -55,6 +59,9 @@ package: build @cmake --build ${BUILD_DIR} --target widget @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST} +install: build + @cmake --build ${BUILD_DIR} --target install + ${BUILD_DIR}/Makefile: @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..) diff --git a/conf.d/autobuild/linux/autobuild b/conf.d/autobuild/linux/autobuild index 759f6be..3a1ba5f 100755 --- a/conf.d/autobuild/linux/autobuild +++ b/conf.d/autobuild/linux/autobuild @@ -18,7 +18,7 @@ THISFILE := $(lastword $(MAKEFILE_LIST)) BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build) DEST := ${BUILD_DIR}/target -.PHONY: all clean distclean configure build package help +.PHONY: all clean distclean configure build package help update all: help @@ -29,12 +29,16 @@ help: @echo "- clean" @echo "- distclean" @echo "- configure" - @echo "- build" - @echo "- package" + @echo "- build: compilation, link and prepare files for package into a widget" + @echo "- package: output a widget file '*.wgt'" + @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory" @echo "" @echo "Usage: ./conf.d/autobuild/agl/autobuild package DEST=${HOME}/opt" @echo "Don't use your build dir as DEST as wgt file is generated at this location" +update: configure + @cmake --build ${BUILD_DIR} --target autobuild + clean: @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean @@ -55,6 +59,9 @@ package: build @cmake --build ${BUILD_DIR} --target widget @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST} +install: build + @cmake --build ${BUILD_DIR} --target install + ${BUILD_DIR}/Makefile: @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..) diff --git a/conf.d/config.cmake b/conf.d/config.cmake index 5545656..70d847b 100644 --- a/conf.d/config.cmake +++ b/conf.d/config.cmake @@ -60,7 +60,7 @@ set (gcc_minimal_version 4.9) # PKG_CONFIG required packages # ----------------------------- set (PKG_REQUIRED_LIST - mxml + #mxml json-c libsystemd>=222 afb-daemon @@ -153,4 +153,4 @@ set(WIDGET_ENTRY_POINT lib/afb-ucs2.so) # This include is mandatory and MUST happens at the end # of this file, else you expose you to unexpected behavior # ----------------------------------------------------------- -include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake) \ No newline at end of file +include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake) diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in index e8bd7fb..48a839a 100644 --- a/conf.d/wgt/config.xml.in +++ b/conf.d/wgt/config.xml.in @@ -2,7 +2,7 @@ @PROJECT_NAME@ - + @PROJECT_DESCRIPTION@ @PROJECT_AUTHOR@ <@PROJECT_AUTHOR_MAIL@> APL 2.0 diff --git a/conf.d/xds/xds-config.env b/conf.d/xds/xds-config.env new file mode 100644 index 0000000..a7d39cc --- /dev/null +++ b/conf.d/xds/xds-config.env @@ -0,0 +1,12 @@ +XDS_PROJECT_ID="e50357ed-a777-11e7-885d-90b11c6bb221_Project_unicens2-bin" +XDS_SDK_ID="poky-agl_aarch64_4.90.0+snapshot" + +XDS_SERVER_URL=localhost:8000 + +#DOCKER_TARGET=agl-xds-shamash-0-claneys +PATH=/opt/bin:/opt/AGL/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/claneys/.local/bin:/home/claneys/bin + +RSYNC_TARGET=root@sataran.uruk.home +RSYNC_PREFIX=/tmp +PROJECT_DIR=/home/claneys/Workspace/Sources/IOTbzh/unicens2-binding + diff --git a/ucs2-afb/CMakeLists.txt b/ucs2-afb/CMakeLists.txt index 9bac628..31d8c0d 100644 --- a/ucs2-afb/CMakeLists.txt +++ b/ucs2-afb/CMakeLists.txt @@ -16,35 +16,20 @@ # limitations under the License. ########################################################################### - -# Generate API-v2 hat from OpenAPI json definition -macro(SET_TARGET_GENSKEL TARGET_NAME API_DEF_NAME) - add_custom_command(OUTPUT ${API_DEF_NAME}.h - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${API_DEF_NAME}.json - COMMAND afb-genskel ${API_DEF_NAME}.json >${API_DEF_NAME}.h - ) - add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h) - add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI) - -endmacro(SET_TARGET_GENSKEL) - # Add target to project dependency list PROJECT_TARGET_ADD(ucs2-afb) # Define project Targets ADD_LIBRARY(${TARGET_NAME} MODULE ucs_apihat.c ucs_binding.c ) - # Generate API-v2 hat from OpenAPI json definition - SET_TARGET_GENSKEL(${TARGET_NAME} ucs_apidef) + SET_OPENAPI_FILENAME(ucs_apidef) # Binder exposes a unique public entry point SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - PREFIX "afb-" - LABELS "BINDING" - LINK_FLAGS ${BINDINGS_LINK_FLAG} - OUTPUT_NAME ucs2 - + PREFIX "afb-" + LABELS "BINDINGV2" + LINK_FLAGS ${BINDINGS_LINK_FLAG} + OUTPUT_NAME ucs2 ) # Library dependencies (include updates automatically) @@ -52,8 +37,3 @@ PROJECT_TARGET_ADD(ucs2-afb) ucs2-inter ${link_libraries} ) - - # installation directory - INSTALL(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR}) - diff --git a/ucs2-afb/ucs_apidef.h b/ucs2-afb/ucs_apidef.h index 876ac89..f8e9c9c 100644 --- a/ucs2-afb/ucs_apidef.h +++ b/ucs2-afb/ucs_apidef.h @@ -60,37 +60,43 @@ static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = { .verb = "listconfig", .callback = ucs2_listconfig, .auth = &_afb_auths_v2_UNICENS[0], - .info = NULL, + .info = "List Config Files", .session = AFB_SESSION_NONE_V2 }, { .verb = "initialise", .callback = ucs2_initialise, .auth = &_afb_auths_v2_UNICENS[0], - .info = NULL, + .info = "configure Unicens2 lib from NetworkConfig.XML.", .session = AFB_SESSION_NONE_V2 }, { .verb = "subscribe", .callback = ucs2_subscribe, .auth = &_afb_auths_v2_UNICENS[1], - .info = NULL, + .info = "Subscribe to UNICENS Events.", .session = AFB_SESSION_NONE_V2 }, { .verb = "writei2c", .callback = ucs2_writei2c, .auth = &_afb_auths_v2_UNICENS[1], - .info = NULL, + .info = "Writes I2C command to remote node.", .session = AFB_SESSION_NONE_V2 }, - { .verb = NULL } + { + .verb = NULL, + .callback = NULL, + .auth = NULL, + .info = NULL, + .session = 0 + } }; const struct afb_binding_v2 afbBindingV2 = { .api = "UNICENS", .specification = _afb_description_v2_UNICENS, - .info = NULL, + .info = "", .verbs = _afb_verbs_v2_UNICENS, .preinit = NULL, .init = NULL, diff --git a/ucs2-interface/CMakeLists.txt b/ucs2-interface/CMakeLists.txt index cd5e880..8cd797c 100644 --- a/ucs2-interface/CMakeLists.txt +++ b/ucs2-interface/CMakeLists.txt @@ -20,18 +20,17 @@ PROJECT_TARGET_ADD(ucs2-inter) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDEBUG") - # Define targets + # Define targets ADD_LIBRARY(ucs2-inter STATIC ucs_lib_interf.c ucs-xml/UcsXml.c ucs-xml/UcsXml_Private.c) # Library properties SET_TARGET_PROPERTIES(ucs2-inter PROPERTIES OUTPUT_NAME ucs2interface) - + # Depends on Unicens2 lib - TARGET_LINK_LIBRARIES(ucs2-inter ucs2-lib) + TARGET_LINK_LIBRARIES(ucs2-inter ucs2-lib mxml) # Define includes - TARGET_INCLUDE_DIRECTORIES(ucs2-inter + TARGET_INCLUDE_DIRECTORIES(ucs2-inter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + INTERFACE mxml ) - -