
Embracing Modularity with Meson - ingve
https://brennan.io/2020/05/08/meson/
======
pornel
I thought it'd be about modularity within Meson itself, not within projects it
builds.

Rust's Cargo itself is a primitive build tool, but it has an interesting
feature: build-time dependencies. It can pull in libraries to help with the
build (not your project dependencies, but Cargo's build script dependencies).
You need to abstract differences between MSVC and GCC? There's a crate for
that. You want to find libraries using pkg-config? vcpkg? There are crates for
that. You want to generate a perfect hash-table at build time? There's a crate
for that.

Going more meta with dependencies is also very helpful with "snowflake"
libraries. Did you know that libpng has its own libpng-config that's like pkg-
config, but not quite? On some systems it's necessary to use it. Do you use it
in your build script? Why would every user have to know that? Does Meson know
how to use it? Why would it hardcode quirk of one particular library?

------
JNRowe
Like the article's author, I've been very pleased overall with meson. Almost
to the point where I half expect to find _the thing_ that makes it unusable,
as surely it can't be Goldilocks-porridge-level good.

I do find myself wondering how that feeling is possible too. I suspect it is
because there were distro developers involved early on, versus a tool designed
around $some_other_group that is entirely alien to me. If true, I wonder if
that means there are a bunch of users who baulk as immediately when they see
meson(or even ninja) as I do when I see certain other systems.

------
carapace
> Meson automatically generates compile_commands.json, which can be consumed
> by clangd to provide a LSP server for any editor.

Wait, what now? Where can I learn more of this strange magic?

~~~
Memosyne
The compile_commands.json is the compilation database used by clang tools[1].
If you use CMake, enabling CMAKE_EXPORT_COMPILE_COMMANDS basically does the
same thing[2].

1 -
[https://clang.llvm.org/docs/JSONCompilationDatabase.html](https://clang.llvm.org/docs/JSONCompilationDatabase.html)

2 -
[https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_CO...](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html)

~~~
carapace
Thank you!

