Skip to content

Commit

Permalink
Fix #711, Relative paths, typos, better dependency
Browse files Browse the repository at this point in the history
MISSION_CORE_MODULES now set early (mission_build.cmake) allowing
override or append in user config.

Fixed typos in cfe_msg.h, and moved local to module until
APIs are cleaned up (still available as include)

Moving towards a module file structure
  • Loading branch information
skliper committed Jun 2, 2020
1 parent 888666f commit 844f8af
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
6 changes: 6 additions & 0 deletions cmake/mission_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ function(initialize_globals)
set(MISSION_SOURCE_DIR ${MISSION_SOURCE_DIR} CACHE PATH "Top level mission source directory")
endif(NOT DEFINED MISSION_SOURCE_DIR)

# Default core modules, set early so it can be appended or replaced from user configuration
if (NOT DEFINED MISSION_CORE_MODULES)
set(MISSION_CORE_MODULES msg CACHE PATH "Mission core modules")
endif (NOT DEFINED MISSION_CORE_MODULES)

# The configuration should be in a subdirectory named "<mission>_defs". If there is one
# and only one of these, this is assumed to be it. If there is more than one then the
# user MUST specify which one is intended to be used by setting MISSIONCONFIG in the environment
Expand Down Expand Up @@ -273,6 +278,7 @@ function(prepare)
"MISSION_APPS"
"MISSION_PSPMODULES"
"MISSION_DEPS"
"MISSION_CORE_MODULES"
"ENABLE_UNIT_TESTS"
)
foreach(APP ${MISSION_APPS} ${MISSION_PSPMODULES} ${MISSION_DEPS})
Expand Down
22 changes: 15 additions & 7 deletions fsw/cfe-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,28 @@ add_definitions(-D_CFE_CORE_)
set(CFE_CORE_MODULES es sb evs tbl time fs)
set(CFE_ALL_MODULE_SRCS)

if (NOT MISSION_CORE_MODULES)
set(MISSION_CORE_MODULES ${cfe-core_MISSION_DIR}/src/msg)
endif (NOT MISSION_CORE_MODULES)

foreach(MODULE ${CFE_CORE_MODULES} config shared)
aux_source_directory(src/${MODULE} CFE_ALL_MODULE_SRCS)
endforeach(MODULE ${CFE_CORE_MODULES})

add_library(${CFE_CORE_TARGET} STATIC ${CFE_ALL_MODULE_SRCS})

foreach(MODULE ${MISSION_CORE_MODULES})
add_subdirectory(${MODULE} ${CFE_CORE_TARGET})
get_filename_component(MODULE_NAME ${MODULE} NAME)

# Search in core, then for custom module
if(IS_DIRECTORY ${cfe-core_MISSION_DIR}/src/${MODULE})
add_subdirectory(src/${MODULE} ${MODULE_NAME})
elseif(IS_DIRECTORY ${MISSION_SOURCE_DIR}/${MODULE})
add_subdirectory(${MISSION_SOURCE_DIR}/${MODULE} ${MODULE_NAME})
else()
message(FATAL_ERROR "Target build incomplete, ${MODULE} not found in ${MISSION_SOURCE_DIR} or ${cfe-core_MISSION_DIR}/src")
endif()

message (STATUS "Adding mission core module: " ${MODULE})
target_link_libraries(${CFE_CORE_TARGET} ${MODULE_NAME})
endforeach(MODULE ${MISSION_CORE_MODULES})

add_library(${CFE_CORE_TARGET} STATIC ${CFE_ALL_MODULE_SRCS})

if (ENABLE_UNIT_TESTS)
add_subdirectory(unit-test)
endif (ENABLE_UNIT_TESTS)
Expand Down
14 changes: 9 additions & 5 deletions fsw/cfe-core/src/msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
##################################################################

# Add the basic set of files which are always built
set(CFE_ALL_MODULE_SRCS ${CFE_ALL_MODULE_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/cfe_msg_checksum.c
${CMAKE_CURRENT_SOURCE_DIR}/cfe_msg_fc.c
${CMAKE_CURRENT_SOURCE_DIR}/cfe_msg_time.c
PARENT_SCOPE
set(MODULE_SRCS
src/cfe_msg_checksum.c
src/cfe_msg_fc.c
src/cfe_msg_time.c
)

add_library(${MODULE_NAME} STATIC ${MODULE_SRCS})

# Add to includes for header dependency resolution across modules
target_include_directories(${MODULE_NAME} PUBLIC inc)
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void CFE_MSG_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr);
bool CFE_MSG_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr);
/**@}*/

/** @defgropu CFEAPIMSGCmdCode cFE Message Command Code APIs
/** @defgroup CFEAPIMSGCmdCode cFE Message Command Code APIs
* @{
*/

Expand Down Expand Up @@ -158,7 +158,7 @@ uint16 CFE_MSG_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr);

/**@}*/

/** @defgropu CFEAPIMSGTime cFE Message Time APIs
/** @defgroup CFEAPIMSGTime cFE Message Time APIs
* @{
*/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 844f8af

Please sign in to comment.