Gentoo Archives: gentoo-dev

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>, kde@g.o
Subject: Re: [gentoo-dev] RFC: using Ninja in more CMake-based packages
Date: Sun, 21 Jun 2015 06:55:56
Message-Id: 20150621095538.a45f0ea9414b8ed3e353175a@gentoo.org
In Reply to: [gentoo-dev] RFC: using Ninja in more CMake-based packages by "Michał Górny"
1 Hi!
2
3 On Sun, 7 Jun 2015 17:08:57 +0200 Michał Górny wrote:
4 > Hello, developers.
5 >
6 > As you probably know already, CMake sucks a lot. One of its more sucky
7 > features is that it generates Makefiles that fail a lot. In particular,
8 > they fail at verbose build logs that are cluttered with useless CMake
9 > intermediate commands and hard to read. But also they sometimes
10 > deadloop hard in faulty dependency scanning [1].
11 >
12 > Those two issues can be solved by switching CMake to use Ninja instead
13 > of make. As you may know, Ninja is the fancy building tool that is
14 > faster and much harder to use than make. However, it integrates with
15 > CMake much better and with less hackery. In particular, the verbose
16 > build log is free of useless CMake percentage printing output and other
17 > non-sense, and contains only real build commands. It also gets
18 > dependency scanning right.
19 >
20 > Sadly, there are two problems with using Ninja:
21 >
22 > 1) it will not work with some packages,
23 >
24 > 2) it introduces an extra dep (on Ninja).
25 >
26 > The first issue is a bit complex. Sometimes the problem lies in CMake
27 > itself (not all CMake magic works in Ninja for some reason), sometimes
28 > in the project (relying on Makefile stuff), sometimes in the ebuild.
29 > For example, with Ninja you can't do '-C subdirectory' to run targets
30 > from a specific subdirectory. So, we can't force Ninja everywhere.
31 >
32 > The second issue is a bit easier. GNU make is part of @system, ninja
33 > would be considered an extra package being installed. Do we consider it
34 > fine to require it randomly? Or do we need to justify the extra dep by
35 > benefits of building a particular package with Ninja? Is sane verbose
36 > build log a good enough benefit?
37 >
38 > So, what do you think? Should I start switching random packages to
39 > Ninja whenever it works?
40 >
41 > Oh, and this would be done via something like:
42 >
43 > : ${CMAKE_MAKEFILE_GENERATOR:=Ninja}
44 >
45 > before inherit line. To respect user forcing another generator, and to
46 > get deps right.
47
48 Sounds great. IMO default value should be determined per-package:
49 if upstream recommends Ninja (or there is a good testing with
50 Ninja), then set it, otherwise emake.
51
52 Any progress here? The only package in tree which allows user to
53 select cmake backend is llvm-9999.
54
55 Best regards,
56 Andrew Savchenko