Fix finding config template
[apps/app-templates.git] / cmake / cmake.d / 02-variables.cmake
index 54a362d..e90ff11 100644 (file)
 
 # Get colorized message output non Windows OS. You know bash ? :)
 if(NOT WIN32)
-  string(ASCII 27 Esc)
-  set(ColourReset "${Esc}[m")
-  set(ColourBold  "${Esc}[1m")
-  set(Red         "${Esc}[31m")
-  set(Green       "${Esc}[32m")
-  set(Yellow      "${Esc}[33m")
-  set(Blue        "${Esc}[34m")
-  set(Magenta     "${Esc}[35m")
-  set(Cyan        "${Esc}[36m")
-  set(White       "${Esc}[37m")
-  set(BoldRed     "${Esc}[1;31m")
-  set(BoldGreen   "${Esc}[1;32m")
-  set(BoldYellow  "${Esc}[1;33m")
-  set(BoldBlue    "${Esc}[1;34m")
-  set(BoldMagenta "${Esc}[1;35m")
-  set(BoldCyan    "${Esc}[1;36m")
-  set(BoldWhite   "${Esc}[1;37m")
+       string(ASCII 27 Esc)
+       set(ColourReset "${Esc}[m")
+       set(ColourBold  "${Esc}[1m")
+       set(Red         "${Esc}[31m")
+       set(Green       "${Esc}[32m")
+       set(Yellow      "${Esc}[33m")
+       set(Blue        "${Esc}[34m")
+       set(Magenta     "${Esc}[35m")
+       set(Cyan        "${Esc}[36m")
+       set(White       "${Esc}[37m")
+       set(BoldRed     "${Esc}[1;31m")
+       set(BoldGreen   "${Esc}[1;32m")
+       set(BoldYellow  "${Esc}[1;33m")
+       set(BoldBlue    "${Esc}[1;34m")
+       set(BoldMagenta "${Esc}[1;35m")
+       set(BoldCyan    "${Esc}[1;36m")
+       set(BoldWhite   "${Esc}[1;37m")
 endif()
 
 # Native packaging name
 set(NPKG_PROJECT_NAME agl-${PROJECT_NAME})
 
-if(DEFINED ENV{SDKTARGETSYSROOT})
-file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
-set(BUILD_ENV_SYSROOT $ENV{SDKTARGETSYSROOT})
-elseif(DEFINED ENV{PKG_CONFIG_SYSROOT_DIR})
-file(STRINGS $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
-set(BUILD_ENV_SYSROOT $ENV{PKG_CONFIG_SYSROOT_DIR})
-else()
-file(STRINGS /usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
-set(BUILD_ENV_SYSROOT "")
-endif()
-
 string(REGEX MATCH "[0-9]+" LINUX_VERSION_CODE ${LINUX_VERSION_CODE_LINE})
 math(EXPR a "${LINUX_VERSION_CODE} >> 16")
 math(EXPR b "(${LINUX_VERSION_CODE} >> 8) & 255")
@@ -66,25 +55,6 @@ math(EXPR c "(${LINUX_VERSION_CODE} & 255)")
 
 set(KERNEL_VERSION "${a}.${b}.${c}")
 
-# Get the os type
-# Used to package .deb
-set(OS_RELEASE_PATH "${BUILD_ENV_SYSROOT}/etc/os-release")
-if(EXISTS ${OS_RELEASE_PATH})
-       execute_process(COMMAND bash "-c" "grep -E '^ID(_LIKE)?=' ${OS_RELEASE_PATH} | tail -n 1"
-               OUTPUT_VARIABLE TMP_OSRELEASE
-       )
-
-       if (NOT TMP_OSRELEASE STREQUAL "")
-               string(REGEX REPLACE ".*=\"?([0-9a-z\._-]*)\"?\n" "\\1" OSRELEASE ${TMP_OSRELEASE})
-       else()
-               set(OSRELEASE "NOT COMPATIBLE !")
-       endif()
-
-else()
-       set(OSRELEASE "NOT COMPATIBLE ! Missing ${OS_RELEASE_PATH} file.")
-endif()
-message(STATUS "Distribution used ${OSRELEASE}")
-
 # Include project configuration
 # ------------------------------
 project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
@@ -141,7 +111,9 @@ string(REGEX REPLACE "^(.*)/.*$" "\\1" ENTRY_POINT "${PKG_TEMPLATE_PREFIX}")
 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")
-set(WIDGET_CONFIG_TEMPLATE ${TEMPLATE_DIR}/config.xml.in CACHE PATH "Path to widget config file template (config.xml.in)")
+if(NOT WIDGET_CONFIG_TEMPLATE)
+       set(WIDGET_CONFIG_TEMPLATE ${TEMPLATE_DIR}/config.xml.in CACHE PATH "Path to widget config file template (config.xml.in)")
+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")
@@ -169,6 +141,6 @@ set(GDB_INITIAL_BREAK "personality" CACHE STRING "Initial Break Point for GDB re
 # Define some checker binaries to verify input DATA files
 # to be included in package. Schema aren't checked for now.
 # Dummy checker about JSON.
-set(LUA_CHECKER "luac -o /dev/null" CACHE STRING "LUA compiler")
+set(LUA_CHECKER "luac" "-p" CACHE STRING "LUA compiler")
 set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
-set(JSON_CHECKER "echo" CACHE STRING "JSON linter")
+set(JSON_CHECKER "" CACHE STRING "JSON linter")