-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Enable Users to Opt-In to Building Catch2 as a Shared Library #2397
Comments
Interesting. I never noticed linking against a dynamic lib to be faster. Which platform are you on? Do you have any benchmarks to share that show the speedup? Thank you, Fini |
Linking statically with Catch produces huge binaries (around 1.1MiB per binary). After I migrated to version 3.0.1. the size of all of my build directories went up by about 15GiB in total. In previous versions (where you had to compile Catch inside your project) you were at least able to create a shared library. This ability is now completely gone and makes Catch basically unusable to me in its current form. |
Wow. 13600 binaries! Not bad 👍 |
I do have around 1300 binaries that link against Catch and I have different configurations that I test (i.e. different compilers, settings, etc.). All in all this is just a rough estimate. |
I just changed "STATIC" to "SHARED" in Catch to reclaim my disk space for the time being. As somebody noted in the CMakeLists file, doing a shared library "requires" annotating C++ functions/globals to declare their visibility. This is a good idea in general because Linux binaries can also benefit from this (using -fvisibility=hidden). I'm hoping that this will find its way into an official release in some way or another. |
Description
Build times when tend to be much faster when linking against a shared library as compared to linking against a statically linked library. These improved build times allow for faster iteration on projects and a smoother development experience.
Right now, Catch2 can only be built as a statically linked library, even when
-DBUILD_SHARED_LIBS=ON
is passed to CMake.Changes required
Remove
STATIC
declaration when invokingadd_library
for Catch2 and Catch2WithMainImpact on Existing Code
Little to none. Catch2 will continue to build statically linked by default.
The text was updated successfully, but these errors were encountered: