From f0b24b0809e1677665760d4341a4169d519079bc Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 13 Aug 2018 14:42:49 +0200 Subject: Rollback about TEST build type This implies to much side effects over a complete AGL image build. So it's better to not affect the CMAKE_BUILD_TYPE variable to determine wether or not the test WGT file is generated. Change-Id: I77e8bdb085d164a4dd387ac48c425c011840473b Signed-off-by: Romain Forlot --- cmake/cmake.d/01-build_options.cmake | 7 +++--- cmake/cmake.d/03-macros.cmake | 43 ++++++++++++++++++------------------ test-widget/launcher.sh.in | 4 ++-- test-widget/test-config.xml.in | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cmake/cmake.d/01-build_options.cmake b/cmake/cmake.d/01-build_options.cmake index 72a3161..28a4ff1 100644 --- a/cmake/cmake.d/01-build_options.cmake +++ b/cmake/cmake.d/01-build_options.cmake @@ -39,6 +39,9 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "the type of build" FORCE) endif() endif() +if(NOT DEFINED BUILD_TEST_WGT) + set(BUILD_TEST_WGT FALSE) +endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMP0048 1) @@ -87,7 +90,6 @@ endforeach() ################################################## set(PROFILING_COMPILE_OPTIONS -g -O0 -pg -Wp,-U_FORTIFY_SOURCE CACHE STRING "Compilation flags for PROFILING build type.") set(DEBUG_COMPILE_OPTIONS -g -ggdb CACHE STRING "Compilation flags for DEBUG build type.") -set(TEST_COMPILE_OPTIONS -g -ggdb CACHE STRING "Compilation flags for TEST build type.") set(COVERAGE_COMPILE_OPTIONS -g --coverage CACHE STRING "Compilation flags for COVERAGE build type.") set(RELEASE_COMPILE_OPTIONS -O2 -D_FORTIFY_SOURCE=2 CACHE STRING "Compilation flags for RELEASE build type.") foreach(option ${PROFILING_COMPILE_OPTIONS}) @@ -96,9 +98,6 @@ endforeach() foreach(option ${DEBUG_COMPILE_OPTIONS}) add_compile_options($<$:${option}>) endforeach() -foreach(option ${TEST_COMPILE_OPTIONS}) - add_compile_options($<$:${option}>) -endforeach() foreach(option ${COVERAGE_COMPILE_OPTIONS}) add_compile_options($<$:${option}>) endforeach() diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake index 6dd9d0a..4cd34e4 100644 --- a/cmake/cmake.d/03-macros.cmake +++ b/cmake/cmake.d/03-macros.cmake @@ -299,7 +299,7 @@ macro(project_targets_populate) set(PACKAGE_TEST_HTTPDIR ${PROJECT_PKG_TEST_DIR}/${HTTPDIR}) set(PACKAGE_TEST_DATADIR ${PROJECT_PKG_TEST_DIR}/${DATADIR}) - if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") + if(${BUILD_TEST_WGT}) add_custom_command(OUTPUT ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} ${PACKAGE_TEST_BINDIR} ${PACKAGE_TEST_ETCDIR} ${PACKAGE_TEST_LIBDIR} ${PACKAGE_TEST_HTTPDIR} ${PACKAGE_TEST_DATADIR} COMMAND mkdir -p ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} COMMAND mkdir -p ${PACKAGE_TEST_BINDIR} ${PACKAGE_TEST_ETCDIR} ${PACKAGE_TEST_LIBDIR} ${PACKAGE_TEST_HTTPDIR} ${PACKAGE_TEST_DATADIR}) @@ -356,7 +356,7 @@ macro(project_targets_populate) set(S ".ctlso") endif() generate_one_populate_target(${P}${OUT}${S} "${PACKAGE_LIBDIR}/plugins") - elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-PLUGIN") + elseif(${T} STREQUAL "TEST-PLUGIN") if(NOT S) set(S ".ctlso") endif() @@ -389,7 +389,7 @@ macro(project_targets_populate) else() generate_one_populate_target(${P}${OUT}${S} ${PACKAGE_BINDIR}) endif() - elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-EXECUTABLE") + elseif(${T} STREQUAL "TEST-EXECUTABLE") if(NOT S) set(S "") endif() @@ -401,18 +401,18 @@ macro(project_targets_populate) endif() elseif(${T} STREQUAL "HTDOCS") generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR}) - elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-HTDOCS") + elseif(${T} STREQUAL "TEST-HTDOCS") generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR}) elseif(${T} STREQUAL "DATA" ) generate_one_populate_target(${TARGET} ${PACKAGE_DATADIR}) - elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-DATA") + elseif(${T} STREQUAL "TEST-DATA") generate_one_populate_target(${TARGET} ${PACKAGE_TEST_DATADIR}) elseif(${T} STREQUAL "BINDING-CONFIG" ) generate_one_populate_target(${TARGET} ${PACKAGE_ETCDIR}) - elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-CONFIG") + elseif(${T} STREQUAL "TEST-CONFIG") generate_one_populate_target(${TARGET} ${PACKAGE_TEST_ETCDIR}) endif() - elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]") + elseif("${CMAKE_BUILD_TYPE}" MATCHES "[Dd][Ee][Bb][Uu][Gg]") MESSAGE("${Yellow}.. Warning: ${TARGET} ignored when packaging.${ColourReset}") endif() endforeach() @@ -498,22 +498,10 @@ macro(wgt_package_build) set(WIDGET_ENTRY_POINT lib) endif() - add_custom_command(OUTPUT ${PROJECT_PKG_BUILD_DIR}/config.xml - COMMAND ${CMAKE_COMMAND} -DINFILE=${WIDGET_CONFIG_TEMPLATE} -DOUTFILE=${PROJECT_PKG_BUILD_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake - COMMAND cp ${ICON_PATH} ${PROJECT_PKG_BUILD_DIR}/${PROJECT_ICON} - ) - add_custom_command(OUTPUT ${PROJECT_PKG_TEST_DIR}/test-config.xml ${PROJECT_PKG_TEST_DIR}/bin/launcher - COMMAND ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/test-widget/test-config.xml.in -DOUTFILE=${PROJECT_PKG_TEST_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake - COMMAND cp ${ICON_PATH} ${PROJECT_PKG_TEST_DIR}/${PROJECT_ICON} - COMMAND cp ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}//test-widget/launcher.sh.in ${PROJECT_PKG_TEST_DIR}/bin/launcher - ) - - if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") + if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE") string(TOLOWER "${PROJECT_NAME}-${CMAKE_BUILD_TYPE}" WGT_NAME) - add_custom_target(packaging_wgt DEPENDS ${PROJECT_PKG_BUILD_DIR}/config.xml ${PROJECT_PKG_TEST_DIR}/test-config.xml ${PROJECT_PKG_TEST_DIR}/bin/launcher) else() string(TOLOWER "${PROJECT_NAME}" WGT_NAME) - add_custom_target(packaging_wgt DEPENDS ${PROJECT_PKG_BUILD_DIR}/config.xml) endif() # Fulup ??? copy any extra file in wgt/etc into populate package before building the widget @@ -536,6 +524,17 @@ macro(wgt_package_build) endif() endif() + add_custom_command(OUTPUT ${PROJECT_PKG_BUILD_DIR}/config.xml + COMMAND ${CMAKE_COMMAND} -DINFILE=${WIDGET_CONFIG_TEMPLATE} -DOUTFILE=${PROJECT_PKG_BUILD_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake + COMMAND cp ${ICON_PATH} ${PROJECT_PKG_BUILD_DIR}/${PROJECT_ICON} + ) + add_custom_command(OUTPUT ${PROJECT_PKG_TEST_DIR}/test-config.xml ${PROJECT_PKG_TEST_DIR}/bin/launcher + COMMAND ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/test-widget/test-config.xml.in -DOUTFILE=${PROJECT_PKG_TEST_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake + COMMAND mkdir -p ${PROJECT_PKG_TEST_DIR}/bin + COMMAND cp ${ICON_PATH} ${PROJECT_PKG_TEST_DIR}/${PROJECT_ICON} + COMMAND cp ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/test-widget/launcher.sh.in ${PROJECT_PKG_TEST_DIR}/bin/launcher + ) + add_custom_command(OUTPUT ${WGT_NAME}.wgt DEPENDS ${PROJECT_TARGETS} COMMAND ${packCMD} @@ -546,10 +545,12 @@ macro(wgt_package_build) COMMAND ${packCMDTest} ) - if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") + if(${BUILD_TEST_WGT}) + add_custom_target(packaging_wgt DEPENDS ${PROJECT_PKG_BUILD_DIR}/config.xml ${PROJECT_PKG_TEST_DIR}/test-config.xml ${PROJECT_PKG_TEST_DIR}/bin/launcher) add_custom_target(widget DEPENDS ${WGT_NAME}.wgt ${WGT_NAME}-test.wgt) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${WGT_NAME}-test.wgt") else() + add_custom_target(packaging_wgt DEPENDS ${PROJECT_PKG_BUILD_DIR}/config.xml) add_custom_target(widget DEPENDS ${WGT_NAME}.wgt) endif() diff --git a/test-widget/launcher.sh.in b/test-widget/launcher.sh.in index 601e88a..be46192 100644 --- a/test-widget/launcher.sh.in +++ b/test-widget/launcher.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash ########################################################################### # Copyright (C) 2017, 2018 IoT.bzh @@ -22,7 +22,7 @@ PORT=$1 TOKEN=$2 # Research the Api name used -CFGFILE=$(find ${AFM_APP_INSTALL_DIR} -name "*json" -print0 | head -n1) +CFGFILE=$(find ${AFM_APP_INSTALL_DIR} -name "*json" -print | head -n1) API=$(grep '\"api\"' ${CFGFILE} | cut -d'"' -f4) AFBCLIENTIN=$(mktemp -u) diff --git a/test-widget/test-config.xml.in b/test-widget/test-config.xml.in index 3252c4b..b39d88e 100644 --- a/test-widget/test-config.xml.in +++ b/test-widget/test-config.xml.in @@ -8,7 +8,7 @@ APL2.0 - + -- cgit 1.2.3-korg