Skip to content

CMake: Activate ccache #13824

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

Closed
wants to merge 1 commit into from
Closed

Conversation

ladislas
Copy link
Contributor

@ladislas ladislas commented Oct 28, 2020

Summary of changes

This PR activates ccache for CMake builds as discussed here in #13477

#13477 (comment)

Impact of changes

The changes should speed up the build time by using ccache.

Migration actions required

n/a

Documentation

n/a


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] 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

@0xc0170 @hugueskamba


@ladislas ladislas changed the base branch from master to feature-cmake October 28, 2020 13:28
@ladislas ladislas changed the title feature cmake Activate ccache for CMake build Oct 28, 2020
@ciarmcom ciarmcom requested a review from a team October 28, 2020 13:30
@ciarmcom
Copy link
Member

@ladislas, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@ladislas ladislas changed the title Activate ccache for CMake build CMake - Activate ccache Oct 28, 2020
@ladislas ladislas changed the title CMake - Activate ccache CMake: Activate ccache Oct 28, 2020
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Shouldn't this be

find_program(CCACHE ccache)
if(CCACHE)
    set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
    set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
endif(CCACHE)

I found this https://reviews.bitcoinabc.org/D5150?id=15995.

This PR is fine as it is but the other approach looks more future proof.

@ladislas
Copy link
Contributor Author

@0xc0170 I'm happy to change but I'm still not sure which of the two methods is considered best practice.

llvm use my approach here: https://github.com/llvm/llvm-project/blob/905f874c449cc114d74eaeb19639664779fd0b6e/llvm/CMakeLists.txt#L153

Same as opencv: https://github.com/opencv/opencv/blob/master/cmake/OpenCVCompilerOptions.cmake#L20

The CMake documentation about RULE_LAUNCH_COMPILE is also interesting: https://cmake.org/cmake/help/latest/prop_gbl/RULE_LAUNCH_COMPILE.html

This is intended to allow launchers to intercept build problems with high granularity.

Regarding your reference and their issue with clang-tidy, it seems that CMAKE_<LANG>_CLANG_TIDY would be a better fit for them, but I've never tried it:
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

Maybe someone with deep CMake knowledge can shine in on that :)

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 29, 2020

Yes, both are fine. I would go with updated version as clang-tidy is something we might revisit in the future so it works in both cases (with and without clang-tidy or something else).

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 30, 2020

We update the testing, when you update, please also rebase.

@ladislas ladislas closed this Oct 30, 2020
@ladislas ladislas deleted the branch ARMmbed:feature-cmake October 30, 2020 09:13
@ladislas ladislas deleted the feature-cmake branch October 30, 2020 09:13
@ladislas
Copy link
Contributor Author

I'll do the change, rebase, rename the branch and make a new PR.

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

Successfully merging this pull request may close these issues.

3 participants