I am maintaining a FOSS library which, for the sake of discussion, consists of a small .h file and a larger .c file (plus build-related files, see below)
I've been requested to offer this library as a single header file. My instinct was to just refuse, as one could simply include both the .c and and the .h file, but I suppose maybe it's somehow useful for some people to enjoy this single-file convenience.
My question is: How should I arrange for both the two sources to be available, and the single-file version? There seem to be lots of options here:
- Just duplicate the code, and have another
.hwith everything in it checked in to the repository. - Generate the combined
.has part of the build process - but, how do I do that effectively? Do I use regular expressions? I can't preprocess the files - that will result in all macros being expanded. - Switch to having a single
.hin the repository, only, and generate the smaller.hdynamically - but then, same problem as the previous item - how does one do that effectively? - Decide it's a useless endeavor and refuse to offer a single header file.
What should I know about the feasibility, pros and cons of these options? And - is there other ones I've overlooked?
Notes:
- The library's repository is on GitHub and there are occasional versioned releases of the source code.
- I use CMake for build configuration and installation, so solutions requiring automation can rely on this fact. But since I made this a general question, describing other automation schemes is a legitimate answer.
.cfile an include guard and 2. Raising the bar with something like "get 3 more people to ask for this and we'll talk".