added error handling changed periferals/ to peripherals/ changed ked/config/ to ked/cmake_core/ moved functions to cmakeCore.cmake

master
Kerem Yollu 3 years ago
parent c762a4abbd
commit fce1f42f88

@ -10,17 +10,21 @@ set(PL "c")
####################################################################################################
# Setting the used directory locations
####################################################################################################
set(PROJECT_DIR ${CMAKE_SOURCE_DIR}/..) #Location of the project : It MUST be one Higher than the KED Directory
set(PROJECT_DIR ${CMAKE_SOURCE_DIR}/..) #Location of the project : It is defaulted to one Higher than the KED Directory :TODO: Shall we let the user define it weherever he wants it ?
set(CMAKE_CORE_DIR ${CMAKE_SOURCE_DIR}/cmake_core) #Location of the cmkae core funtionalities / funtions / definitions
set(CSL_DIR ${CMAKE_SOURCE_DIR}/csl/${CSL_USED}) #Location of the used SCL CSL_USED is passed as an argutem to CMake from run.sh -> "Specific to each CSL"
set(CSL_SOURCES ${CMAKE_SOURCE_DIR}/csl/${CSL_USED}/Src)#Location of the Sources for the selected CSL -> "Specific to each CSL"
set(DRIVERS_DIR ${CMAKE_SOURCE_DIR}/drivers) #Directiry fot the drivers -> "Common to all CSL"
set(PERIFERALS_DIR ${CMAKE_SOURCE_DIR}/periferals) #Directory fot the written -> "Common to all CSL"
set(DRIVERS_DIR ${CMAKE_SOURCE_DIR}/drivers) #Directiry fot the drivers -> "Common to all CSL"
set(PERIFERALS_DIR ${CMAKE_SOURCE_DIR}/peripherals) #Directory fot the peripherals -> "Common to all CSL"
set(PROJECT_CONFIG_FILE ${PROJECT_DIR}/projectDefinitions.cmake)
####################################################################################################
#INCLUDES
####################################################################################################
include(config/cmakeProjectConfig.cmake) #For the moment there are only colors
include(${PROJECT_DIR}/projectDefinitions.cmake) #Here is the include Where the user sould define his project sources and headers
include(${CMAKE_CORE_DIR}/cmakeCore.cmake) #All the library and submodule funtions and definitions are written here
include(${CMAKE_CORE_DIR}/errorHandler.cmake) #For Detailed error messages.
include(${PROJECT_CONFIG_FILE}) #Here is the include Where the user sould define his project sources and headers
####################################################################################################
# Cheking if the choosen CSL exists, this i redundant because run.sh makes that alredy but makes the
@ -32,7 +36,7 @@ if(EXISTS ${CSL_DIR}) # Cheking if the directory exists
message("Compiling for ${CSL_USED}")
message("+-------------------------------+")
message("${ColourReset}")
set(COMPILER_DEFS ${CMAKE_SOURCE_DIR}/config/compiler.cmake)
set(COMPILER_DEFS ${CMAKE_CORE_DIR}/compiler.cmake) # TODO : Change location
set(CSL_DEFS ${CSL_DIR}/config.cmake)
else()
@ -55,7 +59,7 @@ include(${CSL_DEFS})
add_subdirectory(utils)
add_subdirectory(csl)
add_subdirectory(drivers)
add_subdirectory(periferals)
add_subdirectory(peripherals)
####################################################################################################
#Sartupt uCode Definition
@ -87,7 +91,7 @@ message("${ColourReset}")
####################################################################################################
set(DRIVERS_LIST max7219 max31865)
message("${BoldYellow}")
message("${BoldBlue}")
message("+-------------------------------+")
message("Cheking Drivers")
message("+-------------------------------+")
@ -103,7 +107,7 @@ message("${ColourReset}")
####################################################################################################
#User's project definitions
####################################################################################################
message("${BoldYellow}")
message("${BoldMagenta}")
message("+-------------------------------+")
message("Cheking User's Project")
message("+-------------------------------+")
@ -133,6 +137,7 @@ foreach(X IN LISTS PROJECT_SOURCES_DIR_LIST)
endforeach()
message("+-------------------------------+")
message("${ColourReset}")
####################################################################################################
#Stick All the libraries together, only for code redability futher down.
@ -144,7 +149,7 @@ endforeach()
####################################################################################################
#Overview
####################################################################################################
message("${BoldBlue}")
message("${BoldCyan}")
message("+-------------------------------+")
message("Project Info")
message("+-------------------------------+")
@ -176,7 +181,7 @@ foreach(X IN LISTS PROJECT_SOURCES_DIR_LIST)
message(" |->${X}")
endforeach()
message(" |--> Generated Library Submodules ${Magenta}!!!This list order also defines the compilation order of submodules!!!${ColourReset}${BoldBlue}")
message(" |--> Generated Library Submodules ${Red}!!!This list order also defines the compilation order of submodules!!!${ColourReset}${BoldCyan}")
foreach(X IN LISTS GENERATED_LIBRARIES)
message(" |->${X}")
endforeach()
@ -194,7 +199,7 @@ target_include_directories(${EXECUTABLE} PUBLIC ${PROJECT_HEADERS_DIR} ${PROJECT
####################################################################################################
#LINKING EXECUTEABLE
####################################################################################################
message("${Cyan}")
message("${BoldGreen}")
message("+-------------------------------+")
message("Linker & Compiler Info")
message("+-------------------------------+")
@ -238,7 +243,7 @@ if(OUTPUT_DOXYGEN)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/config/doxyfile.in)
set(DOXYGEN_IN ${CMAKE_CORE_DIR}/doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
# request to configure the file

@ -30,7 +30,7 @@ function(projectHeadersCheck)
if(EXISTS ${DIR})
message("|--> ${DIR} : INCLUDED")
else()
message(FATAL_ERROR "Header directory ${DIR} : NOT FOUND")
errorHeaderDirNotFound()
endif()
endforeach()
endfunction()
@ -41,7 +41,7 @@ function(projectCheckSourcesCheck)
if(EXISTS ${DIR})
message("|--> ${DIR} : INCLUDED")
else()
message(FATAL_ERROR "Source directory ${DIR} : NOT FOUND")
errorSourceDirNotFound()
endif()
endforeach()
endfunction()

@ -0,0 +1,50 @@
function(errorHeaderDirNotFound)
message("${Red}\n")
message("#########################################")
message("#\t@@@@ @@@ @@@ @@ @@@ \t#")
message("#\t@ @ @ @ @ @ @ @ @ \t#")
message("#\t@@@ @@@ @@@ @ @ @@@ \t#")
message("#\t@ @ @ @ @ @ @ @ @ \t#")
message("#\t@@@@ @ @ @ @ @@ @ @ \t#")
message("#########################################")
message("#################################")
message("#\tAN ERROR HAS OCCURED\t#")
message("#################################")
message(" |-->HEADER DIRECTORY NOT FOUND")
message(" |-> Given dir : ${DIR}")
message("!!! Possible Reasons !!!")
message(" |--> Did you give corect path in ${PROJECT_CONFIG_FILE} ??")
message(" |-> The declarion should look like :")
message(" |-> list(APPEND PROJECT_HEADERS_DIR ${DIR})")
message(" |-> you can also use the \$\{PROJECT_DIR\} variable")
message(" |-> \$\{PROJECT_DIR\} = ${PROJECT_DIR}")
message(" |-> list(APPEND PROJECT_HEADERS_DIR \$\{PROJECT_DIR\}/path_to_your_directory")
message("################################################\n\n")
message(FATAL_ERROR "Header directory ${DIR} : NOT FOUND")
endfunction()
function(errorSourceDirNotFound)
message("${Red}\n")
message("#########################################")
message("#\t@@@@ @@@ @@@ @@ @@@ \t#")
message("#\t@ @ @ @ @ @ @ @ @ \t#")
message("#\t@@@ @@@ @@@ @ @ @@@ \t#")
message("#\t@ @ @ @ @ @ @ @ @ \t#")
message("#\t@@@@ @ @ @ @ @@ @ @ \t#")
message("#########################################")
message("#\tAN ERROR HAS OCCURED\t\t#")
message("#########################################")
message(" |-->SOURCE DIRECTORY NOT FOUND")
message(" |-> Given dir : ${DIR}")
message("!!! Possible Reasons !!!")
message(" |--> Did you give corect path in ${PROJECT_CONFIG_FILE} ??")
message(" |-> The declarion should look like :")
message(" |-> list(APPEND PROJECT_SOURCES_DIR ${DIR})")
message(" |-> you can also use the \$\{PROJECT_DIR\} variable")
message(" |-> \$\{PROJECT_DIR\} = ${PROJECT_DIR}")
message(" |-> list(APPEND PROJECT_SOURCES_DIR \$\{PROJECT_DIR\}/path_to_your_directory")
message("#########################################")
message("")
message(FATAL_ERROR "Source directory ${DIR} : NOT FOUND")
endfunction()
Loading…
Cancel
Save