[med-svn] [Git][med-team/spdlog][upstream] New upstream version 1.4.2
Michael R. Crusoe
gitlab at salsa.debian.org
Wed Nov 6 17:39:35 GMT 2019
Michael R. Crusoe pushed to branch upstream at Debian Med / spdlog
Commits:
4e2f7806 by Michael R. Crusoe at 2019-11-06T17:04:06Z
New upstream version 1.4.2
- - - - -
10 changed files:
- CMakeLists.txt
- README.md
- cmake/spdlog.pc.in
- cmake/spdlogCPack.cmake
- include/spdlog/common.h
- include/spdlog/details/pattern_formatter-inl.h
- include/spdlog/logger-inl.h
- include/spdlog/logger.h
- include/spdlog/sinks/wincolor_sink-inl.h
- include/spdlog/version.h
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -66,6 +66,7 @@ option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF)
if(WIN32)
option(SPDLOG_WCHAR_SUPPORT "Support wchar api" OFF)
+ option(SPDLOG_WCHAR_FILENAMES "Support wchar filenames" OFF)
endif()
option(SPDLOG_NO_EXCEPTIONS "Compile with -fno-exceptions. Call abort() on any spdlog exceptions" OFF)
@@ -86,8 +87,6 @@ set(SPDLOG_SRCS
src/file_sinks.cpp
src/async.cpp)
-set(SPDLOG_CFLAGS "${PROJECT_NAME}")
-
if (SPDLOG_BUILD_SHARED)
if(WIN32)
message(FATAL_ERROR "spdlog shared lib is not yet supported under windows")
@@ -128,14 +127,13 @@ if(SPDLOG_FMT_EXTERNAL)
if (NOT TARGET fmt::fmt)
find_package(fmt REQUIRED)
endif ()
-
- set(SPDLOG_CFLAGS "${SPDLOG_CFLAGS} -DSPDLOG_FMT_EXTERNAL")
-
target_compile_definitions(spdlog PUBLIC SPDLOG_FMT_EXTERNAL)
target_link_libraries(spdlog PUBLIC fmt::fmt)
target_compile_definitions(spdlog_header_only INTERFACE SPDLOG_FMT_EXTERNAL)
target_link_libraries(spdlog_header_only INTERFACE fmt::fmt)
+
+ set(PKG_CONFIG_REQUIRES fmt) # add dependecy to pkg-config
endif()
if(SPDLOG_WCHAR_SUPPORT)
@@ -143,6 +141,11 @@ if(SPDLOG_WCHAR_SUPPORT)
target_compile_definitions(spdlog_header_only INTERFACE SPDLOG_WCHAR_TO_UTF8_SUPPORT)
endif()
+ if(SPDLOG_WCHAR_FILENAMES)
+ target_compile_definitions(spdlog PUBLIC SPDLOG_WCHAR_FILENAMES)
+ target_compile_definitions(spdlog_header_only INTERFACE SPDLOG_WCHAR_FILENAMES)
+ endif()
+
if(SPDLOG_NO_EXCEPTIONS)
target_compile_definitions(spdlog PUBLIC SPDLOG_NO_EXCEPTIONS)
@@ -190,7 +193,7 @@ if (SPDLOG_INSTALL)
# Include files
#---------------------------------------------------------------------------------------
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" PATTERN "fmt/bundled" EXCLUDE)
- install(TARGETS spdlog spdlog_header_only EXPORT spdlog DESTINATION "${CMAKE_INSTALL_LIBDIR}/spdlog")
+ install(TARGETS spdlog spdlog_header_only EXPORT spdlog DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(NOT SPDLOG_FMT_EXTERNAL)
install(DIRECTORY include/${PROJECT_NAME}/fmt/bundled/
@@ -198,11 +201,17 @@ if (SPDLOG_INSTALL)
endif()
#---------------------------------------------------------------------------------------
- # Package and version files
+ # Install pkg-config file
#---------------------------------------------------------------------------------------
+ get_target_property(PKG_CONFIG_DEFINES spdlog INTERFACE_COMPILE_DEFINITIONS)
+ string(REPLACE ";" " -D" PKG_CONFIG_DEFINES "${PKG_CONFIG_DEFINES}")
+ string(CONCAT PKG_CONFIG_DEFINES "-D" "${PKG_CONFIG_DEFINES}")
configure_file("cmake/${PROJECT_NAME}.pc.in" "${pkg_config}" @ONLY)
install(FILES "${pkg_config}" DESTINATION "${pkgconfig_install_dir}")
+ #---------------------------------------------------------------------------------------
+ # Install CMake config files
+ #---------------------------------------------------------------------------------------
install(EXPORT spdlog
DESTINATION ${export_dest_dir}
NAMESPACE spdlog::
@@ -210,6 +219,7 @@ if (SPDLOG_INSTALL)
include(CMakePackageConfigHelpers)
configure_file("${project_config_in}" "${project_config_out}" @ONLY)
+
write_basic_package_version_file("${version_config_file}" COMPATIBILITY SameMajorVersion)
install(FILES
"${project_config_out}"
@@ -221,3 +231,4 @@ if (SPDLOG_INSTALL)
include(cmake/spdlogCPack.cmake)
endif ()
+
=====================================
README.md
=====================================
@@ -8,7 +8,7 @@ Very fast, header-only/compiled, C++ logging library. [![Build Status](https://t
#### Header only version
Copy the source [folder](https://github.com/gabime/spdlog/tree/v1.x/include/spdlog) to your build tree and use a C++11 compiler.
-#### Static lib version (recommended - much faster compile times, v1.4.0)
+#### Static lib version (recommended - much faster compile times)
```console
$ git clone https://github.com/gabime/spdlog.git
$ cd spdlog && mkdir build && cd build
=====================================
cmake/spdlog.pc.in
=====================================
@@ -7,5 +7,7 @@ Name: lib at PROJECT_NAME@
Description: Fast C++ logging library.
URL: https://github.com/gabime/@PROJECT_NAME@
Version: @SPDLOG_VERSION@
-CFlags: -I${includedir}/@SPDLOG_CFLAGS@
-Libs: -L${libdir}/@PROJECT_NAME@ -l at PROJECT_NAME@
+CFlags: -I${includedir} @PKG_CONFIG_DEFINES@
+Libs: -L${libdir} -lspdlog -pthread
+Requires: @PKG_CONFIG_REQUIRES@
+
=====================================
cmake/spdlogCPack.cmake
=====================================
@@ -14,6 +14,7 @@ set(CPACK_INSTALL_CMAKE_PROJECTS
set(CPACK_PROJECT_URL "https://github.com/gabime/spdlog")
set(CPACK_PACKAGE_VENDOR "Gabi Melman")
set(CPACK_PACKAGE_CONTACT "Gabi Melman <gmelman1 at gmail.com>")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast C++ logging library")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
@@ -23,4 +24,9 @@ if (PROJECT_VERSION_TWEAK)
endif ()
set(CPACK_PACKAGE_RELOCATABLE ON)
+set(CPACK_RPM_PACKAGE_LICENSE "MIT")
+set(CPACK_RPM_PACKAGE_GROUP "System Environment/Libraries")
+set(CPACK_RPM_PACKAGE_URL ${CPACK_PROJECT_URL})
+set(CPACK_RPM_PACKAGE_DESCRIPTION "Very fast, header-only/compiled, C++ logging library.")
+
include(CPack)
=====================================
include/spdlog/common.h
=====================================
@@ -101,14 +101,13 @@ using sink_ptr = std::shared_ptr<sinks::sink>;
using sinks_init_list = std::initializer_list<sink_ptr>;
using err_handler = std::function<void(const std::string &err_msg)>;
using string_view_t = fmt::basic_string_view<char>;
+using wstring_view_t = fmt::basic_string_view<wchar_t>;
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#ifndef _WIN32
#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
#else
-using wstring_view_t = fmt::basic_string_view<wchar_t>;
-
template<typename T>
struct is_convertible_to_wstring_view : std::is_convertible<T, wstring_view_t>
{};
=====================================
include/spdlog/details/pattern_formatter-inl.h
=====================================
@@ -878,7 +878,7 @@ public:
void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override
{
- auto delta = std::max(msg.time - last_message_time_, log_clock::duration::zero());
+ auto delta = (std::max)(msg.time - last_message_time_, log_clock::duration::zero());
auto delta_units = std::chrono::duration_cast<DurationUnits>(delta);
last_message_time_ = msg.time;
ScopedPadder p(6, padinfo_, dest);
=====================================
include/spdlog/logger-inl.h
=====================================
@@ -205,7 +205,7 @@ SPDLOG_INLINE void logger::dump_backtrace_()
if (tracer_)
{
sink_it_(log_msg{name(), level::info, "****************** Backtrace Start ******************"});
- tracer_.foreach_pop([this](const details::log_msg &msg) { this->sink_it_(msg); });
+ tracer_.foreach_pop([this](const log_msg &msg) { this->sink_it_(msg); });
sink_it_(log_msg{name(), level::info, "****************** Backtrace End ********************"});
}
}
@@ -218,7 +218,6 @@ SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg)
SPDLOG_INLINE void logger::err_handler_(const std::string &msg)
{
-
if (custom_err_handler_)
{
custom_err_handler_(msg);
=====================================
include/spdlog/logger.h
=====================================
@@ -3,8 +3,7 @@
#pragma once
-// Thread safe logger (except for set_pattern(..), set_formatter(..) and
-// set_error_handler())
+// Thread safe logger (except for set_error_handler())
// Has name, log level, vector of std::shared sink pointers and formatter
// Upon each log write the logger:
// 1. Checks if its log level is enough to log the message and if yes:
=====================================
include/spdlog/sinks/wincolor_sink-inl.h
=====================================
@@ -140,6 +140,10 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::print_range_(const memory_buf_t
template<typename ConsoleMutex>
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::write_to_file_(const memory_buf_t &formatted)
{
+ if (out_handle_ == nullptr) // no console and no file redirect
+ {
+ return;
+ }
auto size = static_cast<DWORD>(formatted.size());
if (size == 0)
{
=====================================
include/spdlog/version.h
=====================================
@@ -5,6 +5,6 @@
#define SPDLOG_VER_MAJOR 1
#define SPDLOG_VER_MINOR 4
-#define SPDLOG_VER_PATCH 1
+#define SPDLOG_VER_PATCH 2
#define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH)
View it on GitLab: https://salsa.debian.org/med-team/spdlog/commit/4e2f7806e0990f7608675ea2bdf8d17e6adaa043
--
View it on GitLab: https://salsa.debian.org/med-team/spdlog/commit/4e2f7806e0990f7608675ea2bdf8d17e6adaa043
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191106/154da596/attachment-0001.html>
More information about the debian-med-commit
mailing list