cleaned up documentation of CMakeLists.txt for readability on one screen

master
polymurph 3 years ago
parent 5ef339c5bb
commit ab066f9da6

@ -10,23 +10,45 @@ set(PL "c")
#################################################################################################### ####################################################################################################
# Setting the used directory locations # Setting the used directory locations
#################################################################################################### ####################################################################################################
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 ? # Location of the project : It is defaulted to one Higher than the KED Directory :TODO: Shall we let
set(CMAKE_CORE_DIR ${CMAKE_SOURCE_DIR}/cmake_core) #Location of the cmkae core funtionalities / funtions / definitions # the user define it weherever he wants it ?
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(PROJECT_DIR ${CMAKE_SOURCE_DIR}/..)
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" # Location of the cmkae core funtionalities / funtions / definitions
set(PERIFERALS_DIR ${CMAKE_SOURCE_DIR}/peripherals) #Directory fot the peripherals -> "Common to all CSL" set(CMAKE_CORE_DIR ${CMAKE_SOURCE_DIR}/cmake_core)
# Location of the used SCL CSL_USED is passed as an argutem to CMake from run.sh -> "Specific to
# each CSL"
set(CSL_DIR ${CMAKE_SOURCE_DIR}/csl/${CSL_USED})
# Location of the Sources for the selected CSL -> "Specific to each CSL"
set(CSL_SOURCES ${CMAKE_SOURCE_DIR}/csl/${CSL_USED}/Src)
# Directiry fot the drivers -> "Common to all CSL"
set(DRIVERS_DIR ${CMAKE_SOURCE_DIR}/drivers)
# Directory fot the peripherals -> "Common to all CSL"
set(PERIFERALS_DIR ${CMAKE_SOURCE_DIR}/peripherals)
set(PROJECT_CONFIG_FILE ${PROJECT_DIR}/projectDefinitions.cmake) set(PROJECT_CONFIG_FILE ${PROJECT_DIR}/projectDefinitions.cmake)
#################################################################################################### ####################################################################################################
# INCLUDES # INCLUDES
#################################################################################################### ####################################################################################################
include(${CMAKE_CORE_DIR}/cmakeCore.cmake) #All the library and submodule funtions and definitions are written here # All the library and submodule funtions and definitions are written here
include(${CMAKE_CORE_DIR}/errorHandler.cmake) #For Detailed error messages. include(${CMAKE_CORE_DIR}/cmakeCore.cmake)
include(${PROJECT_CONFIG_FILE}) #Here is the include Where the user sould define his project sources and headers
include(${PERIFERALS_DIR}/CMakeLists.txt) #Here is the include fopr the awailable peripheral headers and standart libraries. # For Detailed error messages.
include(${DRIVERS_DIR}/CMakeLists.txt) #Here is the include fopr the awailable peripheral headers and standart libraries. include(${CMAKE_CORE_DIR}/errorHandler.cmake)
# Here is the include Where the user sould define his project sources and headers
include(${PROJECT_CONFIG_FILE})
# Here is the include fopr the awailable peripheral headers and standart libraries.
include(${PERIFERALS_DIR}/CMakeLists.txt)
# Here is the include fopr the awailable peripheral headers and standart libraries.
include(${DRIVERS_DIR}/CMakeLists.txt)
#################################################################################################### ####################################################################################################
# Cheking if the choosen CSL exists, this i redundant because run.sh makes that alredy but makes the # Cheking if the choosen CSL exists, this i redundant because run.sh makes that alredy but makes the
@ -49,9 +71,11 @@ endif()
include(${COMPILER_DEFS}) include(${COMPILER_DEFS})
project(${CSL_USED} ASM C CXX) #do this intead sf declaring languages in the beginning it will prevent loop errors. # do this intead sf declaring languages in the beginning it will prevent loop errors.
project(${CSL_USED} ASM C CXX)
set(EXECUTABLE ${PROJECT_NAME}) #Create the executable #Create the executable
set(EXECUTABLE ${PROJECT_NAME})
#################################################################################################### ####################################################################################################
@ -179,7 +203,8 @@ foreach(X IN LISTS PROJECT_SOURCES_DIR_LIST)
message(" |->${X}") message(" |->${X}")
endforeach() endforeach()
message(" |--> Generated Library Submodules ${Red}!!!This list order also defines the compilation order of submodules!!!${ColourReset}${BoldCyan}") message(" |--> Generated Library Submodules ${Red}!!!This list order also defines the compilation \
order of submodules!!!${ColourReset}${BoldCyan}")
foreach(X IN LISTS GENERATED_LIBRARIES) foreach(X IN LISTS GENERATED_LIBRARIES)
message(" |->${X}") message(" |->${X}")
endforeach() endforeach()
@ -192,7 +217,8 @@ message("${ColourReset}")
add_executable(${EXECUTABLE} ${PROJECT_DIR}/main.c) add_executable(${EXECUTABLE} ${PROJECT_DIR}/main.c)
target_compile_options(${EXECUTABLE} PRIVATE ${MAIN_FLAGS}) target_compile_options(${EXECUTABLE} PRIVATE ${MAIN_FLAGS})
target_compile_definitions(${EXECUTABLE} PRIVATE ${MAIN_DEFS}) target_compile_definitions(${EXECUTABLE} PRIVATE ${MAIN_DEFS})
target_include_directories(${EXECUTABLE} PUBLIC ${PROJECT_HEADERS_DIR} ${PROJECT_SOURCES_DIR} ${MAIN_INCLUDES}) target_include_directories(${EXECUTABLE} PUBLIC ${PROJECT_HEADERS_DIR} ${PROJECT_SOURCES_DIR}
${MAIN_INCLUDES})
#################################################################################################### ####################################################################################################
# LINKING EXECUTEABLE # LINKING EXECUTEABLE
@ -215,7 +241,9 @@ message(" |--> CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(" |--> CMAKE_ASM_COMPILER: ${CMAKE_ASM_COMPILER}") message(" |--> CMAKE_ASM_COMPILER: ${CMAKE_ASM_COMPILER}")
message(" |--> CMAKE_OBJCOPY: ${CMAKE_OBJCOPY}") message(" |--> CMAKE_OBJCOPY: ${CMAKE_OBJCOPY}")
message(" |--> CMAKE_SIZE: ${CMAKE_SIZE}") message(" |--> CMAKE_SIZE: ${CMAKE_SIZE}")
message(" |--> CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") #AS we provide our own linker nad not using the one from the curren OS (system)
# AS we provide our own linker nad not using the one from the curren OS (system)
message(" |--> CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message("+-------------------------------+") message("+-------------------------------+")
message("${ColourReset}") message("${ColourReset}")
@ -261,9 +289,11 @@ endif(OUTPUT_DOXYGEN)
#################################################################################################### ####################################################################################################
#CUSTOM Comments from dev. #CUSTOM Comments from dev.
#################################################################################################### ####################################################################################################
# Link For header dependency : https://stackoverflow.com/questions/11216408/cmake-dependencies-headers-between-apps-libraries-in-same-project # Link For header dependency : https://stackoverflow.com/questions/11216408/cmake-dependencies-
# headers-between-apps-libraries-in-same-project
# This is one possible trick to handle the assenbly compiling. # This is one possible trick to handle the assenbly compiling.
# We can't use arm-non-eabi-as because it can onaly hande macros. # We can't use arm-non-eabi-as because it can onaly hande macros.
# So this bizzare Variable makes shure that whne the asembly compiling is called the -x assembler-with-cpp flag is passed # So this bizzare Variable makes shure that whne the asembly compiling is called the -x assembler-
# with-cpp flag is passed
# target_compile_options(${EXECUTABLE} PRIVATE # target_compile_options(${EXECUTABLE} PRIVATE
# $<$<COMPILE_LANGUAGE:ASM>:-x assembler-with-cpp ${ASM_FLAGS}>) # $<$<COMPILE_LANGUAGE:ASM>:-x assembler-with-cpp ${ASM_FLAGS}>)

Loading…
Cancel
Save