@@ -70,12 +70,13 @@ endfunction(initialize_globals)
7070#
7171function (add_psp_module MOD_NAME MOD_SRC_FILES)
7272
73- # Include the PSP shared directory so it can get to cfe_psp_module.h
74- include_directories (${MISSION_SOURCE_DIR} /psp/fsw/shared/inc)
75- add_definitions (-D_CFE_PSP_MODULE_)
76-
7773 # Create the module
7874 add_library (${MOD_NAME} STATIC ${MOD_SRC_FILES} ${ARGN} )
75+ target_link_libraries (${MOD_NAME} PRIVATE psp_module_api)
76+
77+ target_compile_definitions (${MOD_NAME} PRIVATE
78+ _CFE_PSP_MODULE_
79+ )
7980
8081endfunction (add_psp_module)
8182
@@ -98,6 +99,7 @@ function(add_cfe_app APP_NAME APP_SRC_FILES)
9899
99100 # Create the app module
100101 add_library (${APP_NAME} ${APPTYPE} ${APP_SRC_FILES} ${ARGN} )
102+ target_link_libraries (${APP_NAME} core_api)
101103
102104 # An "install" step is only needed for dynamic/runtime loaded apps
103105 if (APP_DYNAMIC_TARGET_LIST)
@@ -149,7 +151,6 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
149151 # The table source must be compiled using the same "include_directories"
150152 # as any other target, but it uses the "add_custom_command" so there is
151153 # no automatic way to do this (at least in the older cmakes)
152- get_current_cflags(TBL_CFLAGS ${CMAKE_C_FLAGS} )
153154
154155 # Create the intermediate table objects using the target compiler,
155156 # then use "elf2cfetbl" to convert to a .tbl file
@@ -189,6 +190,9 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
189190 message ("NOTE: Selected ${TBL_SRC} as source for ${TBLWE} " )
190191 endif ()
191192
193+ add_library (${TGT} _${TBLWE} -obj OBJECT ${TBL_SRC} )
194+ target_link_libraries (${TGT} _${TBLWE} -obj PRIVATE core_api)
195+
192196 # IMPORTANT: This rule assumes that the output filename of elf2cfetbl matches
193197 # the input file name but with a different extension (.o -> .tbl)
194198 # The actual output filename is embedded in the source file (.c), however
@@ -197,9 +201,8 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
197201 # current content of a dependency (rightfully so).
198202 add_custom_command (
199203 OUTPUT "${TABLE_DESTDIR} /${TBLWE} .tbl"
200- COMMAND ${CMAKE_C_COMPILER} ${TBL_CFLAGS} -c -o ${TBLWE} .o ${TBL_SRC}
201- COMMAND ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl ${TBLWE} .o
202- DEPENDS ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl ${TBL_SRC}
204+ COMMAND ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl $<TARGET_OBJECTS:${TGT} _${TBLWE} -obj>
205+ DEPENDS ${MISSION_BINARY_DIR} /tools/elf2cfetbl/elf2cfetbl ${TGT} _${TBLWE} -obj
203206 WORKING_DIRECTORY ${TABLE_DESTDIR}
204207 )
205208 # Create the install targets for all the tables
@@ -308,7 +311,7 @@ function(add_cfe_coverage_test MODULE_NAME UNIT_NAME TESTCASE_SRC UT_SRCS)
308311 # as well as the UT assert framework
309312 target_link_libraries (${RUNNER_TARGET}
310313 ${UT_COVERAGE_LINK_FLAGS}
311- ut_cfe-core_stubs
314+ ut_core_api_stubs
312315 ut_assert
313316 )
314317
@@ -442,6 +445,38 @@ function(cfs_app_do_install APP_NAME)
442445
443446endfunction (cfs_app_do_install)
444447
448+ ##################################################################
449+ #
450+ # FUNCTION: cfs_app_check_intf
451+ #
452+ # Adds a special target that checks the structure of header files
453+ # in the public interface for this module. A synthetic .c source file
454+ # is created which has a "#include" of each individual header, which
455+ # then compiled as part of the validation. The intent is to confirm
456+ # that each header is valid in a standalone fashion and have no
457+ # implicit prerequisites.
458+ #
459+ function (cfs_app_check_intf MODULE_NAME)
460+ set (${MODULE_NAME} _hdrcheck_SOURCES)
461+ foreach (HDR ${ARGN} )
462+ configure_file (${CFE_SOURCE_DIR} /cmake/check_header.c.in ${CMAKE_CURRENT_BINARY_DIR} /src/check_${HDR} .c)
463+ list (APPEND ${MODULE_NAME} _hdrcheck_SOURCES ${CMAKE_CURRENT_BINARY_DIR} /src/check_${HDR} .c)
464+ endforeach (HDR ${ARGN} )
465+ add_library (${MODULE_NAME} _headercheck OBJECT ${${MODULE_NAME} _hdrcheck_SOURCES})
466+
467+ # This causes the check to compile with the same set of defines and include dirs as specified
468+ # in the "INTERFACE" properties of the actual module
469+ target_link_libraries (${MODULE_NAME} _headercheck PRIVATE
470+ core_api
471+ ${DEP}
472+ )
473+
474+ # Build this as part of the synthetic "check-headers" target
475+ add_dependencies (check-headers ${MODULE_NAME} _headercheck)
476+ endfunction (cfs_app_check_intf)
477+
478+
479+
445480
446481##################################################################
447482#
@@ -538,33 +573,17 @@ function(process_arch SYSVAR)
538573 include_directories (${MISSION_BINARY_DIR} /inc)
539574 include_directories (${CMAKE_BINARY_DIR} /inc)
540575
576+ # Add a custom target for "headercheck" - this is a special target confirms that
577+ # checks the sanity of headers within the public interface of modules
578+ add_custom_target (check-headers)
579+
541580 # Configure OSAL target first, as it also determines important compiler flags
542581 add_subdirectory ("${osal_MISSION_DIR} " osal)
543582
544583 # The OSAL displays its selected OS, so it is logical to display the selected PSP
545584 # This can help with debugging if things go wrong.
546585 message (STATUS "PSP Selection: ${CFE_SYSTEM_PSPNAME} " )
547586
548- # Add all widely-used public headers to the include path chain
549- include_directories (${MISSION_SOURCE_DIR} /osal/src/os/inc)
550- include_directories (${MISSION_SOURCE_DIR} /psp/fsw/inc)
551- include_directories (${MISSION_SOURCE_DIR} /cfe/fsw/cfe-core/src/inc)
552- include_directories (${MISSION_SOURCE_DIR} /cfe/cmake/target /inc)
553-
554- # propagate any OSAL interface compile definitions and include directories to this build
555- # This is set as a directory property here at the top level so it will apply to all code.
556- # This includes MODULE libraries that do not directly/statically link with OSAL but still
557- # should be compiled with these flags.
558- get_target_property (OSAL_COMPILE_DEFINITIONS osal INTERFACE_COMPILE_DEFINITIONS )
559- get_target_property (OSAL_INCLUDE_DIRECTORIES osal INTERFACE_INCLUDE_DIRECTORIES )
560-
561- if (OSAL_COMPILE_DEFINITIONS)
562- set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${OSAL_COMPILE_DEFINITIONS} " )
563- endif (OSAL_COMPILE_DEFINITIONS)
564- if (OSAL_INCLUDE_DIRECTORIES)
565- include_directories (${OSAL_INCLUDE_DIRECTORIES} )
566- endif (OSAL_INCLUDE_DIRECTORIES)
567-
568587 # Append the PSP and OSAL selections to the Doxyfile so it will be included
569588 # in the generated documentation automatically.
570589 # Also extract the "-D" options within CFLAGS and inform Doxygen about these
0 commit comments