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>
pull/1257/head
Matthias Schoepfer 6 years ago
parent 1aa9ea92e2
commit d05c507c04

@ -41,11 +41,6 @@ if (NOT DEFINED SPDLOG_MASTER_PROJECT)
endif() endif()
endif () endif ()
# build shared option
if(NOT WIN32)
option(SPDLOG_BUILD_SHARED "Build shared library" OFF)
endif()
# example options # example options
option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT}) option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT})
option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF) option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF)
@ -101,13 +96,14 @@ if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO)
list(APPEND SPDLOG_SRCS src/fmt.cpp) list(APPEND SPDLOG_SRCS src/fmt.cpp)
endif() endif()
if (SPDLOG_BUILD_SHARED) add_library(spdlog ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
if(WIN32) add_library(spdlog::spdlog ALIAS spdlog)
message(FATAL_ERROR "spdlog shared lib is not yet supported under windows")
endif() if (BUILD_SHARED_LIBS)
add_library(spdlog SHARED ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS}) generate_export_header(spdlog)
else() target_compile_definitions(spdlog PRIVATE SPDLOG_USE_EXPORT_HEADER)
add_library(spdlog STATIC ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS}) set_target_properties(spdlog PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(spdlog PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
endif() endif()
add_library(spdlog::spdlog ALIAS spdlog) add_library(spdlog::spdlog ALIAS spdlog)
@ -115,8 +111,10 @@ add_library(spdlog::spdlog ALIAS spdlog)
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB) target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)
target_include_directories(spdlog PUBLIC target_include_directories(spdlog PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>") "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_link_libraries(spdlog PUBLIC Threads::Threads)
target_link_libraries(spdlog PRIVATE Threads::Threads)
spdlog_enable_warnings(spdlog) spdlog_enable_warnings(spdlog)
set_target_properties(spdlog PROPERTIES VERSION ${SPDLOG_VERSION} SOVERSION ${SPDLOG_VERSION_MAJOR}) set_target_properties(spdlog PROPERTIES VERSION ${SPDLOG_VERSION} SOVERSION ${SPDLOG_VERSION_MAJOR})
@ -130,7 +128,9 @@ add_library(spdlog::spdlog_header_only ALIAS spdlog_header_only)
target_include_directories(spdlog_header_only INTERFACE target_include_directories(spdlog_header_only INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>") "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_link_libraries(spdlog_header_only INTERFACE Threads::Threads) target_link_libraries(spdlog_header_only INTERFACE Threads::Threads)
@ -154,6 +154,10 @@ if(SPDLOG_FMT_EXTERNAL OR SPDLOG_FMT_EXTERNAL_HO)
endif() endif()
set(PKG_CONFIG_REQUIRES fmt) # add dependency to pkg-config set(PKG_CONFIG_REQUIRES fmt) # add dependency to pkg-config
else()
if (BUILD_SHARED_LIBS)
target_compile_definitions(spdlog PRIVATE FMT_SHARED)
endif()
endif() endif()
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
@ -241,6 +245,8 @@ if (SPDLOG_INSTALL)
# Include files # Include files
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" PATTERN "fmt/bundled" EXCLUDE) install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" PATTERN "fmt/bundled" EXCLUDE)
install(FILES ${PROJECT_BINARY_DIR}/spdlog_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS spdlog spdlog_header_only EXPORT spdlog DESTINATION "${CMAKE_INSTALL_LIBDIR}") install(TARGETS spdlog spdlog_header_only EXPORT spdlog DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO) if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO)

@ -19,7 +19,7 @@
namespace spdlog { namespace spdlog {
// Async overflow policy - block by default. // Async overflow policy - block by default.
enum class async_overflow_policy enum class SPDLOG_EXPORT async_overflow_policy
{ {
block, // Block until message can be enqueued block, // Block until message can be enqueued
overrun_oldest // Discard oldest message in the queue if full when trying to overrun_oldest // Discard oldest message in the queue if full when trying to
@ -30,7 +30,7 @@ namespace details {
class thread_pool; class thread_pool;
} }
class async_logger final : public std::enable_shared_from_this<async_logger>, public logger class SPDLOG_EXPORT async_logger final : public std::enable_shared_from_this<async_logger>, public logger
{ {
friend class details::thread_pool; friend class details::thread_pool;

@ -5,6 +5,19 @@
#include <spdlog/tweakme.h> #include <spdlog/tweakme.h>
#include <spdlog/details/null_mutex.h> #include <spdlog/details/null_mutex.h>
#ifdef SPDLOG_USE_EXPORT_HEADER
# include "spdlog_export.h"
#else
# define SPDLOG_EXPORT
# if defined(__GNUC__) || defined(__clang__)
# define SPDLOG_DEPRECATED __attribute__((deprecated))
# elif defined(_MSC_VER)
# define SPDLOG_DEPRECATED __declspec(deprecated)
# else
# define SPDLOG_DEPRECATED
# endif
#endif
#include <atomic> #include <atomic>
#include <chrono> #include <chrono>
@ -46,14 +59,6 @@
#define SPDLOG_CONSTEXPR constexpr #define SPDLOG_CONSTEXPR constexpr
#endif #endif
#if defined(__GNUC__) || defined(__clang__)
#define SPDLOG_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define SPDLOG_DEPRECATED __declspec(deprecated)
#else
#define SPDLOG_DEPRECATED
#endif
// disable thread local on msvc 2013 // disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS #ifndef SPDLOG_NO_TLS
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
@ -138,7 +143,7 @@ using level_t = std::atomic<int>;
// Log level enum // Log level enum
namespace level { namespace level {
enum level_enum enum SPDLOG_EXPORT level_enum
{ {
trace = SPDLOG_LEVEL_TRACE, trace = SPDLOG_LEVEL_TRACE,
debug = SPDLOG_LEVEL_DEBUG, debug = SPDLOG_LEVEL_DEBUG,
@ -164,8 +169,13 @@ enum level_enum
} }
#endif #endif
SPDLOG_EXPORT
string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT; spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;
using level_hasher = std::hash<int>; using level_hasher = std::hash<int>;
@ -174,7 +184,7 @@ using level_hasher = std::hash<int>;
// //
// Color mode used by sinks with color support. // Color mode used by sinks with color support.
// //
enum class color_mode enum class SPDLOG_EXPORT color_mode
{ {
always, always,
automatic, automatic,
@ -185,7 +195,7 @@ enum class color_mode
// Pattern time - specific time getting to use for pattern_formatter. // Pattern time - specific time getting to use for pattern_formatter.
// local time by default // local time by default
// //
enum class pattern_time_type enum class SPDLOG_EXPORT pattern_time_type
{ {
local, // log localtime local, // log localtime
utc // log utc utc // log utc
@ -194,7 +204,7 @@ enum class pattern_time_type
// //
// Log exception // Log exception
// //
class spdlog_ex : public std::exception class SPDLOG_EXPORT spdlog_ex : public std::exception
{ {
public: public:
explicit spdlog_ex(std::string msg); explicit spdlog_ex(std::string msg);
@ -205,7 +215,7 @@ private:
std::string msg_; std::string msg_;
}; };
struct source_loc struct SPDLOG_EXPORT source_loc
{ {
SPDLOG_CONSTEXPR source_loc() = default; SPDLOG_CONSTEXPR source_loc() = default;
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in) SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)

@ -3,6 +3,12 @@
#pragma once #pragma once
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include <spdlog/details/log_msg_buffer.h> #include <spdlog/details/log_msg_buffer.h>
#include <spdlog/details/circular_q.h> #include <spdlog/details/circular_q.h>
@ -15,7 +21,7 @@
namespace spdlog { namespace spdlog {
namespace details { namespace details {
class backtracer class SPDLOG_EXPORT backtracer
{ {
mutable std::mutex mutex_; mutable std::mutex mutex_;
std::atomic<bool> enabled_{false}; std::atomic<bool> enabled_{false};

@ -3,13 +3,18 @@
#pragma once #pragma once
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include <spdlog/details/null_mutex.h> #include <spdlog/details/null_mutex.h>
#include <mutex> #include <mutex>
namespace spdlog { namespace spdlog {
namespace details { namespace details {
struct console_mutex struct SPDLOG_EXPORT console_mutex
{ {
using mutex_t = std::mutex; using mutex_t = std::mutex;
static mutex_t &mutex() static mutex_t &mutex()
@ -19,7 +24,7 @@ struct console_mutex
} }
}; };
struct console_nullmutex struct SPDLOG_EXPORT console_nullmutex
{ {
using mutex_t = null_mutex; using mutex_t = null_mutex;
static mutex_t &mutex() static mutex_t &mutex()

@ -13,7 +13,7 @@ namespace details {
// When failing to open a file, retry several times(5) with a delay interval(10 ms). // When failing to open a file, retry several times(5) with a delay interval(10 ms).
// Throw spdlog_ex exception on errors. // Throw spdlog_ex exception on errors.
class file_helper class SPDLOG_EXPORT file_helper
{ {
public: public:
explicit file_helper() = default; explicit file_helper() = default;

@ -8,7 +8,7 @@
namespace spdlog { namespace spdlog {
namespace details { namespace details {
struct log_msg struct SPDLOG_EXPORT log_msg
{ {
log_msg() = default; log_msg() = default;
log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg); log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg);

@ -3,6 +3,11 @@
#pragma once #pragma once
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include <spdlog/details/log_msg.h> #include <spdlog/details/log_msg.h>
namespace spdlog { namespace spdlog {
@ -11,7 +16,7 @@ namespace details {
// Extend log_msg with internal buffer to store its payload. // Extend log_msg with internal buffer to store its payload.
// THis is needed since log_msg holds string_views that points to stack data. // THis is needed since log_msg holds string_views that points to stack data.
class log_msg_buffer : public log_msg class SPDLOG_EXPORT log_msg_buffer : public log_msg
{ {
memory_buf_t buffer; memory_buf_t buffer;
void update_string_views(); void update_string_views();

@ -3,13 +3,19 @@
#pragma once #pragma once
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include <atomic> #include <atomic>
#include <utility> #include <utility>
// null, no cost dummy "mutex" and dummy "atomic" int // null, no cost dummy "mutex" and dummy "atomic" int
namespace spdlog { namespace spdlog {
namespace details { namespace details {
struct null_mutex struct SPDLOG_EXPORT null_mutex
{ {
void lock() const {} void lock() const {}
void unlock() const {} void unlock() const {}
@ -19,7 +25,7 @@ struct null_mutex
} }
}; };
struct null_atomic_int struct SPDLOG_EXPORT null_atomic_int
{ {
int value; int value;
null_atomic_int() = default; null_atomic_int() = default;

@ -10,14 +10,19 @@ namespace spdlog {
namespace details { namespace details {
namespace os { namespace os {
SPDLOG_EXPORT
spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT; spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
std::tm localtime() SPDLOG_NOEXCEPT; std::tm localtime() SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
std::tm gmtime() SPDLOG_NOEXCEPT; std::tm gmtime() SPDLOG_NOEXCEPT;
// eol definition // eol definition
@ -39,52 +44,67 @@ SPDLOG_CONSTEXPR static const char folder_sep = '/';
#endif #endif
#ifdef SPDLOG_PREVENT_CHILD_FD #ifdef SPDLOG_PREVENT_CHILD_FD
SPDLOG_EXPORT
void prevent_child_fd(FILE *f); void prevent_child_fd(FILE *f);
#endif #endif
// fopen_s on non windows for writing // fopen_s on non windows for writing
SPDLOG_EXPORT
bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode); bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode);
// Remove filename. return 0 on success // Remove filename. return 0 on success
SPDLOG_EXPORT
int remove(const filename_t &filename) SPDLOG_NOEXCEPT; int remove(const filename_t &filename) SPDLOG_NOEXCEPT;
// Remove file if exists. return 0 on success // Remove file if exists. return 0 on success
// Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread) // Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread)
SPDLOG_EXPORT
int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT; int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT; int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT;
// Return if file exists. // Return if file exists.
SPDLOG_EXPORT
bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT; bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
// Return file size according to open FILE* object // Return file size according to open FILE* object
SPDLOG_EXPORT
size_t filesize(FILE *f); size_t filesize(FILE *f);
// Return utc offset in minutes or throw spdlog_ex on failure // Return utc offset in minutes or throw spdlog_ex on failure
SPDLOG_EXPORT
int utc_minutes_offset(const std::tm &tm = details::os::localtime()); int utc_minutes_offset(const std::tm &tm = details::os::localtime());
// Return current thread id as size_t // Return current thread id as size_t
// It exists because the std::this_thread::get_id() is much slower(especially // It exists because the std::this_thread::get_id() is much slower(especially
// under VS 2013) // under VS 2013)
SPDLOG_EXPORT
size_t _thread_id() SPDLOG_NOEXCEPT; size_t _thread_id() SPDLOG_NOEXCEPT;
// Return current thread id as size_t (from thread local storage) // Return current thread id as size_t (from thread local storage)
SPDLOG_EXPORT
size_t thread_id() SPDLOG_NOEXCEPT; size_t thread_id() SPDLOG_NOEXCEPT;
// This is avoid msvc issue in sleep_for that happens if the clock changes. // This is avoid msvc issue in sleep_for that happens if the clock changes.
// See https://github.com/gabime/spdlog/issues/609 // See https://github.com/gabime/spdlog/issues/609
SPDLOG_EXPORT
void sleep_for_millis(int milliseconds) SPDLOG_NOEXCEPT; void sleep_for_millis(int milliseconds) SPDLOG_NOEXCEPT;
SPDLOG_EXPORT
std::string filename_to_str(const filename_t &filename); std::string filename_to_str(const filename_t &filename);
SPDLOG_EXPORT
int pid() SPDLOG_NOEXCEPT; int pid() SPDLOG_NOEXCEPT;
// Determine if the terminal supports colors // Determine if the terminal supports colors
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
SPDLOG_EXPORT
bool is_color_terminal() SPDLOG_NOEXCEPT; bool is_color_terminal() SPDLOG_NOEXCEPT;
// Determine if the terminal attached // Determine if the terminal attached
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
SPDLOG_EXPORT
bool in_terminal(FILE *file) SPDLOG_NOEXCEPT; bool in_terminal(FILE *file) SPDLOG_NOEXCEPT;
#if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32) #if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32)
@ -96,10 +116,12 @@ void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target);
// "abc/" => "abc" // "abc/" => "abc"
// "abc" => "" // "abc" => ""
// "abc///" => "abc//" // "abc///" => "abc//"
SPDLOG_EXPORT
filename_t dir_name(filename_t path); filename_t dir_name(filename_t path);
// Create a dir from the given path. // Create a dir from the given path.
// Return true if succeeded or if this dir already exists. // Return true if succeeded or if this dir already exists.
SPDLOG_EXPORT
bool create_dir(filename_t path); bool create_dir(filename_t path);
} // namespace os } // namespace os

@ -19,7 +19,7 @@ namespace spdlog {
namespace details { namespace details {
// padding information. // padding information.
struct padding_info struct SPDLOG_EXPORT padding_info
{ {
enum pad_side enum pad_side
{ {
@ -46,7 +46,7 @@ struct padding_info
bool enabled_ = false; bool enabled_ = false;
}; };
class flag_formatter class SPDLOG_EXPORT flag_formatter
{ {
public: public:
explicit flag_formatter(padding_info padinfo) explicit flag_formatter(padding_info padinfo)
@ -62,7 +62,7 @@ protected:
} // namespace details } // namespace details
class pattern_formatter final : public formatter class SPDLOG_EXPORT pattern_formatter final : public formatter
{ {
public: public:
explicit pattern_formatter( explicit pattern_formatter(

@ -24,7 +24,7 @@ namespace details {
class thread_pool; class thread_pool;
class periodic_worker; class periodic_worker;
class registry class SPDLOG_EXPORT registry
{ {
public: public:
registry(const registry &) = delete; registry(const registry &) = delete;

@ -20,7 +20,7 @@ namespace details {
using async_logger_ptr = std::shared_ptr<spdlog::async_logger>; using async_logger_ptr = std::shared_ptr<spdlog::async_logger>;
enum class async_msg_type enum class SPDLOG_EXPORT async_msg_type
{ {
log, log,
flush, flush,
@ -30,7 +30,7 @@ enum class async_msg_type
#include <spdlog/details/log_msg_buffer.h> #include <spdlog/details/log_msg_buffer.h>
// Async msg to move to/from the queue // Async msg to move to/from the queue
// Movable only. should never be copied // Movable only. should never be copied
struct async_msg : log_msg_buffer struct SPDLOG_EXPORT async_msg : log_msg_buffer
{ {
async_msg_type msg_type{async_msg_type::log}; async_msg_type msg_type{async_msg_type::log};
async_logger_ptr worker_ptr; async_logger_ptr worker_ptr;
@ -79,7 +79,7 @@ struct async_msg : log_msg_buffer
{} {}
}; };
class thread_pool class SPDLOG_EXPORT thread_pool
{ {
public: public:
using item_type = async_msg; using item_type = async_msg;

@ -152,12 +152,20 @@
FMT_INLINE_NAMESPACE v6 { FMT_INLINE_NAMESPACE v6 {
#endif #endif
#if !defined(FMT_HEADER_ONLY) && defined(_WIN32) #if !defined(FMT_HEADER_ONLY)
# ifdef SPDLOG_USE_EXPORT_HEADER
# include "spdlog_export.h"
# define FMT_API SPDLOG_EXPORT
# elif defined (_WIN32)
# ifdef FMT_EXPORT # ifdef FMT_EXPORT
# define FMT_API __declspec(dllexport) # define FMT_API __declspec(dllexport)
# elif defined(FMT_SHARED) # elif defined(FMT_SHARED)
# define FMT_API __declspec(dllimport) # define FMT_API __declspec(dllimport)
# define FMT_EXTERN_TEMPLATE_API FMT_API # define FMT_EXTERN_TEMPLATE_API FMT_API
# else
# define FMT_API
# define FMT_EXTERN_TEMPLATE_API
# endif
# endif # endif
#endif #endif
#ifndef FMT_API #ifndef FMT_API

@ -8,7 +8,7 @@
namespace spdlog { namespace spdlog {
class formatter class SPDLOG_EXPORT formatter
{ {
public: public:
virtual ~formatter() = default; virtual ~formatter() = default;

@ -39,7 +39,7 @@
namespace spdlog { namespace spdlog {
class logger class SPDLOG_EXPORT logger
{ {
public: public:
// Empty logger // Empty logger
@ -365,6 +365,7 @@ protected:
void err_handler_(const std::string &msg); void err_handler_(const std::string &msg);
}; };
SPDLOG_EXPORT
void swap(logger &a, logger &b); void swap(logger &a, logger &b);
} // namespace spdlog } // namespace spdlog

@ -28,7 +28,7 @@ namespace sinks {
* Android sink (logging using __android_log_write) * Android sink (logging using __android_log_write)
*/ */
template<typename Mutex> template<typename Mutex>
class android_sink final : public base_sink<Mutex> class SPDLOG_EXPORT android_sink final : public base_sink<Mutex>
{ {
public: public:
explicit android_sink(std::string tag = "spdlog", bool use_raw_msg = false) explicit android_sink(std::string tag = "spdlog", bool use_raw_msg = false)

@ -16,7 +16,7 @@
namespace spdlog { namespace spdlog {
namespace sinks { namespace sinks {
template<typename Mutex> template<typename Mutex>
class base_sink : public sink class SPDLOG_EXPORT base_sink : public sink
{ {
public: public:
base_sink(); base_sink();

@ -17,7 +17,7 @@ namespace sinks {
* Trivial file sink with single file as target * Trivial file sink with single file as target
*/ */
template<typename Mutex> template<typename Mutex>
class basic_file_sink final : public base_sink<Mutex> class SPDLOG_EXPORT basic_file_sink final : public base_sink<Mutex>
{ {
public: public:
explicit basic_file_sink(const filename_t &filename, bool truncate = false); explicit basic_file_sink(const filename_t &filename, bool truncate = false);

@ -24,7 +24,7 @@ namespace sinks {
/* /*
* Generator of daily log file names in format basename.YYYY-MM-DD.ext * Generator of daily log file names in format basename.YYYY-MM-DD.ext
*/ */
struct daily_filename_calculator struct SPDLOG_EXPORT daily_filename_calculator
{ {
// Create filename for the form basename.YYYY-MM-DD // Create filename for the form basename.YYYY-MM-DD
static filename_t calc_filename(const filename_t &filename, const tm &now_tm) static filename_t calc_filename(const filename_t &filename, const tm &now_tm)
@ -42,7 +42,7 @@ struct daily_filename_calculator
* If max_files > 0, retain only the last max_files and delete previous. * If max_files > 0, retain only the last max_files and delete previous.
*/ */
template<typename Mutex, typename FileNameCalc = daily_filename_calculator> template<typename Mutex, typename FileNameCalc = daily_filename_calculator>
class daily_file_sink final : public base_sink<Mutex> class SPDLOG_EXPORT daily_file_sink final : public base_sink<Mutex>
{ {
public: public:
// create daily file sink which rotates on given time // create daily file sink which rotates on given time

@ -20,7 +20,7 @@ namespace spdlog {
namespace sinks { namespace sinks {
template<typename Mutex> template<typename Mutex>
class dist_sink : public base_sink<Mutex> class SPDLOG_EXPORT dist_sink : public base_sink<Mutex>
{ {
public: public:
dist_sink() = default; dist_sink() = default;

@ -36,7 +36,7 @@
namespace spdlog { namespace spdlog {
namespace sinks { namespace sinks {
template<typename Mutex> template<typename Mutex>
class dup_filter_sink : public dist_sink<Mutex> class SPDLOG_EXPORT dup_filter_sink : public dist_sink<Mutex>
{ {
public: public:
template<class Rep, class Period> template<class Rep, class Period>

@ -19,7 +19,7 @@ namespace sinks {
* MSVC sink (logging using OutputDebugStringA) * MSVC sink (logging using OutputDebugStringA)
*/ */
template<typename Mutex> template<typename Mutex>
class msvc_sink : public base_sink<Mutex> class SPDLOG_EXPORT msvc_sink : public base_sink<Mutex>
{ {
public: public:
explicit msvc_sink() {} explicit msvc_sink() {}

@ -13,7 +13,7 @@ namespace spdlog {
namespace sinks { namespace sinks {
template<typename Mutex> template<typename Mutex>
class null_sink : public base_sink<Mutex> class SPDLOG_EXPORT null_sink : public base_sink<Mutex>
{ {
protected: protected:
void sink_it_(const details::log_msg &) override {} void sink_it_(const details::log_msg &) override {}

@ -12,7 +12,7 @@
namespace spdlog { namespace spdlog {
namespace sinks { namespace sinks {
template<typename Mutex> template<typename Mutex>
class ostream_sink final : public base_sink<Mutex> class SPDLOG_EXPORT ostream_sink final : public base_sink<Mutex>
{ {
public: public:
explicit ostream_sink(std::ostream &os, bool force_flush = false) explicit ostream_sink(std::ostream &os, bool force_flush = false)

@ -19,7 +19,7 @@ namespace sinks {
// Rotating file sink based on size // Rotating file sink based on size
// //
template<typename Mutex> template<typename Mutex>
class rotating_file_sink final : public base_sink<Mutex> class SPDLOG_EXPORT rotating_file_sink final : public base_sink<Mutex>
{ {
public: public:
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false); rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false);

@ -9,7 +9,7 @@
namespace spdlog { namespace spdlog {
namespace sinks { namespace sinks {
class sink class SPDLOG_EXPORT sink
{ {
public: public:
virtual ~sink() = default; virtual ~sink() = default;

@ -9,6 +9,12 @@
#include <spdlog/sinks/ansicolor_sink.h> #include <spdlog/sinks/ansicolor_sink.h>
#endif #endif
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include <spdlog/details/synchronous_factory.h> #include <spdlog/details/synchronous_factory.h>
namespace spdlog { namespace spdlog {

@ -13,7 +13,7 @@ namespace spdlog {
namespace sinks { namespace sinks {
template<typename ConsoleMutex> template<typename ConsoleMutex>
class stdout_sink_base : public sink class SPDLOG_EXPORT stdout_sink_base : public sink
{ {
public: public:
using mutex_t = typename ConsoleMutex::mutex_t; using mutex_t = typename ConsoleMutex::mutex_t;

@ -16,7 +16,7 @@ namespace sinks {
* Sink that write to syslog using the `syscall()` library call. * Sink that write to syslog using the `syscall()` library call.
*/ */
template<typename Mutex> template<typename Mutex>
class syslog_sink : public base_sink<Mutex> class SPDLOG_EXPORT syslog_sink : public base_sink<Mutex>
{ {
public: public:

@ -22,7 +22,7 @@ namespace sinks {
* Locking is not needed, as `sd_journal_send()` itself is thread-safe. * Locking is not needed, as `sd_journal_send()` itself is thread-safe.
*/ */
template<typename Mutex> template<typename Mutex>
class systemd_sink : public base_sink<Mutex> class SPDLOG_EXPORT systemd_sink : public base_sink<Mutex>
{ {
public: public:
// //

@ -21,7 +21,7 @@ namespace sinks {
* colors * colors
*/ */
template<typename ConsoleMutex> template<typename ConsoleMutex>
class wincolor_sink : public sink class SPDLOG_EXPORT wincolor_sink : public sink
{ {
public: public:
const WORD BOLD = FOREGROUND_INTENSITY; const WORD BOLD = FOREGROUND_INTENSITY;
@ -65,14 +65,14 @@ protected:
}; };
template<typename ConsoleMutex> template<typename ConsoleMutex>
class wincolor_stdout_sink : public wincolor_sink<ConsoleMutex> class SPDLOG_EXPORT wincolor_stdout_sink : public wincolor_sink<ConsoleMutex>
{ {
public: public:
explicit wincolor_stdout_sink(color_mode mode = color_mode::automatic); explicit wincolor_stdout_sink(color_mode mode = color_mode::automatic);
}; };
template<typename ConsoleMutex> template<typename ConsoleMutex>
class wincolor_stderr_sink : public wincolor_sink<ConsoleMutex> class SPDLOG_EXPORT wincolor_stderr_sink : public wincolor_sink<ConsoleMutex>
{ {
public: public:
explicit wincolor_stderr_sink(color_mode mode = color_mode::automatic); explicit wincolor_stderr_sink(color_mode mode = color_mode::automatic);

@ -46,60 +46,77 @@ inline std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs
// auto console_sink = std::make_shared<spdlog::sinks::stdout_sink_mt>(); // auto console_sink = std::make_shared<spdlog::sinks::stdout_sink_mt>();
// auto console_logger = std::make_shared<spdlog::logger>("console_logger", console_sink); // auto console_logger = std::make_shared<spdlog::logger>("console_logger", console_sink);
// spdlog::initialize_logger(console_logger); // spdlog::initialize_logger(console_logger);
SPDLOG_EXPORT
void initialize_logger(std::shared_ptr<logger> logger); void initialize_logger(std::shared_ptr<logger> logger);
// Return an existing logger or nullptr if a logger with such name doesn't // Return an existing logger or nullptr if a logger with such name doesn't
// exist. // exist.
// example: spdlog::get("my_logger")->info("hello {}", "world"); // example: spdlog::get("my_logger")->info("hello {}", "world");
SPDLOG_EXPORT
std::shared_ptr<logger> get(const std::string &name); std::shared_ptr<logger> get(const std::string &name);
// Set global formatter. Each sink in each logger will get a clone of this object // Set global formatter. Each sink in each logger will get a clone of this object
SPDLOG_EXPORT
void set_formatter(std::unique_ptr<spdlog::formatter> formatter); void set_formatter(std::unique_ptr<spdlog::formatter> formatter);
// Set global format string. // Set global format string.
// example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v"); // example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v");
SPDLOG_EXPORT
void set_pattern(std::string pattern, pattern_time_type time_type = pattern_time_type::local); void set_pattern(std::string pattern, pattern_time_type time_type = pattern_time_type::local);
// enable global backtrace support // enable global backtrace support
SPDLOG_EXPORT
void enable_backtrace(size_t n_messages); void enable_backtrace(size_t n_messages);
// disable global backtrace support // disable global backtrace support
SPDLOG_EXPORT
void disable_backtrace(); void disable_backtrace();
// call dump backtrace on default logger // call dump backtrace on default logger
SPDLOG_EXPORT
void dump_backtrace(); void dump_backtrace();
// Set global logging level // Set global logging level
SPDLOG_EXPORT
void set_level(level::level_enum log_level); void set_level(level::level_enum log_level);
// Set global flush level // Set global flush level
SPDLOG_EXPORT
void flush_on(level::level_enum log_level); void flush_on(level::level_enum log_level);
// Start/Restart a periodic flusher thread // Start/Restart a periodic flusher thread
// Warning: Use only if all your loggers are thread safe! // Warning: Use only if all your loggers are thread safe!
SPDLOG_EXPORT
void flush_every(std::chrono::seconds interval); void flush_every(std::chrono::seconds interval);
// Set global error handler // Set global error handler
SPDLOG_EXPORT
void set_error_handler(void (*handler)(const std::string &msg)); void set_error_handler(void (*handler)(const std::string &msg));
// Register the given logger with the given name // Register the given logger with the given name
SPDLOG_EXPORT
void register_logger(std::shared_ptr<logger> logger); void register_logger(std::shared_ptr<logger> logger);
// Apply a user defined function on all registered loggers // Apply a user defined function on all registered loggers
// Example: // Example:
// spdlog::apply_all([&](std::shared_ptr<spdlog::logger> l) {l->flush();}); // spdlog::apply_all([&](std::shared_ptr<spdlog::logger> l) {l->flush();});
SPDLOG_EXPORT
void apply_all(const std::function<void(std::shared_ptr<logger>)> &fun); void apply_all(const std::function<void(std::shared_ptr<logger>)> &fun);
// Drop the reference to the given logger // Drop the reference to the given logger
SPDLOG_EXPORT
void drop(const std::string &name); void drop(const std::string &name);
// Drop all references from the registry // Drop all references from the registry
SPDLOG_EXPORT
void drop_all(); void drop_all();
// stop any running threads started by spdlog and clean registry loggers // stop any running threads started by spdlog and clean registry loggers
SPDLOG_EXPORT
void shutdown(); void shutdown();
// Automatic registration of loggers when using spdlog::create() or spdlog::create_async // Automatic registration of loggers when using spdlog::create() or spdlog::create_async
SPDLOG_EXPORT
void set_automatic_registration(bool automatic_registration); void set_automatic_registration(bool automatic_registration);
// API for using default logger (stdout_color_mt), // API for using default logger (stdout_color_mt),
@ -117,10 +134,13 @@ void set_automatic_registration(bool automatic_registration);
// set_default_logger() *should not* be used concurrently with the default API. // set_default_logger() *should not* be used concurrently with the default API.
// e.g do not call set_default_logger() from one thread while calling spdlog::info() from another. // e.g do not call set_default_logger() from one thread while calling spdlog::info() from another.
SPDLOG_EXPORT
std::shared_ptr<spdlog::logger> default_logger(); std::shared_ptr<spdlog::logger> default_logger();
SPDLOG_EXPORT
spdlog::logger *default_logger_raw(); spdlog::logger *default_logger_raw();
SPDLOG_EXPORT
void set_default_logger(std::shared_ptr<spdlog::logger> default_logger); void set_default_logger(std::shared_ptr<spdlog::logger> default_logger);
template<typename... Args> template<typename... Args>

@ -7,6 +7,11 @@
#include <mutex> #include <mutex>
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include "spdlog/details/null_mutex.h" #include "spdlog/details/null_mutex.h"
#include "spdlog/async.h" #include "spdlog/async.h"
// //
@ -14,34 +19,34 @@
// //
#ifdef _WIN32 #ifdef _WIN32
#include "spdlog/sinks/wincolor_sink-inl.h" #include "spdlog/sinks/wincolor_sink-inl.h"
template class spdlog::sinks::wincolor_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_nullmutex>;
#else #else
#include "spdlog/sinks/ansicolor_sink-inl.h" #include "spdlog/sinks/ansicolor_sink-inl.h"
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_nullmutex>;
#endif #endif
// factory methods for color loggers // factory methods for color loggers
#include "spdlog/sinks/stdout_color_sinks-inl.h" #include "spdlog/sinks/stdout_color_sinks-inl.h"
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::synchronous_factory>( template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::synchronous_factory>(
const std::string &logger_name, color_mode mode); const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::synchronous_factory>( template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::synchronous_factory>(
const std::string &logger_name, color_mode mode); const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::synchronous_factory>( template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::synchronous_factory>(
const std::string &logger_name, color_mode mode); const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::synchronous_factory>( template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::synchronous_factory>(
const std::string &logger_name, color_mode mode); const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode); template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode); template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode); template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode); template SPDLOG_EXPORT std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);

@ -6,13 +6,18 @@
#endif #endif
#include <mutex> #include <mutex>
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include "spdlog/details/null_mutex.h" #include "spdlog/details/null_mutex.h"
#include "spdlog/details/file_helper-inl.h" #include "spdlog/details/file_helper-inl.h"
#include "spdlog/sinks/basic_file_sink-inl.h" #include "spdlog/sinks/basic_file_sink-inl.h"
template class spdlog::sinks::basic_file_sink<std::mutex>; template class SPDLOG_EXPORT spdlog::sinks::basic_file_sink<std::mutex>;
template class spdlog::sinks::basic_file_sink<spdlog::details::null_mutex>; template class SPDLOG_EXPORT spdlog::sinks::basic_file_sink<spdlog::details::null_mutex>;
#include "spdlog/sinks/rotating_file_sink-inl.h" #include "spdlog/sinks/rotating_file_sink-inl.h"
template class spdlog::sinks::rotating_file_sink<std::mutex>; template class SPDLOG_EXPORT spdlog::sinks::rotating_file_sink<std::mutex>;
template class spdlog::sinks::rotating_file_sink<spdlog::details::null_mutex>; template class SPDLOG_EXPORT spdlog::sinks::rotating_file_sink<spdlog::details::null_mutex>;

@ -5,6 +5,11 @@
#error Please define SPDLOG_COMPILED_LIB to compile this file. #error Please define SPDLOG_COMPILED_LIB to compile this file.
#endif #endif
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include "spdlog/spdlog-inl.h" #include "spdlog/spdlog-inl.h"
#include "spdlog/common-inl.h" #include "spdlog/common-inl.h"
#include "spdlog/details/backtracer-inl.h" #include "spdlog/details/backtracer-inl.h"
@ -21,6 +26,6 @@
#include <mutex> #include <mutex>
// template instantiate logger constructor with sinks init list // template instantiate logger constructor with sinks init list
template spdlog::logger::logger(std::string name, sinks_init_list::iterator begin, sinks_init_list::iterator end); template SPDLOG_EXPORT spdlog::logger::logger(std::string name, sinks_init_list::iterator begin, sinks_init_list::iterator end);
template class spdlog::sinks::base_sink<std::mutex>; template class SPDLOG_EXPORT spdlog::sinks::base_sink<std::mutex>;
template class spdlog::sinks::base_sink<spdlog::details::null_mutex>; template class SPDLOG_EXPORT spdlog::sinks::base_sink<spdlog::details::null_mutex>;

@ -7,23 +7,28 @@
#include <mutex> #include <mutex>
#ifdef SPDLOG_USE_EXPORT_HEADER
#include "spdlog_export.h"
#else
#define SPDLOG_EXPORT
#endif
#include "spdlog/details/null_mutex.h" #include "spdlog/details/null_mutex.h"
#include "spdlog/async.h" #include "spdlog/async.h"
#include "spdlog/sinks/stdout_sinks-inl.h" #include "spdlog/sinks/stdout_sinks-inl.h"
template class spdlog::sinks::stdout_sink_base<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::stdout_sink_base<spdlog::details::console_mutex>;
template class spdlog::sinks::stdout_sink_base<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::stdout_sink_base<spdlog::details::console_nullmutex>;
template class spdlog::sinks::stdout_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::stdout_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::stdout_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::stdout_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::stderr_sink<spdlog::details::console_mutex>; template class SPDLOG_EXPORT spdlog::sinks::stderr_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::stderr_sink<spdlog::details::console_nullmutex>; template class SPDLOG_EXPORT spdlog::sinks::stderr_sink<spdlog::details::console_nullmutex>;
template 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_mt<spdlog::synchronous_factory>(const std::string &logger_name);
template 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::stdout_logger_st<spdlog::synchronous_factory>(const std::string &logger_name);
template 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_mt<spdlog::synchronous_factory>(const std::string &logger_name);
template std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<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);
template 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_mt<spdlog::async_factory>(const std::string &logger_name);
template 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::stdout_logger_st<spdlog::async_factory>(const std::string &logger_name);
template 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_mt<spdlog::async_factory>(const std::string &logger_name);
template std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<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);

@ -41,7 +41,7 @@ function(spdlog_prepare_test test_target spdlog_lib)
spdlog_enable_warnings(${test_target}) spdlog_enable_warnings(${test_target})
target_link_libraries(${test_target} PRIVATE ${spdlog_lib}) target_link_libraries(${test_target} PRIVATE ${spdlog_lib})
if(systemd_FOUND) if(systemd_FOUND)
target_link_libraries(${test_target} PRIVATE ${systemd_LIBRARIES}) target_link_libraries(${test_target} PRIVATE ${systemd_LIBRARIES} Threads::Threads)
endif() endif()
if(SPDLOG_SANITIZE_ADDRESS) if(SPDLOG_SANITIZE_ADDRESS)
spdlog_enable_sanitizer(${test_target}) spdlog_enable_sanitizer(${test_target})

Loading…
Cancel
Save