[easyloggingpp] Features to support multithreading (#31396)

* ports/easyloggingpp features to support multi-threaded applications

* New version of ports/easyloggingpp

---------

Co-authored-by: Bjørn Thirud <bjorn.thirud@fotoware.com>
This commit is contained in:
bjornthirud 2023-05-13 21:32:59 +02:00 committed by GitHub
parent acf66d284e
commit 721328e357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 3 deletions

View File

@ -0,0 +1,34 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 538cc8a..9221dab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,10 @@ option(test "Build all tests" OFF)
option(build_static_lib "Build easyloggingpp as a static library" OFF)
option(lib_utc_datetime "Build library with UTC date/time logging" OFF)
+option(no_default_logfile "Do not write to default log file \"myeasylog.log\" (define ELPP_NO_DEFAULT_LOG_FILE)" OFF)
+option(thread_safe "Build easyloggingpp thread safe (define ELPP_THREAD_SAFE)" OFF)
+option(use_std_threads "Use standard library thread synchronization (define ELPP_FORCE_USE_STD_THREAD)" OFF)
+
set(ELPP_MAJOR_VERSION "9")
set(ELPP_MINOR_VERSION "96")
set(ELPP_PATCH_VERSION "7")
@@ -57,6 +61,18 @@ if (build_static_lib)
add_definitions(-DELPP_UTC_DATETIME)
endif()
+ if (no_default_logfile)
+ add_definitions(-DELPP_NO_DEFAULT_LOG_FILE)
+ endif()
+
+ if (thread_safe)
+ add_definitions(-DELPP_THREAD_SAFE)
+ endif()
+
+ if (use_std_threads)
+ add_definitions(-DELPP_FORCE_USE_STD_THREAD)
+ endif()
+
require_cpp11()
add_library(easyloggingpp STATIC src/easylogging++.cc)
set_property(TARGET easyloggingpp PROPERTY POSITION_INDEPENDENT_CODE ON)

View File

@ -6,11 +6,21 @@ vcpkg_from_github(
REF v9.97.0
SHA512 e45789edaf7a43ad6a73861840d24ccce9b9d6bba1aaacf93c6ac26ff7449957251d2ca322c9da85130b893332dd305b13a2499eaffc65ecfaaafa3e11f8d63d
HEAD_REF master
PATCHES
0001_add_cmake_options.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
std-locking use_std_threads
thread-safe thread_safe
no-defaultfile no_default_logfile
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-Dbuild_static_lib=ON
)
vcpkg_cmake_install()

View File

@ -1,7 +1,7 @@
{
"name": "easyloggingpp",
"version": "9.97.0",
"port-version": 2,
"port-version": 3,
"description": "Easylogging++ is a single header efficient logging library for C++ applications.",
"homepage": "https://github.com/amrayn/easyloggingpp",
"dependencies": [
@ -13,5 +13,16 @@
"name": "vcpkg-cmake-config",
"host": true
}
]
],
"features": {
"no-defaultfile": {
"description": "Do not write to default log file \"myeasylog.log\" (compile with ELPP_NO_DEFAULT_LOG_FILE)"
},
"std-locking": {
"description": "Use std::mutex for thread synchronization (compile with ELPP_FORCE_USE_STD_THREAD)"
},
"thread-safe": {
"description": "Make easyloggingpp thread safe (compile with ELPP_THREAD_SAFE)"
}
}
}

View File

@ -2234,7 +2234,7 @@
},
"easyloggingpp": {
"baseline": "9.97.0",
"port-version": 2
"port-version": 3
},
"eathread": {
"baseline": "1.32.09",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "69f6b238899967e671f818a164f21de0219546bc",
"version": "9.97.0",
"port-version": 3
},
{
"git-tree": "40ca985ab8030ca0daf7c902e413423801d3e3d4",
"version": "9.97.0",