1 |
Hello, developers. |
2 |
|
3 |
As you probably know already, CMake sucks a lot. One of its more sucky |
4 |
features is that it generates Makefiles that fail a lot. In particular, |
5 |
they fail at verbose build logs that are cluttered with useless CMake |
6 |
intermediate commands and hard to read. But also they sometimes |
7 |
deadloop hard in faulty dependency scanning [1]. |
8 |
|
9 |
Those two issues can be solved by switching CMake to use Ninja instead |
10 |
of make. As you may know, Ninja is the fancy building tool that is |
11 |
faster and much harder to use than make. However, it integrates with |
12 |
CMake much better and with less hackery. In particular, the verbose |
13 |
build log is free of useless CMake percentage printing output and other |
14 |
non-sense, and contains only real build commands. It also gets |
15 |
dependency scanning right. |
16 |
|
17 |
Sadly, there are two problems with using Ninja: |
18 |
|
19 |
1) it will not work with some packages, |
20 |
|
21 |
2) it introduces an extra dep (on Ninja). |
22 |
|
23 |
The first issue is a bit complex. Sometimes the problem lies in CMake |
24 |
itself (not all CMake magic works in Ninja for some reason), sometimes |
25 |
in the project (relying on Makefile stuff), sometimes in the ebuild. |
26 |
For example, with Ninja you can't do '-C subdirectory' to run targets |
27 |
from a specific subdirectory. So, we can't force Ninja everywhere. |
28 |
|
29 |
The second issue is a bit easier. GNU make is part of @system, ninja |
30 |
would be considered an extra package being installed. Do we consider it |
31 |
fine to require it randomly? Or do we need to justify the extra dep by |
32 |
benefits of building a particular package with Ninja? Is sane verbose |
33 |
build log a good enough benefit? |
34 |
|
35 |
So, what do you think? Should I start switching random packages to |
36 |
Ninja whenever it works? |
37 |
|
38 |
Oh, and this would be done via something like: |
39 |
|
40 |
: ${CMAKE_MAKEFILE_GENERATOR:=Ninja} |
41 |
|
42 |
before inherit line. To respect user forcing another generator, and to |
43 |
get deps right. |
44 |
|
45 |
[1]:https://bugs.gentoo.org/show_bug.cgi?id=546336 |
46 |
|
47 |
-- |
48 |
Best regards, |
49 |
Michał Górny |