|
|
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
|
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
|
|
|
|
|
|
#ifndef SPDLOG_COMPILED_LIB
|
|
|
|
#error Please define SPDLOG_COMPILED_LIB to compile this file.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
Uses GenerateExportHeaders from cmake to export only symbols needed externally
This should only affect the library part, and to be more specific, the shared
library part. Cmake allows to generate a special header file through
GenerateExportHeader()[1]. This defines - amongst other - a SPDLOG_EXPORT
Symbol, that does the right thing, depending on compiler / OS. On Windows,
default is, if I recall correctly, that all symbols are not exported while
Linux does it the other way around. So this patch sets default to *not* export
symbols except those marked SPDLOG_EXPORT. Behaviour with Windows and Linux
should be the same. Also, I removed SPDLOG_BUILD_SHARED in favour of the
standard BUILD_SHARED_LIBS, which is a global symbol. This *might* give some
issues when used as add_subdirectory(), but I am not sure.
Also I made Threads::Threads private, so a depending cmake package does not
need to have find_package(Threads) on.
Why all that? On x86_64, gcc 8.3.0 .so code size reduction is:
811320 bytes original vs. 532536 now (~65% of the original). And, I *guess*,
this will resolve the issue that it is not possible to use shared libs
with windows. But I cannot test it, I only have Linux.
[1] https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html
Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
6 years ago
|
|
|
#ifdef SPDLOG_USE_EXPORT_HEADER
|
|
|
|
#include "spdlog_export.h"
|
|
|
|
#else
|
|
|
|
#define SPDLOG_EXPORT
|
|
|
|
#endif
|
|
|
|
#include "spdlog/details/null_mutex.h"
|
|
|
|
#include "spdlog/async.h"
|
|
|
|
#include "spdlog/sinks/stdout_sinks-inl.h"
|
|
|
|
|
Uses GenerateExportHeaders from cmake to export only symbols needed externally
This should only affect the library part, and to be more specific, the shared
library part. Cmake allows to generate a special header file through
GenerateExportHeader()[1]. This defines - amongst other - a SPDLOG_EXPORT
Symbol, that does the right thing, depending on compiler / OS. On Windows,
default is, if I recall correctly, that all symbols are not exported while
Linux does it the other way around. So this patch sets default to *not* export
symbols except those marked SPDLOG_EXPORT. Behaviour with Windows and Linux
should be the same. Also, I removed SPDLOG_BUILD_SHARED in favour of the
standard BUILD_SHARED_LIBS, which is a global symbol. This *might* give some
issues when used as add_subdirectory(), but I am not sure.
Also I made Threads::Threads private, so a depending cmake package does not
need to have find_package(Threads) on.
Why all that? On x86_64, gcc 8.3.0 .so code size reduction is:
811320 bytes original vs. 532536 now (~65% of the original). And, I *guess*,
this will resolve the issue that it is not possible to use shared libs
with windows. But I cannot test it, I only have Linux.
[1] https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html
Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
6 years ago
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stdout_sink_base<spdlog::details::console_mutex>;
|
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stdout_sink_base<spdlog::details::console_nullmutex>;
|
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stdout_sink<spdlog::details::console_mutex>;
|
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stdout_sink<spdlog::details::console_nullmutex>;
|
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stderr_sink<spdlog::details::console_mutex>;
|
|
|
|
template class SPDLOG_EXPORT spdlog::sinks::stderr_sink<spdlog::details::console_nullmutex>;
|
|
|
|
|
Uses GenerateExportHeaders from cmake to export only symbols needed externally
This should only affect the library part, and to be more specific, the shared
library part. Cmake allows to generate a special header file through
GenerateExportHeader()[1]. This defines - amongst other - a SPDLOG_EXPORT
Symbol, that does the right thing, depending on compiler / OS. On Windows,
default is, if I recall correctly, that all symbols are not exported while
Linux does it the other way around. So this patch sets default to *not* export
symbols except those marked SPDLOG_EXPORT. Behaviour with Windows and Linux
should be the same. Also, I removed SPDLOG_BUILD_SHARED in favour of the
standard BUILD_SHARED_LIBS, which is a global symbol. This *might* give some
issues when used as add_subdirectory(), but I am not sure.
Also I made Threads::Threads private, so a depending cmake package does not
need to have find_package(Threads) on.
Why all that? On x86_64, gcc 8.3.0 .so code size reduction is:
811320 bytes original vs. 532536 now (~65% of the original). And, I *guess*,
this will resolve the issue that it is not possible to use shared libs
with windows. But I cannot test it, I only have Linux.
[1] https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html
Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
6 years ago
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_logger_mt<spdlog::synchronous_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st<spdlog::synchronous_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt<spdlog::synchronous_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<spdlog::synchronous_factory>(const std::string &logger_name);
|
|
|
|
|
Uses GenerateExportHeaders from cmake to export only symbols needed externally
This should only affect the library part, and to be more specific, the shared
library part. Cmake allows to generate a special header file through
GenerateExportHeader()[1]. This defines - amongst other - a SPDLOG_EXPORT
Symbol, that does the right thing, depending on compiler / OS. On Windows,
default is, if I recall correctly, that all symbols are not exported while
Linux does it the other way around. So this patch sets default to *not* export
symbols except those marked SPDLOG_EXPORT. Behaviour with Windows and Linux
should be the same. Also, I removed SPDLOG_BUILD_SHARED in favour of the
standard BUILD_SHARED_LIBS, which is a global symbol. This *might* give some
issues when used as add_subdirectory(), but I am not sure.
Also I made Threads::Threads private, so a depending cmake package does not
need to have find_package(Threads) on.
Why all that? On x86_64, gcc 8.3.0 .so code size reduction is:
811320 bytes original vs. 532536 now (~65% of the original). And, I *guess*,
this will resolve the issue that it is not possible to use shared libs
with windows. But I cannot test it, I only have Linux.
[1] https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html
Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
6 years ago
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_logger_mt<spdlog::async_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st<spdlog::async_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt<spdlog::async_factory>(const std::string &logger_name);
|
|
|
|
template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<spdlog::async_factory>(const std::string &logger_name);
|