-
Notifications
You must be signed in to change notification settings - Fork 3k
cmake: design doc update #13321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: design doc update #13321
Conversation
rwalton-arm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have a couple of suggestions around grammar etc.
3f9b678 to
32681f4
Compare
|
The license check is on master as well, creating a new blocker and will fix. |
c05625f to
435a50b
Compare
Pull request has been modified.
|
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
f7bf625 to
bd80d4d
Compare
|
Rebased to get the travis fix in |
docs/design-documents/tools/cmake.md
Outdated
| All what can be defined should be in CMake files and configuration (app/mbed .json files). Our build system would parse the configuration, create rules and generate top level CMake file that would include others (application CMake files plus also Mbed OS core CMake). | ||
| Everything that can be defined should be in CMake files and configuration (mbed_app/mbed_lib.json) files. Our build system would parse the configuration and generate a CMake config file. | ||
|
|
||
| To stay backward compatible, we create common rules as follows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To stay backward compatible, we create common rules as follows. | |
| For backward compatibility, the following rules must be respected: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change that to "The following rules must be respected" to avoid duplicating "follow..." in the same sentence.
docs/design-documents/tools/cmake.md
Outdated
| An example, to add `TARGET_STM` in the a folder `targets`: | ||
|
|
||
| ``` | ||
| ./TARGET_STM/qspi/driver_stm_qspi.cpp | ||
| ./TARGET_STM/peripheral_specific_to_stm/stm_specific_driver.cpp | ||
| ``` | ||
|
|
||
| As result, the top level application CMake: | ||
|
|
||
| ``` | ||
| add_subdirectory_if_target(STM TARGET_STM/qspi) | ||
| add_subdirectory_if_target(STM TARGET_STM/peripheral_specific_to_stm) | ||
| mbed_add_cmake_directory_if_labels("TARGET") | ||
| ``` | ||
|
|
||
| There would be static CMakes in the `./TARGET_STM/qspi/` and `./TARGET_STM/peripheral_specific_to_stm` that would define what files should be included or specific settins for these modules. | ||
| The same could be applied to other labels like features or components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| An example, to add `TARGET_STM` in the a folder `targets`: | |
| ``` | |
| ./TARGET_STM/qspi/driver_stm_qspi.cpp | |
| ./TARGET_STM/peripheral_specific_to_stm/stm_specific_driver.cpp | |
| ``` | |
| As result, the top level application CMake: | |
| ``` | |
| add_subdirectory_if_target(STM TARGET_STM/qspi) | |
| add_subdirectory_if_target(STM TARGET_STM/peripheral_specific_to_stm) | |
| mbed_add_cmake_directory_if_labels("TARGET") | |
| ``` | |
| There would be static CMakes in the `./TARGET_STM/qspi/` and `./TARGET_STM/peripheral_specific_to_stm` that would define what files should be included or specific settins for these modules. | |
| The same could be applied to other labels like features or components. | |
| I.e As the `DISCO_L475VG_IOT01A` target inherits the `STM` label and has the `BLE` feature, the `TARGET_STM` directory in `mbed-os/targets/` and the `FEATURE_BLE` directory in `mbed-os/features/` are processed because their parent directories contain `CMakeLists.txt` files that have each respectively `mbed_add_cmake_directory_if_labels("TARGET")` and `mbed_add_cmake_directory_if_labels("FEATURE")`. |
docs/design-documents/tools/cmake.md
Outdated
| This file statically defines the structure of the component within Mbed OS. It contains conditional statements that are based on the config. We use regular CMake expressions, plus extend it with our own macros, to conditionally include/exclude directories. The rule of thumb: do not expose headers that are internal. We would like to avoid having everything in the include paths as we do now. | ||
|
|
||
|
|
||
| `add_subdirectory` always adds the directory to the main CMake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to explain a CMake function here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove
docs/design-documents/tools/cmake.md
Outdated
| A user create own CMake file to configure an application, also with `mbed_app.json` configuration file. The building of an app would look like: | ||
|
|
||
| 1. Parse the arguments provided to build command | ||
| 2. Parse the application configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to carry on using 1 for numbered bullet points so you do not need to remember what the next number is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix
docs/design-documents/tools/cmake.md
Outdated
|
|
||
| ## Application CMake | ||
|
|
||
| We should provide application CMake functionality with our own configuration. There are couple of approaches we could take. Statically defined CMake but then this disconnectes config and CMake - as CMake contains configuration for a project (like includes, sources, etc). Our build tool would need to parse CMake to get all paths used in the project or Mbed OS to find out where to look for configuration file. Therefore the build system has a knowledge as it is currently. We use `requires` to include/exclude modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are extra spaces in this paragraph.
ade9959 to
03449e9
Compare
|
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
|
I'll rebase and fix all the reviews comments 👍 |
4b43249 to
4c60dde
Compare
|
Rebased, history fixed as well. |
|
Ah, wait , lost some changes, fixing that :) |
c814ea8 to
44a89ad
Compare
|
Rebased and recovered old data from github 🙄 magic here and there. I'll squash once reviewed and approved. |
docs/design-documents/tools/cmake.md
Outdated
|
|
||
| `mbed-tools` has consolidated all of the required modules to build Mbed OS, along with the command line interface, into a single Python package which can be installed using standard python packaging tools. | ||
|
|
||
| A user create own CMake file to configure an application, also with `mbed_app.json` configuration file. The building of an app would look like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is accurate anymore. mbed-tools creates the Mbed configuration CMake file (.mbedbuild/mbed_config.cmake) and we don't expect users to have to edit it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was about CMakelists.txt in the application, like blinky has in the root directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the tools to create a template top-level CMakeLists.txt when the user runs mbedtools init (or whatever the command to create a new workspace ends up being called, it's init currently)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be ideal, if cmakelists does not exists and they run init, yotta had similar init flow as I recall.
I guess we want to avoid scanning folders , so we let user to fill in the template.
ae99878 to
4d4f4d3
Compare
|
I'll rebase for the final CI run |
|
Updated |
docs/design-documents/tools/cmake.md
Outdated
| The same could be applied to other labels like features or components. | ||
|
|
||
| As result, the top level application CMake: | ||
| To migrate to the new build system, we can provide auto scanning of the module and generate CMake based on what we find or use the way as described above. In both cases, we could stay backward compatible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to fix the grammar here, but I'm not sure what we mean by "auto scanning of the module"; do we mean "auto scanning of Mbed OS module and component directories"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File globbing is what I read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it, the migration path will come in separate update
Patater
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the commit history
Pull request has been modified.
Refactor Mbed OS CMake scripts section - details about mbed-os/cmake scripts Add mbed-tools - how mbed-tools built an application with CMake
28bfd86 to
1f639f7
Compare
|
History fixed, should be ready now |
Summary of changes
Add requirements
Fix cmake folder updates
Fix label function
Plus other small edits
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers