From af8fd545eee24fb2d6a8d472912f9c606b044278 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Fri, 11 Aug 2017 12:31:35 -0700 Subject: binding: wifi: switch from qmake to cmake Switch from legacy qmake to cmake to build binding Bug-AGL: SPEC-823 Change-Id: I55532be199415a4d4adb441446c1143da9ef8edf Signed-off-by: Matt Ranostay --- .gitmodules | 3 + CMakeLists.txt | 21 +++ agl-service-wifi.pro | 3 - binding-wifi/CMakeLists.txt | 43 ++++++ binding-wifi/agent.o | Bin 0 -> 67632 bytes binding-wifi/binding-wifi.pro | 11 -- binding-wifi/binding.pri | 6 - binding-wifi/export.map | 1 - binding-wifi/wifi-api.o | Bin 0 -> 124952 bytes binding-wifi/wifi-connman.o | Bin 0 -> 76504 bytes conf.d/app-templates | 1 + conf.d/autobuild/agl/autobuild | 60 +++++++++ conf.d/autobuild/linux/autobuild | 60 +++++++++ conf.d/cmake/config.cmake | 162 ++++++++++++++++++++++ conf.d/wgt/config.xml.in | 24 ++++ package/config.xml | 20 --- package/icon.svg | 283 --------------------------------------- package/package.pro | 21 --- 18 files changed, 374 insertions(+), 345 deletions(-) create mode 100644 .gitmodules create mode 100644 CMakeLists.txt delete mode 100644 agl-service-wifi.pro create mode 100644 binding-wifi/CMakeLists.txt create mode 100644 binding-wifi/agent.o delete mode 100644 binding-wifi/binding-wifi.pro delete mode 100644 binding-wifi/binding.pri delete mode 100644 binding-wifi/export.map create mode 100644 binding-wifi/wifi-api.o create mode 100644 binding-wifi/wifi-connman.o create mode 160000 conf.d/app-templates create mode 100755 conf.d/autobuild/agl/autobuild create mode 100755 conf.d/autobuild/linux/autobuild create mode 100644 conf.d/cmake/config.cmake create mode 100644 conf.d/wgt/config.xml.in delete mode 100644 package/config.xml delete mode 100644 package/icon.svg delete mode 100644 package/package.pro diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b545da1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "conf.d/app-templates"] + path = conf.d/app-templates + url = https://gerrit.automotivelinux.org/gerrit/apps/app-templates diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b485097 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Romain Forlot +# +# 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}/conf.d/cmake/config.cmake) diff --git a/agl-service-wifi.pro b/agl-service-wifi.pro deleted file mode 100644 index c60b30b..0000000 --- a/agl-service-wifi.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = binding-wifi package -package.depends += binding-wifi diff --git a/binding-wifi/CMakeLists.txt b/binding-wifi/CMakeLists.txt new file mode 100644 index 0000000..54fef96 --- /dev/null +++ b/binding-wifi/CMakeLists.txt @@ -0,0 +1,43 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll +# contrib: Romain Forlot +# +# 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. +########################################################################### + +# Add target to project dependency list +PROJECT_TARGET_ADD(wifi-binding) + + # Define project Targets + add_library(${TARGET_NAME} MODULE + agent.c + wifi-api.c + wifi-connman.c) + + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + PREFIX "libafm-" + LABELS "BINDING" + LINK_FLAGS ${BINDINGS_LINK_FLAG} + OUTPUT_NAME ${TARGET_NAME} + ) + + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(${TARGET_NAME} ${link_libraries}) + + # installation directory + INSTALL(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR}) + diff --git a/binding-wifi/agent.o b/binding-wifi/agent.o new file mode 100644 index 0000000..4e2dd65 Binary files /dev/null and b/binding-wifi/agent.o differ diff --git a/binding-wifi/binding-wifi.pro b/binding-wifi/binding-wifi.pro deleted file mode 100644 index 11538e1..0000000 --- a/binding-wifi/binding-wifi.pro +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = agl-wifi-binding - -HEADERS = wifi-api.h wifi-connman.h -SOURCES = agent.c wifi-api.c wifi-connman.c - -LIBS += -Wl,--version-script=$$PWD/export.map - -CONFIG += link_pkgconfig -PKGCONFIG += json-c afb-daemon glib-2.0 gio-2.0 gobject-2.0 zlib - -include(binding.pri) diff --git a/binding-wifi/binding.pri b/binding-wifi/binding.pri deleted file mode 100644 index 3448a56..0000000 --- a/binding-wifi/binding.pri +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin use_c_linker -CONFIG -= qt -QMAKE_CFLAGS += -Wextra -Wconversion -Wno-unused-parameter -Werror=maybe-uninitialized -Werror=implicit-function-declaration -ffunction-sections -fdata-sections -Wl,--as-needed -Wl,--gc-sections - -DESTDIR = $${OUT_PWD}/../package/root/lib diff --git a/binding-wifi/export.map b/binding-wifi/export.map deleted file mode 100644 index eea0d7b..0000000 --- a/binding-wifi/export.map +++ /dev/null @@ -1 +0,0 @@ -{ global: afbBindingV2*; local: *; }; diff --git a/binding-wifi/wifi-api.o b/binding-wifi/wifi-api.o new file mode 100644 index 0000000..27b92b8 Binary files /dev/null and b/binding-wifi/wifi-api.o differ diff --git a/binding-wifi/wifi-connman.o b/binding-wifi/wifi-connman.o new file mode 100644 index 0000000..f756649 Binary files /dev/null and b/binding-wifi/wifi-connman.o differ diff --git a/conf.d/app-templates b/conf.d/app-templates new file mode 160000 index 0000000..8967162 --- /dev/null +++ b/conf.d/app-templates @@ -0,0 +1 @@ +Subproject commit 8967162dd12bce89f9ae27f5c9bce7b78624e3fd diff --git a/conf.d/autobuild/agl/autobuild b/conf.d/autobuild/agl/autobuild new file mode 100755 index 0000000..759f6be --- /dev/null +++ b/conf.d/autobuild/agl/autobuild @@ -0,0 +1,60 @@ +#!/usr/bin/make -f +# Copyright (C) 2015, 2016 "IoT.bzh" +# Author "Romain Forlot" +# +# 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. + +THISFILE := $(lastword $(MAKEFILE_LIST)) +BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build) +DEST := ${BUILD_DIR}/target + +.PHONY: all clean distclean configure build package help + +all: help + +help: + @echo "List of targets available:" + @echo "" + @echo "- all" + @echo "- clean" + @echo "- distclean" + @echo "- configure" + @echo "- build" + @echo "- package" + @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" + +clean: + @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean + +distclean: + @rm -rf ${BUILD_DIR} + +configure: ${BUILD_DIR}/Makefile + +build: configure + @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all + +package: build + @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 + @cmake --build ${BUILD_DIR} --target widget + @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST} + +${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 new file mode 100755 index 0000000..759f6be --- /dev/null +++ b/conf.d/autobuild/linux/autobuild @@ -0,0 +1,60 @@ +#!/usr/bin/make -f +# Copyright (C) 2015, 2016 "IoT.bzh" +# Author "Romain Forlot" +# +# 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. + +THISFILE := $(lastword $(MAKEFILE_LIST)) +BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build) +DEST := ${BUILD_DIR}/target + +.PHONY: all clean distclean configure build package help + +all: help + +help: + @echo "List of targets available:" + @echo "" + @echo "- all" + @echo "- clean" + @echo "- distclean" + @echo "- configure" + @echo "- build" + @echo "- package" + @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" + +clean: + @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean + +distclean: + @rm -rf ${BUILD_DIR} + +configure: ${BUILD_DIR}/Makefile + +build: configure + @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all + +package: build + @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 + @cmake --build ${BUILD_DIR} --target widget + @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST} + +${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/cmake/config.cmake b/conf.d/cmake/config.cmake new file mode 100644 index 0000000..dae59cf --- /dev/null +++ b/conf.d/cmake/config.cmake @@ -0,0 +1,162 @@ +########################################################################### +# 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. +########################################################################### + +# Project Info +# ------------------ +set(PROJECT_NAME agl-service-wifi) +set(PROJECT_VERSION "1.0") +set(PROJECT_PRETTY_NAME "WiFi binding service") +set(PROJECT_DESCRIPTION "Expose WiFi Low Level APIs through AGL Framework") +set(PROJECT_ICON "icon.png") +set(PROJECT_AUTHOR "Tasuku Suzuki") +set(PROJECT_AUTHOR_MAIL "tasuku.suzuki@qt.io") +set(PROJECT_LICENSE "APL2.0") +set(PROJECT_LANGUAGES,"C") + +# Where are stored default templates files from submodule or subtree app-templates in your project tree +# relative to the root project directory +set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates") + +# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain +# but used and must be built and linked. +# set(PROJECT_LIBDIR "libs") + +# Where are stored data for your application. Pictures, static resources must be placed in that folder. +# set(PROJECT_RESOURCES "data") + +# Which directories inspect to find CMakeLists.txt target files +# set(PROJECT_SRC_DIR_PATTERN "*") + +# Compilation Mode (DEBUG, RELEASE) +# ---------------------------------- +set(CMAKE_BUILD_TYPE "DEBUG") + +# Kernel selection if needed. You can choose between a +# mandatory version to impose a minimal version. +# Or check Kernel minimal version and just print a Warning +# about missing features and define a preprocessor variable +# to be used as preprocessor condition in code to disable +# incompatibles features. Preprocessor define is named +# KERNEL_MINIMAL_VERSION_OK. +# +# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and +# Yocto SDK Kernel version. +# ----------------------------------------------- +#set(kernel_mandatory_version 4.8) + +# Compiler selection if needed. Impose a minimal version. +# ----------------------------------------------- +set (gcc_minimal_version 4.9) + +# PKG_CONFIG required packages +# ----------------------------- +set (PKG_REQUIRED_LIST + json-c + libsystemd>=222 + afb-daemon + json-c + glib-2.0 + gio-2.0 + gobject-2.0 + zlib +) + +# Static constante definition +# ----------------------------- +add_compile_options(-DPB_FIELD_16BIT) +add_compile_options($<$:-pthread>) + +# Customize link option +# ----------------------------- +list (APPEND link_libraries -pthread) + +# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable] +# --------------------------------------------------------------------- +set(CMAKE_INSTALL_PREFIX $ENV{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 location for config.xml.in +# ----------------------------------- +set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in) + +# Mandatory widget Mimetype specification of the main unit +# -------------------------------------------------------------------------- +# Choose between : +#- text/html : HTML application, +# content.src designates the home page of the application +# +#- application/vnd.agl.native : AGL compatible native, +# content.src designates the relative path of the binary. +# +# - application/vnd.agl.service: AGL service, content.src is not used. +# +#- ***application/x-executable***: Native application, +# content.src designates the relative path of the binary. +# For such application, only security setup is made. +# +set(WIDGET_TYPE application/vnd.agl.service) + +# Mandatory Widget entry point file of the main unit +# -------------------------------------------------------------- +# This is the file that will be executed, loaded, +# at launch time by the application framework. +# +set(WIDGET_ENTRY_POINT lib/libafm-wifi-binding.so) + +# Print a helper message when every thing is finished +# ---------------------------------------------------- +set(CLOSING_MESSAGE "Test with: afb-daemon --rootdir=\$\$(pwd)/package --binding=\$\$(pwd)/package/${WIDGET_ENTRY_POINT} --port=1234 --tracereq=common --token=\"1\" --verbose") +set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt") + + + +# 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 binding Linking flag +# ------------------------------------ +# set(BINDINGS_LINK_FLAG LinkOptions ) + +# Optional force package prefix generation, like widget +# ----------------------------------------------------- +# set(PKG_PREFIX DestinationPath) + +# Optional Application Framework security token +# and port use for remote debugging. +#------------------------------------------------------------ +#set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN") +#set(AFB_REMPORT "1234" CACHE PATH "Default AFB_TOKEN") + +# 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) diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in new file mode 100644 index 0000000..3fccb70 --- /dev/null +++ b/conf.d/wgt/config.xml.in @@ -0,0 +1,24 @@ + + + @PROJECT_NAME@ + + + @PROJECT_DESCRIPTION@ + @PROJECT_AUTHOR@ <@PROJECT_AUTHOR_MAIL@> + @PROJECT_LICENSE@ + + + + + + + + + + + + + + + + diff --git a/package/config.xml b/package/config.xml deleted file mode 100644 index 180efa5..0000000 --- a/package/config.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - agl-service-wifi - - - WiFi binding service - Tasuku Suzuki <tasuku.suzuki@qt.io> - APL2.0 - - - - - - - - - - - - diff --git a/package/icon.svg b/package/icon.svg deleted file mode 100644 index 6628784..0000000 --- a/package/icon.svg +++ /dev/null @@ -1,283 +0,0 @@ - - - -image/svg+xmlSETTINGS - \ No newline at end of file diff --git a/package/package.pro b/package/package.pro deleted file mode 100644 index 923bbee..0000000 --- a/package/package.pro +++ /dev/null @@ -1,21 +0,0 @@ - -DISTFILES = icon.svg config.xml - -!equals($$_PRO_FILE_PWD_, $$OUT_PWD) { - copy_icon.target = $$OUT_PWD/root/icon.svg - copy_icon.depends = $$_PRO_FILE_PWD_/icon.svg - copy_icon.commands = $(COPY_FILE) \"$$replace(copy_icon.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_icon.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_icon - PRE_TARGETDEPS += $$copy_icon.target - - copy_config.target = $$OUT_PWD/root/config.xml - copy_config.depends = $$_PRO_FILE_PWD_/config.xml - copy_config.commands = $(COPY_FILE) \"$$replace(copy_config.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_config.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_config - PRE_TARGETDEPS += $$copy_config.target -} - -wgt.target = package -wgt.commands = wgtpkg-pack -f -o agl-service-wifi.wgt root - -QMAKE_EXTRA_TARGETS += wgt -- cgit 1.2.3-korg