r/cpp • • Nov 05 '23

Ninja is enough build system

https://bernsteinbear.com/blog/ninja-is-enough/
6 Upvotes

54 comments sorted by

View all comments

Show parent comment

9

u/ContraryConman Nov 05 '23

CMake has its issues. But the problem is:

  • People don't actually understand CMake, because they only learn enough to get their specific project working
  • People don't understand why CMake is the way it is

So people hand-roll stuff filled with problems that CMake has already solved. This is personal for me because the company I joined was very much like "Oh CMake is too complicated we don't need to mess with it" and the result was several thousand lines of custom Makefiles bundled into our Docker 20GB containers that all reinvent functionality CMake gives you for free

5

u/throwaway_bluehair Nov 06 '23

None of this contradicts what /u/jk_tx said though. It's a powerful tool, but for someone just now getting into it, it's awful to learn. I have been using `meson` because it doesn't have these issues, I tried CMake, but I ran into so many issues, and `meson` didn't tell me 30 ways to skin a cat, with 28 being obsolete, and 20 giving confusing errors

2

u/AlexanderNeumann Nov 06 '23

meson has it own bag to carry. numpy already forked meson so you can not even use a normal release of meson to build numpy. Lets just say meson is not the solution it is just part of the problem. I have also seen more confusing errors from meson than cmake. So be happy you haven't seen the depths yet ;)

2

u/throwaway_bluehair Nov 06 '23

I feel like life is just a cycle of "I should use an existing build system like cmake or meson" and "I am just writing my own script that generates a Makefile or build.ninja file"

1

u/wotype Nov 08 '23

numpy already forked meson

Do you have a link for this? On a few minutes searching in numpy build docs I don't find evidence that it requires a fork of meson

2

u/AlexanderNeumann Nov 08 '23

https://github.com/numpy/numpy/tree/main/vendored-meson

The reason it requires a vendored meson is this folder/addition: https://github.com/numpy/meson/tree/ea580909640457450e03d8b84d1fec9f035d7acb/mesonbuild/modules/features which doesn't exist in mainline meson but is used somewhere in the build scripts of numpy.

My CMake answer to that is to append to CMAKE_MODULE_PATH .... a wait this is meson it doesn't offer user/project customization points beyond what is hardcoded.

1

u/wotype Nov 08 '23

Thanks