Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@romangg
Copy link
Member

@romangg romangg commented Feb 21, 2024

We add multiple CMake presets which we use in our CI and can be used by consumers.

Additionally we now compile with a lot more compiler warnings enabled and warnings as errors. On our CI we do this for clang and gcc now.

It is good style to provide CMake presets with a CMake project. We replace the
KDECompilerSettings with these presets.

The removal of the exception flag means that consumers are more free in
selecting the right behavior for them. At the moment exceptions are required
though.

The CI is adapted in that we need to set a preset for having sensible warnings
being set. As we now enable more warnings than KDECompilerSettings did, this
means the CI pipeline will produce also more warnings.
The arguments are not needed anymore since we set everything through the
presets now.
The include comes with a lot of instructions. We don't need most of them, so
just do the little we rely on ourselves in a separate include.
Test building with gcc too.
Otherwise the composited string might be optimized away on release builds
what leads to a crash on nullptr.
Silences a deprecation warning.
Silences a deprecation warning.
Silences a deprecation warning.
Silences a deprecation warning.
In two particular cases it is necessary when including C files. In the test we
don't require the keyword redefine actually.
Silences a warning.
This is undefined behavior. Silences a warning.
Silences a warning on the deprecated take function.
With wlroots and libwayland we have too many C casts like this. For now disable
the cast-align warning again. Should we instead wrap the calls and disable the
warnings with pragma more targeted?
The function with QWindow argument has been deprecated. Use the new one
instead, that just omits the argument.
To improve robustness now compile with clang with warnings as errors. We only
make two exceptions:
- Wdeprecated-declarations because this can change often depending on upstream
  and using deprecated functionality is non-criticial
- Wunused-lambda-capture because there seems to be a bug in clang producing
  many false-positives in our code [1]

[1] llvm/llvm-project#81243
This can be used to simply build the libraries without any tests and warnings.
We build in the CI this preset as well and use it for our weekly rebuilds.

The preset actually sets the build type to "RelWithDebInfo" to produce better
backtraces.
For increased robustness ensure that the gcc preset compiles with warnings as
errors. We make the following exceptions:
- Wcast-align is not warned, because it produces a lot of noise on structs we
  only want to partly initialize.
- Wunknown-pragmas is not warned as error, because it will false-positive on
  clang pragmas.
- Wdeprecated-declarations is not warned as error, for same reason as with
  clang, because it's non-critical and we might want to keep deprecated code
  for some time.
- Wmissing-include-dirs provides false-positives on Qt code generation.
Add the information on the presets. At the same time the separate chapter about
development is not necessary in the README.md. It should be clear that this
part is described in the CONTRIBUTING.md document.
@romangg romangg merged commit 77064f5 into winft:master Feb 22, 2024
@romangg romangg deleted the cmake-presets branch February 22, 2024 12:52
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.

1 participant