mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Provide a build build system for both system-wide installation and bundling #117
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nemequ on GitHub (Jun 14, 2016).
Since Squash bundles Brotli in our tree, we basically maintain a separate build system for Brotli. I'm trying to reduce the amount of duplication between Squash and the libraries it bundles, so I'd like to be able to reuse Brotli's build system, which would mean making it compatible with our own (CMake-based) build-system. Obviously such a system wouldn't be specific to Squash; any project which uses CMake and wants to bundle Brotli could benefit from it. With such a system, bundling Brotli would be as simple as something like:
Brotli would then be built as part of the parent project, including unit tests (which could also automatically integrate with ctest, so running
make testwould run brotli's tests as well) and documentation (if applicable).The rest of this is largely copied from quixdb/squash#202, edited slightly to be specific to brotli.
From Squash's perspective, as well as anyone else who wants to bundle the library, what we need is a way to build a static library (or two, if you want to separate the encoder and decoder), disable any installation, and control whether or not to have CTest run unit tests. Finally, it would be great if we could simply reference a target and have it automatically set any necessary flags (CMake ≥ 2.8.11 can do this, you just need to set the proper
INTERFACE_*target properties).If you would like to see an example of a system which works the way we want, take a look at BriefLZ's. I'm willing to create a similar system for Brotli, though obviously it would need to be a bit more extensive since Brotli is a larger project. I don't want to fork anything, so if you aren't interested we'll just stick with the current system for that plugin. Obviously not everyone is familiar with CMake so part of this is that I would help with maintenance as needed. However, before I proceed I need a few questions answered:
First, are you willing to provide a CMake-based build system in your tree? If so, are you okay with making it flexible enough to meet our needs as described above? If no to either of those, you can go ahead and close this issue and we'll keep interacting with Brotli just as we do today. Otherwise, there are a few ways to put this together:
contrib/cmake).Note that it may be necessary to put supplementary modules in a single directory somewhere. I usually use a
cmakesubdirectory alongside the highest level CMakeLists.txt, wherever that is.Options (1) and (2) basically treat CMake as a first-class citizen, whereas (3) makes it pretty clear that CMake is an option, but may not really be the recommended way to build your project. Option (1) vs. (2) is mostly just about style; (1) puts your entire build system in one place, whereas (2) keeps the logic closer to the code. I prefer (2), but it's up to you.
Would you want CMake to replace your current system, or would you prefer for the two to exist in parallel?
Also, there are some optional features which I need to know if you would like to support (assuming you don't already, obviously we can't really remove features):
Note that, as mentioned above, installation would need to be optional (projects integrating your project into their own tree probably don't want to install your CLI).
Finally, if custom CMake modules are necessary (see https://github.com/quixdb/squash/tree/master/cmake for some examples), would you prefer to copy the modules into your tree, or use a git submodule?