-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(meson): install CMake Config files to datadir #141
Conversation
Uhm, this hardcodes the version number in yet another place. I can easily tell Meson to insert the version, so I'll do just that. |
Since Meson doesn't yet support CMake's ARCH_INDEPENDENT option, a pre-generated Package Version file is installed instead of generating it at configure time. I've also cleaned up a bit the nearby lines of code. Fixes marzer#140
0343c19
to
228dc33
Compare
@marzer since I'm working on the feature I described in #140 (comment), could you please explain a bit to me how |
The Speeding up compilation section has what you need, I suspect. |
I've read it, but it doesn't explain much. Let's say I have a #define TOML_HEADER_ONLY 0
#define TOML_IMPLEMENTATION
#include <toml++/toml.h> And then I compile that single file as it was a regular library. In meson terms: project('toml_lib', 'cpp')
lib = library('toml_lib', 'toml.cpp') Can I then link against that library from external projects? Are shared symbols generated? How much of toml++ gets compiled in there, and how much of the implementation is kept into the headers? |
Well, given that it's a header-only library, it explains exactly what it needs to explain to support that use-case.
The What's not obvious from that file is how much code is in the public
In that particular example (having the library included in a single cpp file) there is no difference between
That can be controlled by setting
Yup, if you configure the exports. See above. This is how we use the library at my workplace; it is exported from inside a larger DLL. Worth noting that is all pretty much the same as any other header-only library with an optional implementation target, like the stb libs, and a number of other popular ones. I'm not doing anything novel or tricky here. |
Thanks, visibility support is really useful when working with ABI compatibility
I've been in the coding world for just a few years (my first GitHub issue was opened in 2020), and I've never encountered header-only libraries that offer this kind of feature. So it might not be tricky to you, but is almost mind blowing to me :D Now everything is super clear, I'll submit a PR when ready. Thanks! |
Hah, interesting. I almost wish it wasn't that common, to be honest; the only reason header-only libs like mine have become popular is as a workaround for the absolute clusterfuck that is the C++ ecosystem, lmao |
b7a7ab6
to
f0feab9
Compare
As a vaguely-related aside: here's a big list of libs with similar designs to this one: https://github.com/nothings/single_file_libs - lots of good stuff in there. |
Yeah that's true lol, I wonder why. Anyway, could you please merge this PR so that I can branch off these changes to work on the other feature? I've also added a commit that avoids hardcoding |
Sure thing. Sorry, I assumed you were just gonna bundle the other work into this one. |
Since Meson doesn't yet support CMake's
ARCH_INDEPENDENT
option, a pre-generated Package Version file is installed instead of generating it at configure time.I've also cleaned up a bit the nearby lines of code.
Fixes #140
Pre-merge checklist
origin/master
(if necessary)