SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.47k stars 348 forks source link

Support host builds using clang toolchain #2798

Closed mikee47 closed 3 months ago

mikee47 commented 3 months ago

This PR adds the CLANG_BUILD for host builds. The toolchain detection logic is in the main build.mk file as there might be future support for clang toolchains for actual devices. It's also a revision to the existing logic which checks GCC compiler version.

Try it out using make SMING_SOC=host CLANG_BUILD=1. To build with a specific (installed) version of clang, for example clang-15, use CLANG_BUILD=15 . Further customisation can be made by editing Sming/Arch/Host/build.mk.

Clang-tidy support (#2648) is also improved as there are some compiler flag differences between GCC and clang which are now shared between CLANG_TIDY and CLANG_BUILD operation.

An extra CI build has been added using clang.

Further to #2773, the default toolchain for macos is a version of clang (Apple Clang). This PR doesn't quite support that because there are other issues to address, but it's a step in the right direction.