Skip to content

Commit 0ccebed

Browse files
committed
Fix #261, add psp_module_api interface target
Adds a new target for PSP modules and use this to propagate the compile definitions and include directories for all PSP code.
1 parent 215807e commit 0ccebed

File tree

9 files changed

+51
-28
lines changed

9 files changed

+51
-28
lines changed

CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,28 @@ if (NOT CFE_SYSTEM_PSPNAME)
1111
endif()
1212

1313
set(CFE_PSP_TARGETNAME "${CFE_SYSTEM_PSPNAME}")
14-
add_definitions(-D_CFE_PSP_)
14+
add_definitions(-D_CFE_PSP_) # macro to indicate PSP scope
15+
16+
# The "psp_module_api" defines the interface between internal PSP components
17+
add_library(psp_module_api INTERFACE)
18+
target_compile_definitions(psp_module_api INTERFACE
19+
$<TARGET_PROPERTY:osal,INTERFACE_COMPILE_DEFINITIONS> # use defs from OSAL
20+
)
21+
target_include_directories(psp_module_api INTERFACE
22+
fsw/inc # public API
23+
fsw/shared/inc # all PSP shared headers
24+
${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig
25+
$<TARGET_PROPERTY:osal,INTERFACE_INCLUDE_DIRECTORIES> # use headers from OSAL
26+
)
27+
1528

1629
# The PSP is currently built in two parts, consisting of a fully platform-specific
1730
# module combined with a shared component which is built for multiple targets.
1831
# The "shared" component is compiled using headers from the platform-specific module
1932
# so it is still ultimately a platform-specific binary, and it all gets wrapped into
2033
# a single PSP static library target.
21-
include_directories(
22-
fsw/inc
23-
fsw/shared/inc # all local stuff
24-
${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig
25-
$<TARGET_PROPERTY:osal,INTERFACE_INCLUDE_DIRECTORIES> # headers from OSAL
26-
)
27-
2834
add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl)
29-
target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PUBLIC
30-
$<TARGET_PROPERTY:osal,INTERFACE_COMPILE_DEFINITIONS> # defs from OSAL
31-
)
32-
3335
add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared)
34-
target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-shared PUBLIC
35-
$<TARGET_PROPERTY:osal,INTERFACE_COMPILE_DEFINITIONS> # defs from OSAL
36-
)
3736

3837
add_library(psp-${CFE_PSP_TARGETNAME} STATIC
3938
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-shared>

fsw/mcp750-vxworks/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# This contains the fully platform-specific code to
88
# run CFE on this target.
99

10-
include_directories(inc)
11-
1210
# Build the mcp750-vxworks implementation as a library
1311
add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1412
src/cfe_psp_exception.c
@@ -18,5 +16,7 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1816
src/cfe_psp_start.c
1917
src/cfe_psp_support.c
2018
src/cfe_psp_timer.c
21-
src/cfe_psp_watchdog.c)
22-
19+
src/cfe_psp_watchdog.c
20+
)
21+
target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc)
22+
target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api)

fsw/pc-linux/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# This contains the fully platform-specific code to
88
# run CFE on this target.
99

10-
include_directories(inc)
11-
1210
# Build the pc-linux implementation as a library
1311
add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1412
src/cfe_psp_exception.c
@@ -25,4 +23,7 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
2523
# Code outside the pc-linux PSP should _not_ depend on this.
2624
target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE
2725
_GNU_SOURCE
28-
)
26+
)
27+
28+
target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc)
29+
target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api)

fsw/pc-rtems/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# This contains the fully platform-specific code to
88
# run CFE on this target.
99

10-
include_directories(inc)
11-
1210
# Build the pc-rtems implementation as a library
1311
add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1412
src/cfe_psp_exception.c
@@ -18,5 +16,8 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1816
src/cfe_psp_start.c
1917
src/cfe_psp_support.c
2018
src/cfe_psp_timer.c
21-
src/cfe_psp_watchdog.c)
19+
src/cfe_psp_watchdog.c
20+
)
21+
target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc)
22+
target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api)
2223

fsw/shared/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
# Note this shared PSP code is currently built against headers provided by the
1111
# target implementation. This makes it implementation-specific even though
1212
# the same source code is used with multiple targets.
13-
include_directories("${CFEPSP_SOURCE_DIR}/fsw/${CFE_PSP_TARGETNAME}/inc")
14-
include_directories(inc)
1513

1614
# Build the shared implementation as a library
1715
add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT
@@ -24,3 +22,8 @@ add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT
2422
src/cfe_psp_port.c
2523
src/cfe_psp_ram.c
2624
)
25+
26+
target_include_directories(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE
27+
$<TARGET_PROPERTY:psp-${CFE_PSP_TARGETNAME}-impl,INCLUDE_DIRECTORIES>
28+
)
29+
target_link_libraries(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE psp_module_api)

unit-test-coverage/mcp750-vxworks/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ add_executable(coverage-${CFE_PSP_TARGETNAME}-testrunner
4949
target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner
5050
${UT_COVERAGE_LINK_FLAGS}
5151
ut-adaptor-${CFE_PSP_TARGETNAME}
52+
psp_module_api
5253
ut_psp_cfe_stubs
5354
ut_psp_libc_stubs
5455
ut_osapi_stubs

unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ target_include_directories(ut-adaptor-${CFE_PSP_TARGETNAME} PUBLIC
3131
${CMAKE_CURRENT_SOURCE_DIR}/inc
3232
${PSPCOVERAGE_SOURCE_DIR}/shared/adaptors/inc
3333
)
34+
35+
target_link_libraries(ut-adaptor-${CFE_PSP_TARGETNAME} PRIVATE
36+
psp_module_api
37+
ut_assert
38+
)

unit-test-coverage/ut-stubs/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@ add_library(ut_psp_libc_stubs STATIC EXCLUDE_FROM_ALL
5454
target_include_directories(ut_libc_stubs PUBLIC
5555
${CMAKE_CURRENT_SOURCE_DIR}/inc
5656
)
57+
58+
target_link_libraries(ut_psp_libc_stubs PRIVATE
59+
psp_module_api
60+
ut_assert
61+
)
5762

5863
add_library(ut_psp_cfe_stubs STATIC EXCLUDE_FROM_ALL
5964
src/cfe-configdata-stubs.c
65+
)
66+
67+
target_link_libraries(ut_psp_cfe_stubs PRIVATE
68+
psp_module_api
69+
ut_assert
6070
)

ut-stubs/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
include_directories(${osal_MISSION_DIR}/ut_assert/inc)
21
add_library(ut_psp-${CFE_PSP_TARGETNAME}_stubs ut_psp_stubs.c)
2+
target_link_libraries(ut_psp-${CFE_PSP_TARGETNAME}_stubs PRIVATE
3+
psp_module_api
4+
ut_assert
5+
)

0 commit comments

Comments
 (0)