|
|
|
@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.15)
|
|
|
|
|
# CMAKE Features
|
|
|
|
|
####################################################################################################
|
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON) # Should CMake print everythign ?
|
|
|
|
|
set(OUTPUT_DOXYGEN FALSE) # Should CMake generate Doxygen output ?
|
|
|
|
|
set(PL "c")
|
|
|
|
|
set(PL "c") # Used programming language, we could maybe do a check.
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Setting the used directory locations
|
|
|
|
@ -26,17 +25,25 @@ set(CSL_STARTUP_DIR ${CSL_DIR}/startup)
|
|
|
|
|
|
|
|
|
|
# Directiry fot the drivers -> "Common to all CSL"
|
|
|
|
|
set(DRIVERS_DIR ${CMAKE_SOURCE_DIR}/drivers)
|
|
|
|
|
set(DRIVERS_HEADERS_DIR ${CMAKE_SOURCE_DIR}/drivers)
|
|
|
|
|
set(DRIVERS_HEADERS_DIR) #Declared empty because it will be filled automaticaly afterwards
|
|
|
|
|
|
|
|
|
|
# Directory fot the peripherals -> "Common to all CSL"
|
|
|
|
|
set(PERIPHERALS_DIR ${CMAKE_SOURCE_DIR}/peripherals)
|
|
|
|
|
set(PERIPHERALS_HEADERS_DIR ${CMAKE_SOURCE_DIR}/peripherals)
|
|
|
|
|
|
|
|
|
|
set(LIBRARIES_DIR ${CMAKE_SOURCE_DIR}/libraries)
|
|
|
|
|
set(LIBRARIES_HEADERS_DIR ${CMAKE_SOURCE_DIR}/libraries)
|
|
|
|
|
|
|
|
|
|
# Variable for Doxygen generation
|
|
|
|
|
set(OUTPUT_DOXYGEN TRUE) # Should CMake generate Doxygen output ?
|
|
|
|
|
set(DOXYGEN_WORKING_DIR ${CMAKE_SOURCE_DIR}/env/doc)
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# INCLUDES
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Adding human readable color references for cmake
|
|
|
|
|
include(${CMAKE_CORE_DIR}/colors.cmake)
|
|
|
|
|
|
|
|
|
|
# All the library and submodule funtions and definitions are written here
|
|
|
|
|
include(${CMAKE_CORE_DIR}/cmakeCore.cmake)
|
|
|
|
|
|
|
|
|
@ -52,10 +59,6 @@ include(${PERIPHERALS_DIR}/CMakeLists.txt)
|
|
|
|
|
# Here is the include fopr the awailable peripheral headers and standart libraries.
|
|
|
|
|
include(${DRIVERS_DIR}/CMakeLists.txt)
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# HEADERS
|
|
|
|
|
####################################################################################################
|
|
|
|
|
set (COMMON_HEADERS ${PERIPHERALS_HEADERS_DIR} ${CSL_HEADERS_DIR} ${LIBRARIES_HEADERS_DIR})
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Cheking if the choosen CSL exists, this i redundant because run.sh makes that alredy but makes the
|
|
|
|
@ -66,6 +69,8 @@ if(EXISTS ${CSL_DIR}) # Cheking if the directory exists
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Compiling for ${CSL_USED}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Project dir : ${PROJECT_DIR}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
set(COMPILER_DEFS ${CMAKE_CORE_DIR}/compiler.cmake) # TODO : Change location
|
|
|
|
|
set(CSL_DEFS ${CSL_DIR}/config.cmake)
|
|
|
|
@ -78,7 +83,7 @@ endif()
|
|
|
|
|
|
|
|
|
|
include(${COMPILER_DEFS})
|
|
|
|
|
|
|
|
|
|
# do this intead sf declaring languages in the beginning it will prevent loop errors.
|
|
|
|
|
# do this instead of declaring languages in the beginning this WILL prevent loop errors.
|
|
|
|
|
project(${CSL_USED} ASM C CXX)
|
|
|
|
|
|
|
|
|
|
#Create the executable
|
|
|
|
@ -91,28 +96,40 @@ include(${CSL_DEFS})
|
|
|
|
|
add_subdirectory(${CSL_DIR})
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Sartupt uCode Definition
|
|
|
|
|
# Sartupt uCode Definition this part Is left alone on purpose !
|
|
|
|
|
####################################################################################################
|
|
|
|
|
set(STARTUP_UCODE sub::startup)
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Driver definitions
|
|
|
|
|
# HEADERS
|
|
|
|
|
# ALL Header Definitions and calls MSUT be made here to be able to propagate them through all the modules
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
|
|
message("${BoldBlue}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Cheking Drivers")
|
|
|
|
|
message("Cheking Driver Headers")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
|
|
|
|
|
foreach(X IN LISTS DRIVERS_LIST)
|
|
|
|
|
addDriverHeader("${X}" "NEW_DRIVER_HEADER")
|
|
|
|
|
addHeaderDir("${DRIVERS_DIR}" "${X}" "NEW_DRIVER_HEADER")
|
|
|
|
|
list(APPEND DRIVERS_HEADERS_DIR ${NEW_DRIVER_HEADER})
|
|
|
|
|
endforeach()
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
|
|
|
|
|
set (COMMON_HEADERS ${CSL_HEADERS_DIR}
|
|
|
|
|
${PERIPHERALS_HEADERS_DIR}
|
|
|
|
|
${DRIVERS_HEADERS_DIR}
|
|
|
|
|
${LIBRARIES_HEADERS_DIR}
|
|
|
|
|
${PROJECT_HEADERS_DIR})
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# Driver definitions
|
|
|
|
|
####################################################################################################
|
|
|
|
|
message("Cheking Drivers ")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
foreach(X IN LISTS DRIVERS_LIST)
|
|
|
|
|
addDriver("${X}" "NEW_DRIVER")
|
|
|
|
|
list(APPEND DRIVER_LIBS ${NEW_DRIVER})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
|
|
|
|
@ -229,8 +246,7 @@ message("${ColourReset}")
|
|
|
|
|
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 ${PROJECT_HEADERS_DIR} ${PROJECT_SOURCES_DIR}
|
|
|
|
|
${MAIN_INCLUDES} ${DRIVERS_HEADERS_DIR})
|
|
|
|
|
target_include_directories(${EXECUTABLE} PUBLIC ${COMMON_HEADERS})
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# LINKING EXECUTEABLE
|
|
|
|
@ -280,9 +296,13 @@ add_custom_command(TARGET ${EXECUTABLE}
|
|
|
|
|
if(OUTPUT_DOXYGEN)
|
|
|
|
|
find_package(Doxygen)
|
|
|
|
|
if (DOXYGEN_FOUND)
|
|
|
|
|
# set input and output files
|
|
|
|
|
set(DOXYGEN_IN ${CMAKE_CORE_DIR}/doxyfile.in)
|
|
|
|
|
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
|
|
|
|
|
message("${Green}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Generation DOxygen output")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
|
|
|
|
|
# request to configure the file
|
|
|
|
|
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
|
|
|
@ -291,9 +311,14 @@ if(OUTPUT_DOXYGEN)
|
|
|
|
|
# note the option ALL which allows to build the docs together with the application
|
|
|
|
|
add_custom_target( doc_doxygen ALL
|
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
|
WORKING_DIRECTORY ${DOXYGEN_WORKING_DIR}
|
|
|
|
|
COMMENT "Generating API documentation with Doxygen"
|
|
|
|
|
VERBATIM )
|
|
|
|
|
message("${Green}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Generating Doxygen Done")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
else (DOXYGEN_FOUND)
|
|
|
|
|
message("Doxygen need to be installed to generate the doxygen documentation")
|
|
|
|
|
endif (DOXYGEN_FOUND)
|
|
|
|
|