Replies: 1 comment
-
There is also a shared library example in the examples folder but ideally please avoid it. The reason is that internally thread local variables are used that might behave differently in shared and static libraries affecting performance. It won’t make any difference in compile times if you build it as static or shared. The repo is header only library, but certain things can be built into a static library. This will avoid rebuilding things when you edit your files that belong to the same translation unit as where the Backend is included You need to follow the full example here https://github.com/odygrd/quill/tree/master/examples/recommended_usage it should be self explanatory, you create a quill_wrapper static lib that you link in your app. You can customise https://github.com/odygrd/quill/blob/3df568b2a61a288a9e3107b85309f812ea75de5b/examples/recommended_usage/quill_wrapper/include/quill_wrapper/quill_wrapper.cpp based on your needs that you use in your main.cpp In any other translation unit that you log you just need to link against your static library. You only need to include two headers to log let me know if you have any questions |
Beta Was this translation helpful? Give feedback.
-
It would be one solution to compile quill into one shared library.
what's the disadvantage of this?
what's the recommanded usage?
I found this. Then how to compile quill into static library?
1 │ /**
2 │ * This example demonstrates the recommended setup for the Quill library.
3 │ *
4 │ * It is advisable to encapsulate the header-only library into a static library, which
5 │ * you build once and link to your main application.
6 │ * This library should include
quill/backend
in the .cpp files.7 │ *
8 │ * In your application, include only the following headers for logging:
9 │ *
10 │ * - For logger lookup or creation:
11 │ * #include "quill/Frontend.h"
12 │ *
13 │ * - For sink creation:
14 │ * #include "quill/sinks/.."
15 │ *
16 │ * - For logging:
17 │ * #include "quill/Logger.h"
18 │ * #include "quill/LogMacros.h"
Beta Was this translation helpful? Give feedback.
All reactions