#1082826 dh-python: allow using cmake+ninja as buildsystem

#1082826#5
Date:
2024-09-27 06:12:58 UTC
From:
To:
Dear Maintainer,

Currently dh-python passes '--buildsystem=cmake' to dh_auto_* [1] when
using cmake plugin. So debhelper will not use Ninja as cmake generator.

I hope dh-python could support cmake+ninja as it is now the recommended
way (or maybe use it as the default option?).

[1]: https://salsa.debian.org/python-team/tools/dh-python/-/blob/master/dhpython/build/plugin_cmake.py

Thanks,
Shengqi Chen

#1082826#10
Date:
2024-10-24 20:10:37 UTC
From:
To:
Hi Shengqi (2024.09.26_23:12:58_-0700)

Excuse my ignorance, but what would be the impact of enabling
cmake+ninja by default? Do we expect packages currently using the cmake
plugin to build?

How do we detect if a package supports / requires ninja?

Stefano

#1082826#15
Date:
2024-10-29 11:23:03 UTC
From:
To:
Hi,

CMake can be treated as a frontend that generates low-level compiling configuration.
Both makefile and ninja are the backends CMake supports.

Using ninja instead of Makefile could bring some benefits, including:

* more well-organized output
* better concurrency control
* better performance when handling lots of files

And dh-cmake also states in its README [1]:

+ "Note: as of Debhelper 11.2, you can use CMake's Ninja generator, by declaring
+ --buildsystem=cmake+ninja. Kitware highly recommends using this option,
+ especially for large projects, because it will speed up build time
+ significantly."
Projects with many files would benefit from switching to Ninja.
And some projects actually enforce it (e.g. pytorch).

So this is my proposal: if the maintainer asks for ninja, e.g. specifying
cmake+ninja, then pybuild also passes the same to dh_auto_*.

Or even better, pass anything looks like 'cmake+.*' in verbatim.
When debhelper supports more backends (e.g. meson), it could
be utilized by pybuild without special handling.

[1]: https://gitlab.kitware.com/debian/dh-cmake

Thanks,
Shengqi Chen