Skip to content

Commit d384b50

Browse files
0xc0170hugueskamba
andauthored
CMake targets: porting
Update from review Co-authored-by: Hugues Kamba-Mpiana <[email protected]>
1 parent 0792beb commit d384b50

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

docs/porting/target/cmake.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Note: All the CMake variables above are generated by mbed-tools and their values
1515

1616
## Mbed targets CMake input file structure
1717

18-
We still support mbed-cli 1 and its requirements for the folders naming. To stay backward compatible, we still use the same naming even with CMake.
18+
As we are still supporting Mbed CLI 1, we have maintained the directory naming scheme that use prefixes (`FEATURE_`, `COMPONENT_`, `TARGET_`).
1919

20-
Each Mbed OS target should be prefixed with `mbed-`. We translate automatically Mbed OS target names from targets.json to CMake targets. A target from targets.json named `CYSBSYSKIT_01` has CMake target `mbed-cysbsyskit-01`.
20+
Every Mbed CMake target should be prefixed with `mbed-`. Mbed boards listed in `targets.json` are translated in CMake to add the prefix and replace `_` with `-`. For example, the Mbed board `CYSBSYSKIT_01` is represented by the CMake target `mbed-cysbsyskit-01`.
2121

2222
### Vendor selection
2323

@@ -46,36 +46,34 @@ add_subdirectory(TARGET_CY8CKIT_062S2_43012 EXCLUDE_FROM_ALL)
4646
4747
add_library(mbed-psoc6 INTERFACE)
4848
49-
# Add the include directories accessible from this directory that are not specific to an MCU family or Mbed target
49+
# Add the include directories accessible from this directory that are specific to this MCU family or Mbed target
5050
target_include_directories(mbed-psoc6
5151
INTERFACE
5252
...
5353
)
5454
55-
# Add the source files accessible from this directory that are not specific to an MCU family or Mbed target
55+
# Add the source files accessible from this directory that are specific to this MCU family or Mbed target
5656
target_sources(mbed-psoc6
5757
INTERFACE
5858
...
5959
)
6060
```
6161

62-
The board target can link to `mbed-psoc6`. Let's take `mbed-cysbsyskit-01` target:
62+
The board CMake targets should link to `mbed-psoc6`:
6363

6464
```
6565
add_library(mbed-cysbsyskit-01 INTERFACE)
6666
6767
target_include_directories(mbed-cysbsyskit-01
6868
INTERFACE
69-
.
70-
device
69+
...
7170
)
7271
7372
target_sources(mbed-cysbsyskit-01
7473
INTERFACE
75-
PeripheralPins.c
76-
cybsp.c
74+
...
7775
)
78-
76+
# Other libraries that the Mbed board depends on
7977
target_link_libraries(mbed-cysbsyskit-01
8078
INTERFACE
8179
mbed-cat1a
@@ -93,7 +91,7 @@ target_compile_definitions(mbed-cysbsyskit-01
9391
mbed_post_build_psoc6_merge_hex("CYSBSYSKIT_01")
9492
```
9593

96-
## Add target's CMakeLists.txt
94+
## Add Mbed board CMake input source file
9795

9896
Add `CMakeLists.txt` files to the top level directory of a given vendor directory. List all files found in the directory in this CMake input source file, adding additional CMake input source file if it is MCU or Mbed target specific and has a great number of files which will make the top level `CMakeLists.txt` too complex. Think when you decide to create functions in a computer software code to remove complexity.
9997

0 commit comments

Comments
 (0)