diff --git a/CMakeLists.txt b/CMakeLists.txt index c631399..6d8da0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/config/cmakeProjectConfig.cmake b/cmake_core/cmakeCore.cmake similarity index 95% rename from config/cmakeProjectConfig.cmake rename to cmake_core/cmakeCore.cmake index 8bb8e6b..7c17a64 100644 --- a/config/cmakeProjectConfig.cmake +++ b/cmake_core/cmakeCore.cmake @@ -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() diff --git a/config/compiler.cmake b/cmake_core/compiler.cmake similarity index 100% rename from config/compiler.cmake rename to cmake_core/compiler.cmake diff --git a/config/doxyfile.in b/cmake_core/doxyfile.in similarity index 100% rename from config/doxyfile.in rename to cmake_core/doxyfile.in diff --git a/cmake_core/errorHandler.cmake b/cmake_core/errorHandler.cmake new file mode 100644 index 0000000..673ba8f --- /dev/null +++ b/cmake_core/errorHandler.cmake @@ -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() + diff --git a/periferals/CMakeLists.txt b/peripherals/CMakeLists.txt similarity index 100% rename from periferals/CMakeLists.txt rename to peripherals/CMakeLists.txt diff --git a/periferals/ascii.h b/peripherals/ascii.h similarity index 100% rename from periferals/ascii.h rename to peripherals/ascii.h diff --git a/periferals/delay.h b/peripherals/delay.h similarity index 100% rename from periferals/delay.h rename to peripherals/delay.h diff --git a/periferals/deviceSetup.h b/peripherals/deviceSetup.h similarity index 100% rename from periferals/deviceSetup.h rename to peripherals/deviceSetup.h diff --git a/periferals/i2c.c b/peripherals/i2c.c similarity index 100% rename from periferals/i2c.c rename to peripherals/i2c.c diff --git a/periferals/i2c.h b/peripherals/i2c.h similarity index 100% rename from periferals/i2c.h rename to peripherals/i2c.h diff --git a/periferals/pin.h b/peripherals/pin.h similarity index 100% rename from periferals/pin.h rename to peripherals/pin.h diff --git a/periferals/spi.c b/peripherals/spi.c similarity index 100% rename from periferals/spi.c rename to peripherals/spi.c diff --git a/periferals/spi.h b/peripherals/spi.h similarity index 100% rename from periferals/spi.h rename to peripherals/spi.h diff --git a/periferals/timer.h b/peripherals/timer.h similarity index 100% rename from periferals/timer.h rename to peripherals/timer.h diff --git a/periferals/usart.h b/peripherals/usart.h similarity index 100% rename from periferals/usart.h rename to peripherals/usart.h