summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-16 09:38:39 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:47 +0200
commitd7dc0a2d7e78fcbe1cf766d6e87b76a34ac272d9 (patch)
treedab359d1b03d60ea6b4b2e17840f275c11c8f203
parentad070faba5e3efda30e21a6c3b0870031ed0e625 (diff)
Reorganization between variables/build options
Move compilation/link option to build options and all custom variables stuff in variable file. Make build options as first file to be included then all custom stuff. Change-Id: I530268574745edcc414e29cac59eb542954d73cc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--cmake/cmake.d/01-build_options.cmake (renamed from cmake/cmake.d/04-build_options.cmake)36
-rw-r--r--cmake/cmake.d/02-variables.cmake (renamed from cmake/cmake.d/01-variables.cmake)39
-rw-r--r--cmake/cmake.d/03-macros.cmake (renamed from cmake/cmake.d/02-macros.cmake)2
-rw-r--r--cmake/cmake.d/04-extra_targets.cmake (renamed from cmake/cmake.d/03-extra_targets.cmake)0
4 files changed, 39 insertions, 38 deletions
diff --git a/cmake/cmake.d/04-build_options.cmake b/cmake/cmake.d/01-build_options.cmake
index 3db685c..246d650 100644
--- a/cmake/cmake.d/04-build_options.cmake
+++ b/cmake/cmake.d/01-build_options.cmake
@@ -24,40 +24,18 @@
# Customise your preferences in "./conf.d/cmake/config.cmake"
#--------------------------------------------------------------------------
-# Check GCC minimal version
-if (gcc_minimal_version)
- message (STATUS "${Cyan}-- Check gcc_minimal_version (found gcc version ${CMAKE_C_COMPILER_VERSION}) \
- (found g++ version ${CMAKE_CXX_COMPILER_VERSION})${ColourReset}")
- if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version} OR CMAKE_C_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version})
- message(FATAL_ERROR "${Red}**** FATAL: Require at least gcc-${gcc_minimal_version} please set CMAKE_C[XX]_COMPILER")
- endif()
-endif(gcc_minimal_version)
-
-# Check Kernel mandatory version, will fail the configuration if required version not matched.
-if (kernel_mandatory_version)
- message (STATUS "${Cyan}-- Check kernel_mandatory_version (found kernel version ${KERNEL_VERSION})${ColourReset}")
- if (KERNEL_VERSION VERSION_LESS ${kernel_mandatory_version})
- message(FATAL_ERROR "${Red}**** FATAL: Require at least ${kernel_mandatory_version} please use a recent kernel or source your SDK environment then clean and reconfigure your CMake project.")
- endif (KERNEL_VERSION VERSION_LESS ${kernel_mandatory_version})
-endif(kernel_mandatory_version)
-
-# Check Kernel minimal version just print a Warning about missing features
-# and set a definition to be used as preprocessor condition in code to disable
-# incompatibles features.
-if (kernel_minimal_version)
- message (STATUS "${Cyan}-- Check kernel_minimal_version (found kernel version ${KERNEL_VERSION})${ColourReset}")
- if (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
- message(WARNING "${Yellow}**** Warning: Some feature(s) require at least ${kernel_minimal_version}. Please use a recent kernel or source your SDK environment then clean and reconfigure your CMake project.${ColourReset}")
- else (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
- add_definitions(-DKERNEL_MINIMAL_VERSION_OK)
- endif (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
-endif(kernel_minimal_version)
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable]
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON CACHE BOOLEAN "Flag for using prefix path")
INCLUDE(FindPkgConfig)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckLibraryExists)
INCLUDE(GNUInstallDirs)
+set(CMAKE_BUILD_TYPE Debug CACHE STRING "the type of build")
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CMP0048 1)
+
# Default compilation options
############################################################################
link_libraries(-Wl,--as-needed -Wl,--gc-sections)
@@ -68,7 +46,6 @@ endforeach()
# Compilation OPTIONS depending on language
#########################################
-
foreach(option ${COMPILE_OPTIONS})
add_compile_options(${option})
endforeach()
@@ -130,6 +107,7 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS})
# Default Linkflag
+set (PKG_TEMPLATE_PREFIX ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR} CACHE PATH "Default Package Templates Directory")
if(NOT BINDINGS_LINK_FLAG)
set(BINDINGS_LINK_FLAG "-Wl,--version-script=${PKG_TEMPLATE_PREFIX}/cmake/export.map")
endif()
diff --git a/cmake/cmake.d/01-variables.cmake b/cmake/cmake.d/02-variables.cmake
index a9fbc6e2..9dc970a 100644
--- a/cmake/cmake.d/01-variables.cmake
+++ b/cmake/cmake.d/02-variables.cmake
@@ -45,16 +45,9 @@ if(NOT WIN32)
set(BoldWhite "${Esc}[1;37m")
endif()
-# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable]
-set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON CACHE BOOLEAN "Flag for using prefix path")
-
# Native packaging name
set(NPKG_PROJECT_NAME agl-${PROJECT_NAME})
-set(CMAKE_BUILD_TYPE Debug CACHE STRING "the type of build")
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(CMP0048 1)
-
# Get the os type
# Used to package .deb
if(EXISTS "/etc/os-release")
@@ -95,6 +88,35 @@ set(PROJECT_RESOURCES "${CMAKE_SOURCE_DIR}/data" CACHE PATH "Subpath to data")
set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN")
set(AFB_REMPORT "1234" CACHE PATH "Default AFB_TOKEN")
+# Check GCC minimal version
+if (gcc_minimal_version)
+message (STATUS "${Cyan}-- Check gcc_minimal_version (found gcc version ${CMAKE_C_COMPILER_VERSION}) \
+(found g++ version ${CMAKE_CXX_COMPILER_VERSION})${ColourReset}")
+if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version} OR CMAKE_C_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version})
+message(FATAL_ERROR "${Red}**** FATAL: Require at least gcc-${gcc_minimal_version} please set CMAKE_C[XX]_COMPILER")
+endif()
+endif(gcc_minimal_version)
+
+# Check Kernel mandatory version, will fail the configuration if required version not matched.
+if (kernel_mandatory_version)
+message (STATUS "${Cyan}-- Check kernel_mandatory_version (found kernel version ${KERNEL_VERSION})${ColourReset}")
+if (KERNEL_VERSION VERSION_LESS ${kernel_mandatory_version})
+message(FATAL_ERROR "${Red}**** FATAL: Require at least ${kernel_mandatory_version} please use a recent kernel or source your SDK environment then clean and reconfigure your CMake project.")
+endif (KERNEL_VERSION VERSION_LESS ${kernel_mandatory_version})
+endif(kernel_mandatory_version)
+
+# Check Kernel minimal version just print a Warning about missing features
+# and set a definition to be used as preprocessor condition in code to disable
+# incompatibles features.
+if (kernel_minimal_version)
+message (STATUS "${Cyan}-- Check kernel_minimal_version (found kernel version ${KERNEL_VERSION})${ColourReset}")
+if (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
+message(WARNING "${Yellow}**** Warning: Some feature(s) require at least ${kernel_minimal_version}. Please use a recent kernel or source your SDK environment then clean and reconfigure your CMake project.${ColourReset}")
+else (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
+add_definitions(-DKERNEL_MINIMAL_VERSION_OK)
+endif (KERNEL_VERSION VERSION_LESS ${kernel_minimal_version})
+endif(kernel_minimal_version)
+
# Project path variables
# ----------------------
@@ -115,7 +137,6 @@ else()
endif()
# Paths to templates files
-set (PKG_TEMPLATE_PREFIX ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR} CACHE PATH "Default Package Templates Directory")
set(TEMPLATE_DIR "${PKG_TEMPLATE_PREFIX}/cmake/template.d" CACHE PATH "Subpath to a directory where are stored needed files to launch on remote target to debuging purposes")
if(NOT WIDGET_CONFIG_TEMPLATE)
@@ -148,6 +169,8 @@ endif()
# Break After Binding are loaded but before they get initialised
set(GDB_INITIAL_BREAK "personality" CACHE STRING "Initial Break Point for GDB remote")
+# Define some checker binaries to verify input DATA files
+# to be included in package.
set(LUA_CHECKER "luac" CACHE STRING "LUA compiler")
set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter")
diff --git a/cmake/cmake.d/02-macros.cmake b/cmake/cmake.d/03-macros.cmake
index a085738..62e5790 100644
--- a/cmake/cmake.d/02-macros.cmake
+++ b/cmake/cmake.d/03-macros.cmake
@@ -174,7 +174,7 @@ macro(project_targets_populate)
add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
endif(${T} STREQUAL "BINDING")
elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
- MESSAGE(".. Warning: ${TARGET} ignored when packaging.")
+ MESSAGE("${Yellow}.. Warning: ${TARGET} ignored when packaging.${ColourReset}")
endif()
endforeach()
endmacro(project_targets_populate)
diff --git a/cmake/cmake.d/03-extra_targets.cmake b/cmake/cmake.d/04-extra_targets.cmake
index 2c635db..2c635db 100644
--- a/cmake/cmake.d/03-extra_targets.cmake
+++ b/cmake/cmake.d/04-extra_targets.cmake