@ -1,10 +1,32 @@
cmake_minimum_required ( VERSION 3.15 )
include ( config/cmakeProjectConfig.cmake )
set ( CSL_DIR ${ CMAKE_SOURCE_DIR } /csl/ ${ CSL_USED } )
set ( CSL_SOURCES ${ CMAKE_SOURCE_DIR } /csl/ ${ CSL_USED } /Src )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C M A K E F e a t u r e s
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
set ( CMAKE_VERBOSE_MAKEFILE off ) # S h o u l d C M a k e p r i n t e v e r y t h i g n ?
set ( OUTPUT_DOXYGEN FALSE ) # S h o u l d C M a k e g e n e r a t e D o x y g e n o u t p u t ?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# S e t t i n g t h e u s e d d i r e c t o r y l o c a t i o n s
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
set ( PROJECT_DIR ${ CMAKE_SOURCE_DIR } /.. ) # L o c a t i o n o f t h e p r o j e c t : I t M U S T b e o n e H i g h e r t h a n t h e K E D D i r e c t o r y
set ( CSL_DIR ${ CMAKE_SOURCE_DIR } /csl/ ${ CSL_USED } ) # L o c a t i o n o f t h e u s e d S C L C S L _ U S E D i s p a s s e d a s a n a r g u t e m t o C M a k e f r o m r u n . s h - > " S p e c i f i c t o e a c h C S L "
set ( CSL_SOURCES ${ CMAKE_SOURCE_DIR } /csl/ ${ CSL_USED } /Src ) # L o c a t i o n o f t h e S o u r c e s f o r t h e s e l e c t e d C S L - > " S p e c i f i c t o e a c h C S L "
set ( DRIVERS_DIR ${ CMAKE_SOURCE_DIR } /drivers ) # D i r e c t i r y f o t t h e d r i v e r s - > " C o m m o n t o a l l C S L "
set ( PERIFERALS_DIR ${ CMAKE_SOURCE_DIR } /periferals ) # D i r e c t o r y f o t t h e w r i t t e n - > " C o m m o n t o a l l C S L "
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# I N C L U D E S
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
include ( config/cmakeProjectConfig.cmake ) # F o r t h e m o m e n t t h e r e a r e o n l y c o l o r s
include ( ${ PROJECT_DIR } /project.conf ) # H e r e i s t h e i n c l u d e W h e r e t h e u s e r s o u l d d e f i n e h i s p r o j e c t s o u r c e s a n d h e a d e r s
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C h e k i n g i f t h e c h o o s e n C S L e x i s t s , t h i s i r e d u n d a n t b e c a u s e r u n . s h m a k e s t h a t a l r e d y b u t m a k e s t h e
# c o d e f u t u r e p r o o f . G o a l w o u l d b e t o n o t u s e a r u n . s h i f t h e u s e r d o e s n ' t n e e d h e l p
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if ( EXISTS ${ CSL_DIR } ) # C h e k i n g i f t h e d i r e c t o r y e x i s t s
message ( "${Green}" )
message ( "+-------------------------------+" )
@ -12,7 +34,8 @@ if(EXISTS ${CSL_DIR}) # Cheking if the directory exists
message ( "+-------------------------------+" )
message ( "${ColourReset}" )
set ( COMPILER_DEFS ${ CMAKE_SOURCE_DIR } /config/compiler.cmake )
set ( PROJECT_DEFS ${ CSL_DIR } /config.cmake )
set ( CSL_DEFS ${ CSL_DIR } /config.cmake )
else ( )
message ( "${Red}" )
message ( FATAL_ERROR "\nPlease Select a valid CSL, CMake will exit\n" )
@ -23,22 +46,13 @@ include(${COMPILER_DEFS})
project ( ${ CSL_USED } ASM C CXX ) # d o t h i s i n t e a d s f d e c l a r i n g l a n g u a g e s i n t h e b e g i n n i n g i t w i l l p r e v e n t l o o p e r r o r s .
set ( CMAKE_VERBOSE_MAKEFILE off ) # S h o u l m a k e p r i n t e v e r y t h i g n ? ?
set ( EXECUTABLE ${ PROJECT_NAME } ) # C r e a t e t h e e x e c u t a b l e
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C O N F I G F I L E
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
set ( UTILS_DIR ${ CMAKE_SOURCE_DIR } /utils/assert )
set ( DRIVERS_DIR ${ CMAKE_SOURCE_DIR } /drivers )
set ( PERIFERALS_DIR ${ CMAKE_SOURCE_DIR } /periferals )
set ( OUTPUT_DOXYGEN TRUE )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# S U B D I R E C T O R I E S W i l l a d d t h e g i v e n f o l d e r s t o t h e p o r j e c t a n c h e c k f o r C m a k e L i s t s . t x t
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
include ( ${ PROJECT _DEFS} )
include ( ${ CSL_DEFS } )
add_subdirectory ( utils )
add_subdirectory ( csl )
add_subdirectory ( drivers )
@ -47,7 +61,7 @@ add_subdirectory(periferals)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# S a r t u p t u C o d e D e f i n i t i o n
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
li st( APPEND STARTUP_UCODE sub::startup )
se t( STARTUP_UCODE sub::startup )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# P e r i p e h r a l d e f i n i t i o n s
@ -102,9 +116,11 @@ message("+-------------------------------+")
message ( "Project Info" )
message ( "+-------------------------------+" )
message ( " |--> Executable's Name\t\t\t : ${EXECUTABLE}" )
message ( " |--> Compiler Definition file\t\t : ${COMPILER_DEFS }")
message ( " |--> Project 's cmake configuration\t : ${PROJECT_DEFS} ")
message ( " |--> Project's directory\t\t : ${PROJECT_DIR }")
message ( " |--> Project Configuration\t\t : ${PROJECT_DIR}/project.conf ")
message ( " |--> Chip Support Layer Dir.\t\t : ${CSL_DIR}" )
message ( " |--> CLS's cmake configuration\t\t : ${CSL_DEFS}" )
message ( " |--> Compiler Definition file\t\t : ${COMPILER_DEFS}" )
message ( " |--> Driver Dir\t\t\t : ${DRIVERS_DIR}" )
message ( " |--> Periferal Definition Dir\t\t : ${PERIFERALS_DIR}" )
message ( " |--> Periferal Implementation Dir\t : ${CSL_SOURCES}" )
@ -134,10 +150,10 @@ message("${ColourReset}")
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# E X E C U T A B L E
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
add_executable ( ${ EXECUTABLE } .. /main.c)
add_executable ( ${ EXECUTABLE } ${ PROJECT_DIR } /main.c)
target_compile_options ( ${ EXECUTABLE } PRIVATE ${ MAIN_FLAGS } )
target_compile_definitions ( ${ EXECUTABLE } PRIVATE ${ MAIN_DEFS } )
target_include_directories ( ${ EXECUTABLE } PUBLIC ${ MAIN_INCLUDES} )
target_include_directories ( ${ EXECUTABLE } PUBLIC ${ PROJEC_HEADERS} ${ PROJECT_SOURCES } ${ MAIN_INCLUDES} )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# L I N K I N G E X E C U T E A B L E