Skip to content
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: Add initial support #13566

Merged
merged 164 commits into from
Nov 9, 2020
Merged

CMake: Add initial support #13566

merged 164 commits into from
Nov 9, 2020

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Sep 7, 2020

Summary of changes

Addition of CMake modules and input source files to configure the project and generate the scripts needed by the build systems (tested with Unix Makefiles and Ninja) to build Mbed OS as a library. Mbed OS is built as collection of all libraries supported by a given target.

There are two main targets: mbed-os and mbed-baremetal. The rest of the components in the Mbed OS repository are targets prefixed with mbed-, for example mbed-ble and mbed-netsockets.

Even though this is still under development. This PR was raised as the current state does not affect builds of the OS with the traditional tools (Mbed CLI, Online compiler, Mbed Studio).

For current state of development, supported targets, supported toolchains, known issues, and build steps, see "Documentations" section below.

Impact of changes

Adding/removing source files or subdirectories requires adding or updating CMake input source files as all source files are listed in them.

Migration actions required

Documentation

https://github.com/ARMmbed/mbed-os/blob/feature-cmake/tools/cmake/README.md


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[ ] Tests / results supplied as part of this PR

Reviewers


@ciarmcom
Copy link
Member

ciarmcom commented Sep 7, 2020

@hugueskamba, thank you for your changes.
@maclobdell @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-security @ARMmbed/mbed-os-pan @ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-mesh @ARMmbed/mbed-os-storage please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 8, 2020

I'll fix travis (I'll create PRs to all supported examples, they should be aligned).

I'll reference all PRs (I'll need to fix some travis settings there and rebase all).

Copy link
Contributor

@donatieng donatieng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff and really glad to seeing this coming to master! I'd like to see more context in the documentation as detailed below - basically the background/why we're doing this and what's the plan.

cmake/README.md Outdated Show resolved Hide resolved
docs/design-documents/tools/cmake.md Show resolved Hide resolved
platform/mbed-trace/CMakeLists.txt Outdated Show resolved Hide resolved
Qinghao Shi and others added 17 commits November 6, 2020 17:25
Issue https://gitlab.kitware.com/cmake/cmake/-/issues/21093

Until this is fixed, we should disable response files for ARMClang + ninja on Windows.
Other toolchains and host systems should benefit from response files thus not disabling them
completely.

This fixes the issue with not finding includes. It's not trivial to find the root cause, it took me a while to figure out why ARMClang can't find the paths.

I moved the check to Mbed OS main cmake. It should not be in the toolchain file as it is not
related to the toolchain but to generator. We need toolchain properly set up first.

Note, I had to protect setting CMAKE_NINJA_FORCE_RESPONSE_FILE. If I set it to 0, ninja
would still use rsp files so I rather protected it and define that variable only when
required, not always.

Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
Rename the CMake variable expected from applications from MBED_ROOT to
MBED_PATH to be consistent with the naming used for the configuration file
(MBED_CONFIG_PATH) also expected from applications.
As the assembler does not seem to recognise the request to the
linker to use microlib, remove that instruction.
Microlib is still used as the linker selects microlib as a result
of being explicitly asked to do so.
The new function (mbed_set_cpu_core_definitions()) should always be
called as it has defintions needed by Mbed OS to work with that
particular MCU core.
mbed_set_cpu_core_options() should only be called if a third-party
toolchain file has not been used as it has compile options that can
cause conflicts.
…put source file

The compile defintions should always be added depending on the
selected toolchain.
mbed_set_toolchain_options() should only be called if a third-party
toolchain file has not been used as it has compile options that can
cause conflicts.
Compile defintions are always included. However, functions that set compile options
are only called if a third party toolchain file is not used
Check if the selected application profile is supported by the selected Mbed Target
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 8, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Nov 8, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 5 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.