Add option for dll-local registry on Linux

pull/1448/head
Simon Schneegans 6 years ago
parent ea5e7182ab
commit 81d090c7b7

@ -56,6 +56,7 @@ endif ()
# build shared option
if(NOT WIN32)
option(SPDLOG_BUILD_SHARED "Build shared library" OFF)
option(SPDLOG_DLL_LOCAL_REGISTRY "If enabled, the logger registry will not be shared between shared objects" OFF)
endif()
# example options
@ -122,6 +123,10 @@ else()
add_library(spdlog STATIC ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
endif()
if (SPDLOG_DLL_LOCAL_REGISTRY)
target_compile_definitions(spdlog PUBLIC SPDLOG_DLL_LOCAL_REGISTRY)
endif()
add_library(spdlog::spdlog ALIAS spdlog)
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)

@ -54,6 +54,12 @@
#define SPDLOG_DEPRECATED
#endif
#if defined(SPDLOG_DLL_LOCAL_REGISTRY) && (defined(__GNUC__) || defined(__clang__))
#define SPDLOG_REGISTRY_ATTRIBUTES __attribute__((visibility("hidden")))
#else
#define SPDLOG_REGISTRY_ATTRIBUTES
#endif
// disable thread local on msvc 2013
#ifndef SPDLOG_NO_TLS
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)

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

Loading…
Cancel
Save