From 6b250497f27c37cae1d005f06158146e47ec8800 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Sun, 15 Dec 2019 13:18:47 -0500 Subject: Updates to fix building with SDK and remove submodule usage Update the autobuild script and CMake files to work with the SDK, and remove now deprecated usage of the app-templates submodule. Bug-AGL: SPEC-3055 Change-Id: Ib01f46fa510df2614021a8f256ab09fdcff8871a Signed-off-by: Scott Murray --- .gitignore | 1 + .gitmodules | 3 -- app/CMakeLists.txt | 5 +++- autobuild/agl/autobuild | 71 +++++++++++++++++++++++++++++++++++++---------- conf.d/app-templates | 1 - conf.d/cmake/config.cmake | 37 ++++++++++++------------ 6 files changed, 81 insertions(+), 37 deletions(-) delete mode 100644 .gitmodules delete mode 160000 conf.d/app-templates diff --git a/.gitignore b/.gitignore index b25c15b..5975d97 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *~ +build/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index b545da1..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "conf.d/app-templates"] - path = conf.d/app-templates - url = https://gerrit.automotivelinux.org/gerrit/apps/app-templates diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 07c60c4..9547426 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,5 +1,5 @@ ########################################################################### -# Copyright 2018 Konsulko Group +# Copyright 2018,2019 Konsulko Group # # Author: Scott Murray # @@ -18,7 +18,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS $ENV{OE_QMAKE_PATH_HOST_BINS}) find_package(Qt5 COMPONENTS Core Gui QuickControls2 WebSockets QuickWidgets REQUIRED) find_package(PkgConfig REQUIRED) diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild index 883293d..b306eb0 100755 --- a/autobuild/agl/autobuild +++ b/autobuild/agl/autobuild @@ -1,22 +1,65 @@ -#!/bin/bash +#!/usr/bin/make -f +# Copyright (C) 2015 - 2018 "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. -SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../../" -BUILD_DIR=$( echo "$2" | cut -d'=' -f2 ) +THISFILE := $(lastword $(MAKEFILE_LIST)) +BUILD_DIR := $(abspath $(dir $(THISFILE))/../../build) +DEST := ${BUILD_DIR} -# HACK: alias should be expanded in script for cmake to work properly -shopt -s expand_aliases -# HACK: source again the SDK because of the alias -source $SDKTARGETSYSROOT/../../environment-setup-* +.PHONY: all clean distclean configure build package help update -pushd $BUILD_DIR +all: help - cmake $SOURCE_DIR - make +help: + @echo "List of targets available:" + @echo "" + @echo "- all" + @echo "- clean" + @echo "- distclean" + @echo "- configure" + @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: ./autobuild/agl/autobuild package DEST=${HOME}/opt" + @echo "Don't use your build dir as DEST as wgt file is generated at this location" - if [ "$1" == "package" ]; then - make widget - cp *.wgt package/ +clean: + @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} ${CLEAN_ARGS} clean) || echo Nothing to clean + +distclean: + @rm -rf ${BUILD_DIR} + +configure: + @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} + @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..) + +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}/$@/var + @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target widget + @if [ "${DEST}" != "${BUILD_DIR}" ]; then \ + mkdir -p ${DEST} && cp ${BUILD_DIR}/*.wgt ${DEST}; \ fi -popd +install: build + @cmake --build ${BUILD_DIR} ${INSTALL_ARGS} --target install diff --git a/conf.d/app-templates b/conf.d/app-templates deleted file mode 160000 index 7ba3013..0000000 --- a/conf.d/app-templates +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7ba30135732fc49bfadd5866c08be7080c9f3937 diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index d47faa4..11f2477 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -1,6 +1,6 @@ ########################################################################### -# Copyright 2015, 2016, 2017 IoT.bzh -# Copyright 2018 Konsulko Group +# Copyright 2015-2018 IoT.bzh +# Copyright 2019 Konsulko Group # # author: Fulup Ar Foll # cluster-gauges: Scott Murray @@ -23,7 +23,7 @@ set(PROJECT_NAME cluster-gauges) set(PROJECT_PRETTY_NAME "Cluster Gauges Demo") set(PROJECT_DESCRIPTION "Cluster gauges demo application") -set(PROJECT_URL "https://github.com/konsulko/cluster-gauges") +set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/apps/agl-cluster-demo-dashboard") set(PROJECT_VERSION "1.0") set(PROJECT_ICON "icon.png") set(PROJECT_AUTHOR "Scott Murray") @@ -31,9 +31,9 @@ set(PROJECT_AUTHOR_MAIL "scott.murray@konsulko.com") set(PROJECT_LICENSE "APL2.0") set(PROJECT_LANGUAGES "CXX") -# Where are stored default templates files from submodule or subtree app-templates in your project tree +# Where are stored the project configuration files # relative to the root project directory -set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates") +set(PROJECT_CMAKE_CONF_DIR "conf.d") # 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. @@ -44,10 +44,8 @@ set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates") # Compilation Mode (DEBUG, RELEASE) # ---------------------------------- -#set(BUILD_TYPE "DEBUG") -set(BUILD_TYPE "RELEASE") - -#set(USE_EFENCE 1) +#set(CMAKE_BUILD_TYPE "DEBUG") +set(USE_EFENCE 1) # Kernel selection if needed. You can choose between a # mandatory version to impose a minimal version. @@ -74,14 +72,10 @@ set (PKG_REQUIRED_LIST afb-daemon ) -# You can also consider to include libsystemd -# ----------------------------------- -#list (APPEND PKG_REQUIRED_LIST libsystemd>=222) - # Prefix path where will be installed the files # Default: /usr/local (need root permission to write in) # ------------------------------------------------------ -#set(INSTALL_PREFIX /opt/AGL CACHE PATH "INSTALL PREFIX PATH") +#set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt) # Customize link option # ----------------------------- @@ -117,7 +111,7 @@ set (PKG_REQUIRED_LIST #set(DEBUG_COMPILE_OPTIONS # -g # -ggdb -# -D_FORTIFY_SOURCE=2 +# -Wp,-U_FORTIFY_SOURCE # CACHE STRING "Compilation flags for DEBUG build type.") #set(CCOV_COMPILE_OPTIONS # -g @@ -127,9 +121,13 @@ set (PKG_REQUIRED_LIST #set(RELEASE_COMPILE_OPTIONS # -g # -O2 -# -D_FORTIFY_SOURCE=2 # CACHE STRING "Compilation flags for RELEASE build type.") +# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable] +# --------------------------------------------------------------------- +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_ICON "\"conf.d/wgt/${PROJECT_ICON}\"" CACHE PATH "Path to the widget icon") @@ -187,7 +185,7 @@ set(AFB_REMPORT "1234" CACHE PATH "Default binder listening port") # Print a helper message when every thing is finished # ---------------------------------------------------- -#set(CLOSING_MESSAGE "Typical binding launch: cd ${CMAKE_BINARY_DIR}/package && afb-daemon --port=${AFB_REMPORT} --workdir=. --ldpaths=lib --roothttp=htdocs --token=\"${AFB_TOKEN}\" --tracereq=common --verbose") +set(CLOSING_MESSAGE "Typical binding launch: afb-daemon --port=${AFB_REMPORT} --workdir=${CMAKE_BINARY_DIR}/package --ldpaths=lib --roothttp=htdocs --token=\"${AFB_TOKEN}\" --tracereq=common --verbose") set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt") # Optional schema validator about now only XML, LUA and JSON @@ -199,5 +197,8 @@ set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install # This include is mandatory and MUST happens at the end # of this file, else you expose you to unexpected behavior +# +# This CMake module could be found at the following url: +# https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/cmake-apps-module # ----------------------------------------------------------- -include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake) +include(CMakeAfbTemplates) -- cgit 1.2.3-korg