diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-23 12:13:01 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-23 20:54:23 +0200 |
commit | 6dddf0f9f5f6769db5b3cc41a5d74c371ff93bf9 (patch) | |
tree | 77e22c760e75dd8b7595670d3b81888ea4f15c77 | |
parent | 100657a2353329f19b8e7c584db3f418472f9959 (diff) |
Convert app-templates to a cmake module
- Changes PATH to find correctly all cmake files.
- Clean useless code now it's integrated as CMake module
- Clean variable usage
- Create module entry point
Bugs-AGL: SPEC-1682
Change-Id: I6943129677603b786c7144a92880d82795a916cd
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | CMakeAfbTemplates.cmake | 19 | ||||
-rw-r--r-- | CMakeLists.txt | 31 | ||||
-rw-r--r-- | cmake/cmake.d/01-build_options.cmake | 7 | ||||
-rw-r--r-- | cmake/cmake.d/02-variables.cmake | 27 | ||||
-rw-r--r-- | cmake/cmake.d/03-macros.cmake | 28 | ||||
-rw-r--r-- | cmake/cmake.d/04-extra_targets.cmake | 12 | ||||
-rw-r--r-- | cmake/common.cmake | 40 | ||||
-rw-r--r-- | samples.d/config.cmake.sample | 13 | ||||
-rw-r--r-- | test-wgt/launcher.sh.in (renamed from test-widget/launcher.sh.in) | 0 | ||||
-rw-r--r-- | test-wgt/test-config.xml.in (renamed from test-widget/test-config.xml.in) | 0 |
10 files changed, 105 insertions, 72 deletions
diff --git a/CMakeAfbTemplates.cmake b/CMakeAfbTemplates.cmake new file mode 100644 index 0000000..c52365b --- /dev/null +++ b/CMakeAfbTemplates.cmake @@ -0,0 +1,19 @@ +########################################################################### +# Copyright 2015 - 2018 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. +########################################################################### + +include("${CMAKE_CURRENT_LIST_DIR}/CMakeAfbTemplates/cmake/common.cmake") diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0034977 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +########################################################################### +# Copyright 2015 - 2018 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.6) + +include(GNUInstallDirs) + +if(DEFINED ENV{PKG_CONFIG_SYSROOT_DIR}) + set(CMAKE_DATADIR "cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}") +else() + set(CMAKE_DATADIR "cmake") +endif() + +INSTALL(FILES CMakeAfbTemplates.cmake DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_DATADIR}/Modules) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_DATADIR}/Modules/CMakeAfbTemplates + REGEX "(CMakeAfbTemplates.cmake|gendocs.sh|book.json|CMakeLists.txt|docs|.*\/\.git.*)" EXCLUDE) diff --git a/cmake/cmake.d/01-build_options.cmake b/cmake/cmake.d/01-build_options.cmake index 26b001d..c150d2a 100644 --- a/cmake/cmake.d/01-build_options.cmake +++ b/cmake/cmake.d/01-build_options.cmake @@ -1,8 +1,8 @@ ########################################################################### # Copyright 2015, 2016, 2017 IoT.bzh # -# author: Fulup Ar Foll <fulup@iot.bzh> -# contrib: Romain Forlot <romain.forlot@iot.bzh> +# authors: Fulup Ar Foll <fulup@iot.bzh> +# 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. @@ -132,8 +132,7 @@ ENDIF(${CMAKE_BUILD_TYPE} MATCHES COVERAGE) INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS}) # Default Linkflag -set(PKG_TEMPLATE_PREFIX "\"${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}\"" CACHE PATH "Default Package Templates Directory") -set(BARE_PKG_TEMPLATE_PREFIX "${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}" CACHE PATH "Default Package Templates Directory") +get_filename_component(PKG_TEMPLATE_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH CACHE) if(NOT BINDINGS_LINK_FLAG) set(BINDINGS_LINK_FLAG "-Wl,--version-script=${PKG_TEMPLATE_PREFIX}/cmake/export.map") diff --git a/cmake/cmake.d/02-variables.cmake b/cmake/cmake.d/02-variables.cmake index 693991a..857bd44 100644 --- a/cmake/cmake.d/02-variables.cmake +++ b/cmake/cmake.d/02-variables.cmake @@ -60,11 +60,7 @@ execute_process(COMMAND git describe --abbrev=0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_PROJECT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE -) -execute_process(COMMAND git describe --abbrev=0 - WORKING_DIRECTORY ${BARE_PKG_TEMPLATE_PREFIX} - OUTPUT_VARIABLE APP_TEMPLATES_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) # Get the git commit hash to append to the version @@ -72,6 +68,7 @@ execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) # Detect unstaged or untracked changes @@ -79,11 +76,14 @@ execute_process(COMMAND git status --short WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE DIRTY_FLAG OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) # Include project configuration # ------------------------------ -if(NOT DEFINED PROJECT_VERSION) +if(NOT DEFINED PROJECT_VERSION AND NOT DEFINED GIT_PROJECT_VERSION) + message(FATAL_ERROR "${Red}No version tag found from your project's source directory and no PROJECT_VERSION set in your config.cmake file. Abort!") +elseif(NOT DEFINED PROJECT_VERSION AND DEFINED GIT_PROJECT_VERSION) set(PROJECT_VERSION ${GIT_PROJECT_VERSION}) endif() @@ -139,10 +139,11 @@ else() set(PROJECT_PKG_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKGOUT_DIR} CACHE PATH "Application contents to be packaged") endif() +set(PROJECT_APP_TEMPLATES_DIR "${CMAKE_CURRENT_LIST_DIR}/../..") # Paths to templates files -set(TEMPLATE_DIR "${BARE_PKG_TEMPLATE_PREFIX}/template.d" CACHE PATH "Subpath to a directory where are stored needed files to launch on remote target to debuging purposes") +set(TEMPLATE_DIR "${PROJECT_APP_TEMPLATES_DIR}/template.d" CACHE PATH "Subpath to a directory where are stored needed files to launch on remote target to debuging purposes") -string(REGEX REPLACE "^(.*)/.*$" "\\1" ENTRY_POINT "${BARE_PKG_TEMPLATE_PREFIX}") +string(REGEX REPLACE "^(.*)/.*$" "\\1" ENTRY_POINT "${PROJECT_CMAKE_CONF_DIR}") set(PROJECT_PKG_ENTRY_POINT ${ENTRY_POINT}/packaging CACHE PATH "Where package build files, like rpm.spec file or config.xml, are write.") set(WIDGET_ICON "${ENTRY_POINT}/wgt/${PROJECT_ICON}" CACHE PATH "Path to the widget icon") @@ -151,14 +152,8 @@ if(NOT WIDGET_CONFIG_TEMPLATE) endif() # Path to autobuild template -set(PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR ${CMAKE_SOURCE_DIR}/conf.d/autobuild/agl CACHE PATH "Subpath to a directory where are stored autobuild script") -set(PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR ${CMAKE_SOURCE_DIR}/conf.d/autobuild/linux CACHE PATH "Subpath to a directory where are stored autobuild script") - -# Archive target variables -set(ARCHIVE_OUTPUT_ARCHIVE ${PROJECT_PKG_ENTRY_POINT}/${NPKG_PROJECT_NAME}_${PROJECT_VERSION}.orig.tar) -set(ARCHIVE_OUTPUT ${ARCHIVE_OUTPUT_ARCHIVE}.gz) -set(TMP_ARCHIVE_SUBMODULE ${PROJECT_PKG_ENTRY_POINT}/${NPKG_PROJECT_NAME}-sub) -set(CMD_ARCHIVE_SUBMODULE \'git archive --verbose --prefix=${NPKG_PROJECT_NAME}-${PROJECT_VERSION}/$$path/ --format tar HEAD --output ${TMP_ARCHIVE_SUBMODULE}-$$sha1.tar\' ) +set(PROJECT_AGL_AUTOBUILD_DIR ${CMAKE_SOURCE_DIR}/conf.d/autobuild/agl CACHE PATH "Subpath to a directory where are stored autobuild script") +set(PROJECT_LINUX_AUTOBUILD_DIR ${CMAKE_SOURCE_DIR}/conf.d/autobuild/linux CACHE PATH "Subpath to a directory where are stored autobuild script") if(OSRELEASE MATCHES "debian" AND NOT DEFINED ENV{SDKTARGETSYSROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) # build deb spec file from template diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake index 4cd34e4..bb5e2b5 100644 --- a/cmake/cmake.d/03-macros.cmake +++ b/cmake/cmake.d/03-macros.cmake @@ -491,7 +491,7 @@ macro(wgt_package_build) elseif(EXISTS "${WIDGET_ICON}") set(ICON_PATH "${WIDGET_ICON}") else() - set(ICON_PATH ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/wgt/icon-default.png) + set(ICON_PATH ${PROJECT_APP_TEMPLATES_DIR}/wgt/icon-default.png) endif() if(NOT WIDGET_ENTRY_POINT) @@ -525,14 +525,14 @@ macro(wgt_package_build) 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 ${CMAKE_COMMAND} -DINFILE=${WIDGET_CONFIG_TEMPLATE} -DOUTFILE=${PROJECT_PKG_BUILD_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${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 ${CMAKE_COMMAND} -DINFILE=${PROJECT_APP_TEMPLATES_DIR}/test-wgt/test-config.xml.in -DOUTFILE=${PROJECT_PKG_TEST_DIR}/config.xml -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${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 + COMMAND cp ${PROJECT_APP_TEMPLATES_DIR}/test-wgt/launcher.sh.in ${PROJECT_PKG_TEST_DIR}/bin/launcher ) add_custom_command(OUTPUT ${WGT_NAME}.wgt @@ -634,23 +634,3 @@ macro(project_closing_msg) ${PROJECT_TARGETS} populate) endif() endmacro() - -macro(check_version) - if(GIT_PROJECT_VERSION) - if(${GIT_PROJECT_VERSION} VERSION_GREATER ${APP_TEMPLATES_VERSION}) - message(STATUS "${Yellow}.. Your app-templates submodule version seems outdated. You should update it with 'git submodule update --remote ${PROJECT_APP_TEMPLATES_DIR}'. - - App-templates version: ${APP_TEMPLATES_VERSION} - - Project version according AGL Git tag: ${GIT_PROJECT_VERSION}" - ) - endif() - elseif(PROJECT_VERSION) - if(${PROJECT_VERSION} VERSION_GREATER ${APP_TEMPLATES_VERSION}) - message(STATUS "${Yellow}.. Your app-templates submodule version seems outdated. You should update it with 'git submodule update --remote ${PROJECT_APP_TEMPLATES_DIR}'. - - App-templates version: ${APP_TEMPLATES_VERSION} - - Project version according AGL Git tag: ${PROJECT_VERSION}" - ) - endif() - else() - message(STATUS "${Yellow} Your git project repo doesn't have any version tags nor hosted by AGL gerrit infrastructure. Can't compare version between project and app-templates ${APP_TEMPLATES_VERSION} ${ColourReset}") - endif() -endmacro() diff --git a/cmake/cmake.d/04-extra_targets.cmake b/cmake/cmake.d/04-extra_targets.cmake index d1b446c..3b94b8c 100644 --- a/cmake/cmake.d/04-extra_targets.cmake +++ b/cmake/cmake.d/04-extra_targets.cmake @@ -45,12 +45,12 @@ endforeach() # Autobuild target # ---------------------------------------------------------------------------- -add_custom_command(OUTPUT ${PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR}/autobuild ${PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR}/autobuild - DEPENDS ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in - ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/linux/autobuild.in +add_custom_command(OUTPUT ${PROJECT_AGL_AUTOBUILD_DIR}/autobuild ${PROJECT_LINUX_AUTOBUILD_DIR}/autobuild + DEPENDS ${TEMPLATE_DIR}/autobuild/agl/autobuild.in + ${TEMPLATE_DIR}/autobuild/linux/autobuild.in - COMMAND [ ! -f "${PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR}/autobuild" ] && ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake || exit 0 - COMMAND [ ! -f "${PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR}/autobuild" ] && ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake || exit 0 + COMMAND [ ! -f "${PROJECT_AGL_AUTOBUILD_DIR}/autobuild" ] && ${CMAKE_COMMAND} -DINFILE=${TEMPLATE_DIR}/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_AGL_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake && chmod a+x ${PROJECT_AGL_AUTOBUILD_DIR}/autobuild || exit 0 + COMMAND [ ! -f "${PROJECT_LINUX_AUTOBUILD_DIR}/autobuild" ] && ${CMAKE_COMMAND} -DINFILE=${TEMPLATE_DIR}/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_LINUX_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake && chmod a+x ${PROJECT_LINUX_AUTOBUILD_DIR}/autobuild || exit 0 ) -add_custom_target(autobuild ALL DEPENDS ${PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR}/autobuild ${PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR}/autobuild) +add_custom_target(autobuild ALL DEPENDS ${PROJECT_AGL_AUTOBUILD_DIR}/autobuild ${PROJECT_LINUX_AUTOBUILD_DIR}/autobuild) diff --git a/cmake/common.cmake b/cmake/common.cmake index f553ae0..6e43d13 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -1,5 +1,5 @@ ########################################################################### -# Copyright 2015, 2016, 2017 IoT.bzh +# Copyright 2015 - 2018 IoT.bzh # # author: Fulup Ar Foll <fulup@iot.bzh> # contrib: Romain Forlot <romain.forlot@iot.bzh> @@ -25,7 +25,7 @@ #-------------------------------------------------------------------------- # Include ExternalProject CMake module by default -include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) +include(ExternalProject) if(DEFINED ENV{SDKTARGETSYSROOT}) file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE") @@ -57,31 +57,48 @@ elseif("${BUILD_ENV_SYSROOT}" STREQUAL "$ENV{PKG_CONFIG_SYSROOT_DIR}") else() set(OSRELEASE "NOT COMPATIBLE ! Missing ${OS_RELEASE_PATH} file.") endif() -message(STATUS "Distribution detected (separated by ';' choose one of them) ${OSRELEASE}") +message("Distribution detected (separated by ';' choose one of them) ${OSRELEASE}") -file(GLOB project_cmakefiles ${PROJECT_APP_TEMPLATES_DIR}/cmake/cmake.d/[0-9][0-9]-*.cmake) +# Include CMake modules core files +file(GLOB project_cmakefiles ${CMAKE_CURRENT_LIST_DIR}/cmake.d/[0-9][0-9]-*.cmake) + +# Include optionnal user defined OS relative CMake files foreach(OS IN LISTS OSRELEASE) - list(APPEND PATTERN "${PROJECT_APP_TEMPLATES_DIR}/../cmake/[0-9][0-9]-${OS}*.cmake") + list(APPEND PATTERN "${CMAKE_SOURCE_DIR}/${PROJECT_CMAKE_CONF_DIR}/cmake/[0-9][0-9]-${OS}*.cmake" + "${CMAKE_SOURCE_DIR}/${PROJECT_CMAKE_CONF_DIR}/cmake.d/[0-9][0-9]-${OS}*.cmake") endforeach() -list(APPEND PATTERN "${PROJECT_APP_TEMPLATES_DIR}/../cmake/[0-9][0-9]-common*.cmake") +list(APPEND PATTERN "${PROJECT_CMAKE_CONF_DIR}/../cmake/[0-9][0-9]-common*.cmake" + "${PROJECT_CMAKE_CONF_DIR}/../cmake.d/[0-9][0-9]-common*.cmake") file(GLOB distro_cmakefiles ${PATTERN}) list(SORT distro_cmakefiles) if(NOT distro_cmakefiles) - file(GLOB distro_cmakefiles ${PROJECT_APP_TEMPLATES_DIR}/../cmake/[0-9][0-9]-default*.cmake) + file(GLOB distro_cmakefiles ${CMAKE_SOURCE_DIR}/${PROJECT_CMAKE_CONF_DIR}/cmake/[0-9][0-9]-default*.cmake + ${CMAKE_SOURCE_DIR}/${PROJECT_CMAKE_CONF_DIR}/cmake.d/[0-9][0-9]-default*.cmake) endif() list(APPEND project_cmakefiles "${distro_cmakefiles}") list(SORT project_cmakefiles) -file(GLOB home_cmakefiles $ENV{HOME}/.config/app-templates/cmake.d/[0-9][0-9]-common*.cmake $ENV{HOME}/.config/app-templates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake) +file(GLOB home_cmakefiles $ENV{HOME}/.config/app-templates/cmake.d/[0-9][0-9]-common*.cmake + $ENV{HOME}/.config/app-templates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake + $ENV{HOME}/.config/cmake-apps-module/cmake.d/[0-9][0-9]-common*.cmake + $ENV{HOME}/.config/cmake-apps-module/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake + $ENV{HOME}/.config/CMakeAfbTemplates/cmake.d/[0-9][0-9]-common*.cmake + $ENV{HOME}/.config/CMakeAfbTemplates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake) list(SORT home_cmakefiles) -file(GLOB system_cmakefiles /etc/app-templates/cmake.d/[0-9][0-9]-common*.cmake /etc/app-templates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake) + +file(GLOB system_cmakefiles /etc/app-templates/cmake.d/[0-9][0-9]-common*.cmake + /etc/app-templates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake + /etc/cmake-apps-module/cmake.d/[0-9][0-9]-common*.cmake + /etc/cmake-apps-module/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake + /etc/CMakeAfbTemplates/cmake.d/[0-9][0-9]-common*.cmake + /etc/CMakeAfbTemplates/cmake.d/[0-9][0-9]-${PROJECT_NAME}*.cmake) list(SORT system_cmakefiles) foreach(file ${system_cmakefiles} ${home_cmakefiles} ${project_cmakefiles}) - message(STATUS "Include: ${file}") + message("Include: ${file}") include(${file}) endforeach() @@ -94,11 +111,10 @@ else() project_subdirs_add() endif(DEFINED PROJECT_SRC_DIR_PATTERN) -configure_files_in_dir(${PROJECT_APP_TEMPLATES_DIR}/${ENTRY_POINT}/template.d) +configure_files_in_dir(${CMAKE_SOURCE_DIR}/${PROJECT_CMAKE_CONF_DIR}/template.d) configure_files_in_dir($ENV{HOME}/.config/app-templates/scripts) configure_files_in_dir(/etc/app-templates/scripts) -check_version() project_targets_populate() remote_targets_populate() project_package_build() diff --git a/samples.d/config.cmake.sample b/samples.d/config.cmake.sample index 999208a..5b75557 100644 --- a/samples.d/config.cmake.sample +++ b/samples.d/config.cmake.sample @@ -22,21 +22,17 @@ set(PROJECT_NAME example) set(API_NAME api-test) set(PROJECT_PRETTY_NAME "Example") set(PROJECT_DESCRIPTION "AGL application example") -set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/apps/app-templates") +set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/apps/cmake-apps-module") set(PROJECT_ICON "icon.png") set(PROJECT_AUTHOR "Last Name, First Name") set(PROJECT_AUTHOR_MAIL "example.man@bigouden.bzh") 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") - # Which directories inspect to find CMakeLists.txt target files # set(PROJECT_SRC_DIR_PATTERN "*") -# Compilation Mode (DEBUG, RELEASE) +# Compilation Mode (DEBUG, RELEASE, COVERAGE or PROFILING) # ---------------------------------- #set(BUILD_TYPE "DEBUG") #set(USE_EFENCE 1) @@ -200,7 +196,4 @@ set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install #set(XML_CHECKER "xmllint" CACHE STRING "XML linter") #set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter") -# 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) +include(CMakeAfbTemplates) diff --git a/test-widget/launcher.sh.in b/test-wgt/launcher.sh.in index 005c433..005c433 100644 --- a/test-widget/launcher.sh.in +++ b/test-wgt/launcher.sh.in diff --git a/test-widget/test-config.xml.in b/test-wgt/test-config.xml.in index b39d88e..b39d88e 100644 --- a/test-widget/test-config.xml.in +++ b/test-wgt/test-config.xml.in |