diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-08-18 20:22:06 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-08-21 22:23:55 +0200 |
commit | 4d67d060455919313491e904d32eb53b303dc21c (patch) | |
tree | d3560b20a516a5b9956e0382c5b2e7657872cca7 | |
parent | 3a90fb6f2c4518ebab484cde90919c19456dc04c (diff) |
Better OS detection and inclusion per distribution
Change-Id: I6f479353df990eb2ff9030b7427d48bb72f0416f
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | cmake/cmake.d/02-variables.cmake | 9 | ||||
-rw-r--r-- | cmake/common.cmake | 12 | ||||
-rwxr-xr-x | template.d/autobuild/agl/autobuild.in | 5 | ||||
-rwxr-xr-x | template.d/autobuild/linux/autobuild.in | 5 |
4 files changed, 23 insertions, 8 deletions
diff --git a/cmake/cmake.d/02-variables.cmake b/cmake/cmake.d/02-variables.cmake index dd86d2b..ec6510f 100644 --- a/cmake/cmake.d/02-variables.cmake +++ b/cmake/cmake.d/02-variables.cmake @@ -54,14 +54,15 @@ if(EXISTS "/etc/os-release") execute_process(COMMAND grep -E "^ID(=|_LIKE=)" /etc/os-release OUTPUT_VARIABLE TMP_OSRELEASE ) + if (NOT TMP_OSRELEASE STREQUAL "") - string(REGEX REPLACE ".*=" "" OSRELEASE ${TMP_OSRELEASE}) + string(REGEX REPLACE ".*=([0-9a-z._-]*)\n" "\\1" OSRELEASE ${TMP_OSRELEASE}) else() - set(OSRELEASE "NOT DEBIAN OS") + set(OSRELEASE "NO COMPATIBLE !") endif() - message(STATUS "OSRELEASE = ${OSRELEASE}") + message(STATUS "Distribution used ${OSRELEASE}") else() - set(OSRELEASE "NOT DEBIAN OS") + set(OSRELEASE "NO COMPATIBLE !") endif() if(DEFINED ENV{SDKTARGETSYSROOT}) diff --git a/cmake/common.cmake b/cmake/common.cmake index ed13ccc..06d04c6 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -26,9 +26,9 @@ file(GLOB project_cmakefiles ${PROJECT_APP_TEMPLATES_DIR}/cmake/cmake.d/[0-9][0-9]-*.cmake) 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) 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) list(SORT system_cmakefiles) foreach(file ${system_cmakefiles} ${home_cmakefiles} ${project_cmakefiles}) @@ -36,6 +36,14 @@ foreach(file ${system_cmakefiles} ${home_cmakefiles} ${project_cmakefiles}) include(${file}) endforeach() +message(STATUS "${ENTRY_POINT}/cmake/[0-9][0-9]-${OSRELEASE}*.cmake") +file(GLOB project_cmakefiles ${ENTRY_POINT}/cmake/[0-9][0-9]-common*.cmake ${ENTRY_POINT}/cmake/[0-9][0-9]-${OSRELEASE}*.cmake ) +list(SORT project_cmakefiles) +foreach(file ${project_cmakefiles}) + message(STATUS "Include: ${file}") + include(${file}) +endforeach() + if(DEFINED PROJECT_SRC_DIR_PATTERN) project_subdirs_add(${PROJECT_SRC_DIR_PATTERN}) else() diff --git a/template.d/autobuild/agl/autobuild.in b/template.d/autobuild/agl/autobuild.in index 759f6be..4811441 100755 --- a/template.d/autobuild/agl/autobuild.in +++ b/template.d/autobuild/agl/autobuild.in @@ -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 @@ -35,6 +35,9 @@ help: @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 diff --git a/template.d/autobuild/linux/autobuild.in b/template.d/autobuild/linux/autobuild.in index ed39429..0b6f06c 100755 --- a/template.d/autobuild/linux/autobuild.in +++ b/template.d/autobuild/linux/autobuild.in @@ -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 @@ -35,6 +35,9 @@ help: @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 |