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

Update documentation for clang-format #2907

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sming/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ CMAKE ?= cmake

# clang-format command
DEBUG_VARS += CLANG_FORMAT
CLANG_FORMAT ?= clang-format
CLANG_FORMAT ?= clang-format-8

# more tools
DEBUG_VARS += AWK
Expand Down
42 changes: 30 additions & 12 deletions docs/source/information/develop/clang-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ Note that *clang-format* is part of the main **Clang** project, whilst *clang-ti
found in **clang-tools-extra**.


Installation
clang-format
------------

In Ubuntu you should be able to install them using the following command::
Installation
~~~~~~~~~~~~

sudo apt-get install clang-format clang-tidy
Sming requires version 8 which is generally no longer available in the standard repositories for recent GNU/Linux distributions.
You can find standalone builds at https://github.com/muttleyxd/clang-tools-static-binaries/releases.

For example:

```
export CLANG_FORMAT=/opt/clang-format-8
wget https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-32d3ac78/clang-format-8_linux-amd64 -O /opt/clang-format-8
chmod +x $CLANG_FORMAT
```

You should persist the definition for :envvar:`CLANG_FORMAT` as Sming uses this when running the ``make cs`` commands (see below).

See the the `download <http://releases.llvm.org/download.html>`__ page
of the Clang project for installation instructions for other operating
systems.

.. important::

Expand All @@ -37,10 +46,6 @@ systems.
You should install the same version on your development computer.



clang-format
------------

Rules
~~~~~

Expand All @@ -57,6 +62,8 @@ IDE integration
There are multiple existing integrations for IDEs. You can find details
in the `ClangFormat documentation <https://clang.llvm.org/docs/ClangFormat.html>`__.

For VS Code/Codium install the **clang-format** extension and configure the path with the location of the **clang-format-8** executable.

For the Eclipse IDE we recommend installing
the `CppStyle plugin <https://github.com/wangzw/CppStyle>`__. You can
configure your IDE to auto-format the code on "Save" using the
Expand Down Expand Up @@ -114,12 +121,23 @@ C, C++ or header file or a selection in it and run the ``Format`` command
clang-tidy
----------

Configuration
~~~~~~~~~~~~~
Installation
~~~~~~~~~~~~

No specific version is required but generally you should aim to use the most recent version
available in your distribution. Version 17.0.6 was used at time of writing these notes.

In Ubuntu you should be able install using the following command::

sudo apt-get install clang-tidy

See the the `download <http://releases.llvm.org/download.html>`__ page
of the Clang project for installation instructions for other operating
systems.

Configuration
~~~~~~~~~~~~~

The default tool configuration is defined in the
`.clang-tidy <https://github.com/SmingHub/Sming/blob/develop/.clang-tidy>`__
file, located in the root directory of the framework.
Expand Down
Loading