Comments (17)
__has_include is c++17 while spdlog v1.x is c++11
from spdlog.
__has_include is c++17 while spdlog v1.x is c++11
Another option is to install the generated config.h
file under the name tweakme.h
if the SPDLOG_GENERATE_CONFIG
flag is enabled.
from spdlog.
It looks like the
include/spdlog/tweakme.h
file should be automatically generated by CMake depending on the build configuration.
CMake shouldn't generate tweakme.h
, what makes you think it does?
from spdlog.
CMake shouldn't generate tweakme.h, what makes you think it does?
I think it should be auto-generated for feature parity with pkg-config and CMake configurations.
from spdlog.
Sorry. I am not a native speaker so I misunderstood the meaning.
spdlog was initially a header-only library. The option to build as a shared or static library was added later.
I believe that when it was header-only, there was no automatic tweakme.h
generation because there was no significant difference between downloading and installing.
It is technically possible to generate tweakme.h
at build time.
However, this may cause inconvenience for some users who still use spdlog as a header-only library and they have multiple projects using spdlog (even though spdlog is installed as a library, users can use it as a header-only library with a CMake target named spdlog::spdlog_header_only
).
The final decision must be made by the maintainer @gabime.
from spdlog.
However, this may cause inconvenience for some users who still use spdlog as a header-only library and they have multiple projects using spdlog (even though spdlog is installed as a library, users can use it as a header-only library with a CMake target named spdlog::spdlog_header_only).
Auto-generation can be enabled only if the SPDLOG_BUILD_SHARED
flag is set.
from spdlog.
spdlog::spdlog_header_only
target is added with or without the SPDLOG_BUILD_SHARED
flag.
When installed by CMake, spdlog can be either header-only and static/shared library.
from spdlog.
When installed by CMake, spdlog can be either header-only and static/shared library.
Yes, but it has major issues with packages not using pkg-config or CMake. For more information please check this ticket.
from spdlog.
I’ve been working on something like this in the v2.x branch. cmake would generate a config.h file. Not sure yet if this the right approach though..
from spdlog.
If this is considered a major change, it would make sense to automatically generate a configuration file from v2.
I personally think it is better to keep the style of macro definition by the developer as before, as it may confuse some users to automatically generate tweakme.h
in v1.
from spdlog.
cmake would generate a config.h file. Not sure yet if this the right approach though..
Looks good. Is it possible to backport this to 1.x?
from spdlog.
Porting it to v1.x would break current usage of tweakme.h or add confusion if generate a new file in addition to tweakme.h.
from spdlog.
Porting it to v1.x would break current usage of tweakme.h or add confusion if generate a new file in addition to tweakme.h.
Even if it will be optional and disabled by default? SPDLOG_GENERATE_CONFIG
for example. This feature can be very useful for Linux package maintainers.
If enabled, the config.h
file will be generated and installed instead of tweakme.h
.
from spdlog.
How would the new config.h be included by the code? Also note that when consuming spdlog
using cmake find_ pacakge, cmake already adds the right defines(e.g. target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB)
,so what would happen if both methods used. Still seems confusing.
from spdlog.
If a macro was defined when the library was built, CMake will define the same macro for the application to be linked.
If the same macro is also defined in config.h
, the macro definitions will be duplicated, but as long as the definitions are the same, this should not be a problem.
from spdlog.
How would the new config.h be included by the code?
Something like that:
#if __has_include(<spdlog/config.h>)
#include <spdlog/config.h>
#else
#include <spdlog/tweakme.h>
#endif
Also note that when consuming spdlog using cmake find_ pacakge, cmake already adds the right defines(e.g. target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB) ,so what would happen if both methods used. Still seems confusing.
Yes, but we're talking about a situation where the packages don't use pkg-config or CMake.
from spdlog.
Perhaps a SPDLOG_GENERATE_TWEAKME_H
cmake option (default=OFF) is indeed good way to solve this for 1.x.
PR is welcme.
from spdlog.
Related Issues (20)
- Logging messages within a custom sink causes a dead lock? HOT 1
- does SPDLOG consider control characters encountered when printing a character array as string termination markers? HOT 1
- Set a log zone prefix to default logger HOT 2
- Memory overflow warning in pattern_formatter-inl.h HOT 1
- Is there a plan to update the included libfmt to fix fmtlib/fmt#3540? HOT 8
- C++20 Modules "'std::basic_string': redefinition" HOT 2
- Make source_loc more resilient to invalid data HOT 3
- Show the lower digits of numeric fields, such as thread-id HOT 2
- spdlog::init_thread_pool caused a Segmentation fault HOT 4
- Can't create directory and file like "D:/Logs/log.txt" HOT 14
- Header-only version 1.14.0 complie with errors HOT 6
- spdlog 1.14.0: undefined reference to `spdlog::get(char const*)' HOT 14
- vs编译工作正常, g++编译报错 HOT 5
- Async logging using MDC HOT 6
- Does the dist_sink support Factory pattern to create a new logger? HOT 3
- COMBINE "daily_file_sink" AND "rotating_file_sink" HOT 2
- How register work? HOT 3
- Does SPDLOG support conditional logging? HOT 6
- solution : "rotating_file_sink: failed renaming: permission denied " HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdlog.