3 ms·
> How do I add GLib as a dependency to my C project? You document in your documentation (or some metadata file format of your particular liking) the fact that
by Arch-TK 5y ago
> How do I add GLib as a dependency to my C project?
You document in your documentation (or some metadata file format of your particular liking) the fact that your project requires GLib and which versions of GLib it supports (hopefully GLib supports semver). Then you take that version, feed it to pkg-config with the right version information and feed that into your build process. Depending on your build setup it may be as simple as putting it in your cargo.toml. Unlike with cargo, you also get to chose as a person compiling the project whether you want the code to statically compile a version of your choosing or just link against whatever your distribution provides.
- maxwell86 5y agoYour first two sentences: > You document in your documentation (or some metadata file format of your particular liking) the fact that your project requires GLib and which versions of GLib it supports (hopefully GLib supports semver). Then you take that version, feed it to pkg-config with the right version information and feed that into your build process. refute the subsequent claim: > Depending on your build setup it may be as simple as putting it in your cargo.toml. It isn't as simple, cause you have to do more. This glosses over support for operating systems that lack pkg-config, so in practice it is more complicated than that.
- Arch-TK 5y ago>It isn't as simple, cause you have to do more. No? "or some metadata file format of your particular liking" is the sentence which includes "depending on your build setup it may be as simple as putting it in your cargo.toml". Unless you disagree with the whole concept. More importantly, adding dependencies doesn't need to be that easy given that you should focus on not having very many of them in the first place. This doesn't change the fact that it CAN be that easy. >This glosses over support for operating systems that lack pkg-config, so in practice it is more complicated than that. There's one system which doesn't really natively integrate well with pkg-config, that's windows, for windows the build instructions can simply be: cross compile from another operating system or build using a unix envirionment for wibdows. It's not that hard and for the average joe not willing to do this it's absolutely trivial to provide precompiled binaries.