|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# CMAKE Colors
|
|
|
|
|
####################################################################################################
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
|
string(ASCII 27 Esc)
|
|
|
|
|
set(ColourReset "${Esc}[m")
|
|
|
|
@ -18,3 +20,48 @@ if(NOT WIN32)
|
|
|
|
|
set(BoldCyan "${Esc}[1;36m")
|
|
|
|
|
set(BoldWhite "${Esc}[1;37m")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Project function for cheking header files source files and generating libraries from them.
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#Searching if the given header directory exists if not we brake the compilation
|
|
|
|
|
function(projectHeadersCheck)
|
|
|
|
|
foreach(DIR IN LISTS PROJECT_HEADERS_DIR)
|
|
|
|
|
if(EXISTS ${DIR})
|
|
|
|
|
message("|--> ${DIR} : INCLUDED")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Header directory ${DIR} : NOT FOUND")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
#Searching if the given Source exists if not we brake the compilation
|
|
|
|
|
function(projectCheckSourcesCheck)
|
|
|
|
|
foreach(DIR IN LISTS PROJECT_SOURCES_DIR)
|
|
|
|
|
if(EXISTS ${DIR})
|
|
|
|
|
message("|--> ${DIR} : INCLUDED")
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Source directory ${DIR} : NOT FOUND")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
#Searching each sources directory to find the desired source file and generate a libaray submodule for the linker
|
|
|
|
|
function(projectAddItem alias _currentItem)
|
|
|
|
|
foreach(DIR IN LISTS PROJECT_SOURCES_DIR)
|
|
|
|
|
if(EXISTS ${DIR})
|
|
|
|
|
if(EXISTS ${DIR}/${alias}.${PL}) #For each directory we chanek if the given source file exitst
|
|
|
|
|
message("|-->${alias}.${PL} FOUND in : ${DIR}")
|
|
|
|
|
message(" |-> Creating sub::${alias}.${PL} library submodule")
|
|
|
|
|
add_library(${alias}_submodule ${DIR}/${alias}.${PL})
|
|
|
|
|
target_compile_options(${alias}_submodule PRIVATE ${C_FLAGS})
|
|
|
|
|
target_compile_definitions(${alias}_submodule PRIVATE ${C_DEFS})
|
|
|
|
|
target_include_directories(${alias}_submodule PUBLIC ${PROJECT_HEADERS_DIR} ${PERIFERALS_DIR} ${CSL_INCLUDES})
|
|
|
|
|
add_library(sub::${alias} ALIAS ${alias}_submodule)
|
|
|
|
|
set(${_currentItem} sub::${alias} PARENT_SCOPE)
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Source directory ${DIR} : NOT FOUND")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction()
|
|
|
|
|