Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log4cxx: Add version 1.2.0 and replace duplicate version 0.12.0 with version 0.13.0 #16679

Merged
merged 110 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
0db1dd9
apr-util: Upgrade to be conan 2 compatibile
stephen-webb Mar 24, 2023
2a111d2
log4cxx: Upgrade to be conan 2 compatibile
stephen-webb Mar 24, 2023
b362f67
Add patch descriptions and remove unused imports
stephen-webb Mar 25, 2023
129895b
Remove faulty 0.12.0 version
stephen-webb Mar 25, 2023
738e344
Remove unused CMakeLists.txt
stephen-webb Mar 25, 2023
9179b5a
Prevent compilation error with shared=False 0.13.0 version
stephen-webb Mar 25, 2023
51833ee
Fix 0.12.1 build
stephen-webb Mar 25, 2023
e9b5593
Improve conan 2 compatability
stephen-webb Mar 25, 2023
b9006b6
Move patch description to patch source
stephen-webb Mar 25, 2023
7a00cd2
Improve compiler version warning messages
stephen-webb Mar 25, 2023
a668703
Fix 0.13.0 build
stephen-webb Mar 26, 2023
b2bcf3b
Fix 0.12.1 build when with_wchar_t=False
stephen-webb Mar 26, 2023
15fbe7f
Revert "apr-util: Upgrade to be conan 2 compatibile"
stephen-webb Mar 27, 2023
f229464
Fix Linter errors
stephen-webb Mar 27, 2023
f0cfc65
Fix Linter errors
stephen-webb Mar 27, 2023
1674f2b
Prevent build failure when compiler.cppstd=14
stephen-webb Mar 28, 2023
17ea685
Restore conan v1 test_package as test_v1_package
stephen-webb Apr 2, 2023
85d3e1b
Restore conan v1 test_package as test_v1_package
stephen-webb Apr 2, 2023
c7ce0a0
Prevent 'odbc/2.3.11' requires 'libiconv/1.17' while 'apr-util/1.6.1'…
stephen-webb Apr 2, 2023
c24fbea
A missing shared_mutex implementation should not be fatal
stephen-webb Apr 3, 2023
192cd0c
Remove .pc files from the package
stephen-webb Apr 3, 2023
da60789
Remove cmake files from the package
stephen-webb Apr 3, 2023
d1ddd7f
Make the SMTP appender available when libesmtp is available
stephen-webb Apr 3, 2023
9df00e1
Prevent build failure when compiler.cppstd=14
stephen-webb Apr 3, 2023
8aa1f87
Revert "Prevent build failure when compiler.cppstd=14"
stephen-webb Apr 3, 2023
bdbe030
Version 0.12.1 requires a std::shared_mutex implementation
stephen-webb Apr 3, 2023
7862dcf
Version 0.13.0 requires a std::shared_mutex implementation
stephen-webb Apr 3, 2023
3f8ecec
Version 0.13.0 requires a std::shared_mutex implementation
stephen-webb Apr 3, 2023
6fce6e4
Improve diagnostic warning message and make options more consistent
stephen-webb Apr 3, 2023
4ef6593
Ensure the package includes licenses folder
stephen-webb Apr 3, 2023
c358758
Provide option for libfmt type layout definitions
stephen-webb Apr 3, 2023
316d836
Prevent gcc5 compiler error
stephen-webb Apr 3, 2023
a97f3bf
Fixtest failure. Reduce duplication
stephen-webb Apr 3, 2023
a0fbf3d
Remove share directory from package
stephen-webb Apr 3, 2023
b5ae993
Ensure gcc5 builds test_packages
stephen-webb Apr 3, 2023
2d911a1
Ensure test_packages build
stephen-webb Apr 3, 2023
6e4b536
Use conan generated target name in test_package.
stephen-webb Apr 3, 2023
5ec9817
Use conan generated target name in test_package.
stephen-webb Apr 3, 2023
18fec2b
Use conan generated target name in test_package.
stephen-webb Apr 3, 2023
d898174
Use conan generated target name in test_package.
stephen-webb Apr 4, 2023
9f1e931
Merge remote-tracking branch 'origin/master' into upgrade-log4cxx
stephen-webb Apr 4, 2023
229708c
Reduce duplication in test_v1_package.
stephen-webb Apr 4, 2023
b3f8333
Use conan generated target name in test_package.
stephen-webb Apr 4, 2023
6474728
Use conan generated target name in test_package.
stephen-webb Apr 4, 2023
f5a3b89
Use conan generated target name in test_package.
stephen-webb Apr 4, 2023
e4ecb19
Prevent Visual Studio 2017 compilation error
stephen-webb Apr 4, 2023
f4c3989
Prevent Visual Studio 2017 compilation error
stephen-webb Apr 4, 2023
560d167
Merge branch 'master' into upgrade-log4cxx
swebb2066 Apr 4, 2023
9297e1c
Prevent Visual Studio 2017 compilation error
stephen-webb Apr 5, 2023
c749709
Prevent Visual Studio 2017 compilation error
stephen-webb Apr 5, 2023
754b204
Prevent Visual Studio 2017 compilation error
stephen-webb Apr 5, 2023
2e73168
Provide bugfix source urls. Provide C++17 requirement as information …
stephen-webb Apr 5, 2023
57a03e7
Prevent WARN: apr-util/1.6.1: requirement expat/2.4.1 overridden by l…
stephen-webb Apr 6, 2023
682d7eb
Revert "Prevent WARN: apr-util/1.6.1: requirement expat/2.4.1 overrid…
stephen-webb Apr 6, 2023
9169ec1
Fix Windows failure when using a shared library
stephen-webb Apr 6, 2023
33a568a
Remove expat requirement - it is not directly required by log4cxx
stephen-webb Apr 7, 2023
e62ae41
Attempt to get CI logs for version 1.0.0
stephen-webb Apr 7, 2023
2c91c77
Fix Windows failure when using a shared library
stephen-webb Apr 7, 2023
ec06aab
Make test_package conform with other conan 2 recipes
stephen-webb Apr 7, 2023
56ae2d4
PkgConfig is mostly not required. Version 1.0.0 requires C++11.
stephen-webb Apr 10, 2023
9a239a9
Use find_package(ODBC) instead of pkg_check_modules( odbc odbc )
Apr 11, 2023
9aca6d6
SMTP appender is broken in version 0.12 through 1.0.0
stephen-webb Apr 13, 2023
2e75dc1
SMTP appender is not implemented for Windows
stephen-webb Apr 15, 2023
55f930d
Make with_odbc_appender option work on Windows (sqlext.h not found by…
stephen-webb Apr 20, 2023
fa40cde
SMTP appender option is not available on Windows
stephen-webb May 5, 2023
5e9fbc3
Add support for version 1.1.0
stephen-webb May 8, 2023
98fd698
Add version 1.1.0 to CI build
stephen-webb May 8, 2023
ea3ef39
Version 1.0.0 has been superceded by 1.1.0
stephen-webb May 10, 2023
029a4af
Remove unsed patch files
stephen-webb May 10, 2023
5c7bc89
Standarize recipe class name
stephen-webb Jun 18, 2023
0c9da72
Merge remote-tracking branch 'upstream/master' into upgrade-log4cxx
stephen-webb Jun 18, 2023
a60be82
Merge branch 'master' into upgrade-log4cxx
swebb2066 Jul 14, 2023
da9f044
Prevent 'Version conflict: apr-util/1.6.1->apr/1.7.0, None->apr/1.7.4'
stephen-webb Jul 14, 2023
5d322a2
Merge branch 'upgrade-log4cxx' of https://github.com/swebb2066/conan-…
stephen-webb Jul 14, 2023
6907079
Revert "Prevent 'Version conflict: apr-util/1.6.1->apr/1.7.0, None->a…
stephen-webb Jul 14, 2023
5fff340
Prevent 'Version conflict: apr-util/1.6.1->apr/1.7.0, None->apr/1.7.4'
stephen-webb Jul 14, 2023
e2c9ebf
Replace disallowed version ranges
stephen-webb Jul 15, 2023
42c2980
Restore 'cmake_find_package* generator' support code
stephen-webb Jul 15, 2023
91a5496
Restore 'cmake_find_package* generator' support code
stephen-webb Jul 15, 2023
1430ebb
Restore 'cmake_find_package* generator' support code
stephen-webb Jul 15, 2023
34add1e
Replace 'fix-expat-target.patch' with 'tc.set_property(...' equivalent
stephen-webb Jul 15, 2023
ea0de63
Merge branch 'master' into upgrade-log4cxx
swebb2066 Jul 15, 2023
8f89000
Merge branch 'master' into upgrade-log4cxx
swebb2066 Jul 18, 2023
ed50008
APR library is not provided via APR-UTIL transitively
stephen-webb Jul 18, 2023
42b3830
Merge branch 'upgrade-log4cxx' of https://github.com/swebb2066/conan-…
stephen-webb Jul 18, 2023
541328d
Use CMakeDeps.set_property{} instead of a patch to find apr and apr-util
stephen-webb Jul 19, 2023
8ef66f3
Use CMakeDeps.set_property{} instead of a patch to find apr and apr-util
stephen-webb Jul 19, 2023
3d496f1
Revert "Use CMakeDeps.set_property{} instead of a patch to find apr a…
stephen-webb Jul 19, 2023
8373069
Revert "Use CMakeDeps.set_property{} instead of a patch to find apr a…
stephen-webb Jul 19, 2023
3216869
Allow internal and file character type options
stephen-webb Aug 10, 2023
8c77b88
Simplify package logic
stephen-webb Aug 10, 2023
edc9779
Remove upper-case encoding options
stephen-webb Aug 11, 2023
d5e4811
Make utf-8 the default character encoding
stephen-webb Aug 12, 2023
d305e29
Merge branch 'master' into upgrade-log4cxx
swebb2066 Aug 12, 2023
4b9358b
Merge branch 'master' into upgrade-log4cxx
swebb2066 Oct 1, 2023
53330c3
Merge branch 'master' into upgrade-log4cxx
swebb2066 Nov 14, 2023
df33a6c
Prevent lint complaint
stephen-webb Nov 15, 2023
c54ac7e
Prevent actual lint complaint
stephen-webb Nov 15, 2023
50e594d
Remove patch required by upstream incompatibility
stephen-webb Nov 15, 2023
3c9ce67
Update patch file names
stephen-webb Nov 15, 2023
7002247
Remove unused patch file
stephen-webb Nov 15, 2023
e20f6ea
Merge branch 'master' into upgrade-log4cxx
swebb2066 Dec 29, 2023
30eb110
Add release version 1.2.0
stephen-webb Mar 15, 2024
2c495c3
Add release version 1.2.0 to config.yml
stephen-webb Mar 18, 2024
31ff81c
Fix release version 1.2.0 path
stephen-webb Mar 18, 2024
495757c
Merge branch 'master' into upgrade-log4cxx
swebb2066 Mar 18, 2024
bd16e1b
Clarify the purpose of char_type vs with_wchar_t etc.
stephen-webb Mar 25, 2024
1dc374a
Apply reviewer suggested changes
stephen-webb Mar 25, 2024
04fb6ee
Bump dependency versions
stephen-webb Mar 25, 2024
6b7ce67
Merge branch 'master' into upgrade-log4cxx
swebb2066 Apr 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions recipes/log4cxx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
sources:
"1.2.0":
url: "https://archive.apache.org/dist/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz"
sha256: "09f4748aa5675ef5c0770bedbf5e00488668933c5a935a43ac5b85be2436c48a"
"1.1.0":
url: "https://archive.apache.org/dist/logging/log4cxx/1.1.0/apache-log4cxx-1.1.0.tar.gz"
sha256: "1fc7d82697534184bc0f757348d969d24852b948f63d6b17283fd1ee29c2c28a"
"0.13.0":
url: "https://archive.apache.org/dist/logging/log4cxx/0.13.0/apache-log4cxx-0.13.0.tar.gz"
sha256: "4e5be64b6b1e6de8525f8b87635270b81f772a98902d20d7ac646fdf1ac08284"
"0.12.1":
url: "https://archive.apache.org/dist/logging/log4cxx/0.12.1/apache-log4cxx-0.12.1.tar.gz"
sha256: "7bea5cb477f0e31c838f0e1f4f498cc3b30c2eae74703ddda923e7e8c2268d22"
"0.12.0":
url: "https://archive.apache.org/dist/logging/log4cxx/0.12.0/apache-log4cxx-0.12.0.tar.gz"
sha256: "bd5b5009ca914c8fa7944b92ea6b4ca6fb7d146f65d526f21bf8b3c6a0520e44"
patches:
"1.2.0":
- patch_file: "patches/1.2.0-0001-find-apr.patch"
patch_description: "use cci's package name"
patch_type: "conan"
"1.1.0":
- patch_file: "patches/1.1.0-0001-find-apr.patch"
patch_description: "use cci's package name"
patch_type: "conan"
"0.12.1":
- patch_file: "patches/0.12.0-0001-find-apr.patch"
patch_description: "use cci's package name"
"0.13.0":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the version 0.13.0? I would suggest only adding 1.1.0, then if someone open an issue requesting, add it. Add new versions not only cost CI resources, but also may need people that are using it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up!

- patch_file: "patches/0.13.0-0001-find-apr.patch"
patch_type: "conan"
"0.12.0":
- patch_file: "patches/0.12.0-0001-find-apr.patch"
patch_description: "Use conan generated apr, apr-util target names"
- patch_file: "patches/0.13.0-0001-logchar-type.patch"
patch_type: "bugfix"
patch_description: "Prevent compilation errors when with_wchar_t=False"
patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24"
- patch_file: "patches/0.13.0-0001-visual-studio-15.patch"
patch_type: "bugfix"
patch_description: "Prevent Visual Studio 2017 compilation error"
patch_source: "https://github.com/apache/logging-log4cxx/commit/f59bf53f831b8b68ef3a2f3a6705ae626090758e"
- patch_file: "patches/0.13.0-0001-fix-static-library-compilation.patch"
patch_type: "bugfix"
patch_description: "Prevent compilation error when shared=False"
patch_source: "https://github.com/apache/logging-log4cxx/commit/09b5b723a1a210c28bf8b05b0676bb2b104359ba"
"0.12.1":
- patch_file: "patches/0.12.1-0001-find-apr.patch"
patch_description: "use cci's package name"
patch_type: "conan"
- patch_file: "patches/0.12.1-0001-logchar-type.patch"
patch_type: "bugfix"
patch_description: "Prevent compilation errors when with_wchar_t=False"
patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24"
91 changes: 75 additions & 16 deletions recipes/log4cxx/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,44 @@ class Log4cxxConan(ConanFile):
options = {
"shared": [True, False],
"fPIC": [True, False],
"char_type": ["utf-8", "wchar_t", "unichar"],
"char_encoding": ["utf-8", "locale"],
"with_networking": [True, False],
"with_wchar_t": [True, False],
"with_fmt_layout": [True, False],
"with_odbc_appender": [True, False],
"with_multiprocess_rolling_file_appender": [True, False],
"with_smtp_appender": [True, False],
"with_qt": [True, False],
}
options_description = {
"char_type": "The log4cxx internal character type (selects the std::basic_string template parameter used by log4cxx::LogString)",
"char_encoding": "The external character set used when writing to files",
"with_networking": "Include appenders that use network i/o",
"with_wchar_t": "Include wchar_t API methods in class interfaces",
"with_fmt_layout": "Include the log4cxx::FMTLayout class that uses libfmt to layout messages",
"with_odbc_appender": "Include the log4cxx::ODBCAppender that sends log events to a database",
"with_multiprocess_rolling_file_appender": "Include the appender that allows multiple applications to log to the same file",
"with_smtp_appender": "Include the appender that sends an e-mail when a specific logging event occurs",
"with_qt": "Allow QString values in the LOG4CXX_WARN, LOG4CXX_INFO, LOG4CXX_DEBUG etc. macros",
}
default_options = {
"shared": False,
"fPIC": True,
"char_type": "utf-8",
"char_encoding": "utf-8",
"with_networking": True,
"with_wchar_t": False,
"with_fmt_layout": False,
"with_odbc_appender": False,
"with_multiprocess_rolling_file_appender": False,
"with_smtp_appender": False,
"with_qt": False,
}
swebb2066 marked this conversation as resolved.
Show resolved Hide resolved

@property
def _min_cppstd(self):
return 17
return 11

@property
def _compilers_minimum_version(self):
Expand All @@ -49,7 +78,14 @@ def export_sources(self):

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
self.options.rm_safe("fPIC")
self.options.rm_safe("with_smtp_appender") # *nix only
elif Version(self.version) <= "1.0.0": # SMTP appender is broken in version 0.12 through 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any references for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swebb2066 could you please clarify it? Which error did you have, is there an Github issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a reference for this, but it only affects outdated versions and it's a new option, so I'm fine with it as is.

self.options.rm_safe("with_smtp_appender")
if Version(self.version) < "1.0.0":
self.options.rm_safe("with_multiprocess_rolling_file_appender")
self.options.rm_safe("with_networking")
self.options.rm_safe("with_fmt_layout")

def configure(self):
if self.options.shared:
Expand All @@ -61,33 +97,55 @@ def layout(self):
def requirements(self):
self.requires("apr/1.7.4")
self.requires("apr-util/1.6.1")
self.requires("expat/2.5.0")
if self.settings.os != "Windows":
if self.options.get_safe("with_odbc_appender") and self.settings.os != "Windows":
self.requires("odbc/2.3.11")
if self.options.get_safe("with_smtp_appender"):
self.requires("libesmtp/1.1.0")
if self.options.get_safe("with_fmt_layout"):
self.requires("fmt/10.2.1")
if self.options.get_safe("with_qt"):
self.requires("qt/5.15.12")

def validate(self):
# TODO: if compiler doesn't support C++17, boost can be used instead
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports at least C++{self._min_cppstd}")
if Version(self.version) < "1.0.0" or self.options.get_safe("with_multiprocess_rolling_file_appender"):
# TODO: if compiler doesn't support C++17, boost can be used instead
if Version(self.version) < "1.0.0":
self.output.info(f"Version {self.version} requires C++17. log4cxx version 1.x does not.")
else:
self.output.info("multiprocess rolling file appender requires C++17.")
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
compiler_version = Version(self.settings.compiler.version)
if compiler_version < minimum_version:
raise ConanInvalidConfiguration(f"{self.settings.compiler} {compiler_version} does not support C++17: {minimum_version} required.")
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, "17")

def _patch_sources(self):
apply_conandata_patches(self)

def build_requirements(self):
if self.settings.os != "Windows":
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.0.3")

def source(self):
# OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:
# 'src\\test\\resources\\output\\xyz\\:'
pattern = "*[!:]"
get(self, **self.conan_data["sources"][self.version], strip_root=True, pattern=pattern)
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["BUILD_TESTING"] = False
tc.cache_variables["LOG4CXX_INSTALL_PDB"] = False
tc.variables["BUILD_TESTING"] = False
tc.variables["LOG4CXX_INSTALL_PDB"] = False
if Version(self.version) >= "1.0.0":
tc.variables["LOG4CXX_NETWORKING_SUPPORT"] = self.options.with_networking
tc.variables["LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER"] = self.options.with_multiprocess_rolling_file_appender
tc.variables["ENABLE_FMT_LAYOUT"] = self.options.with_fmt_layout
if Version(self.version) > "1.0.0" and self.settings.os != "Windows":
tc.variables["LOG4CXX_ENABLE_ESMTP"] = self.options.with_smtp_appender
tc.variables["LOG4CXX_ENABLE_ODBC"] = self.options.with_odbc_appender
tc.variables["LOG4CXX_CHAR"] = self.options.char_type
tc.variables["LOG4CXX_CHARSET"] = self.options.char_encoding
tc.variables["LOG4CXX_WCHAR_T"] = self.options.with_wchar_t
tc.variables["LOG4CXX_QT_SUPPORT"] = self.options.with_qt
tc.generate()
tc = CMakeDeps(self)
tc.generate()
Expand Down Expand Up @@ -141,3 +199,4 @@ def package_info(self):
# TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed
swebb2066 marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path]
self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]

21 changes: 21 additions & 0 deletions recipes/log4cxx/all/patches/0.12.1-0001-logchar-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -22,9 +22,18 @@ endif()

if(${LOG4CXX_CHAR} STREQUAL "unichar")
set(LOGCHAR_IS_UNICHAR 1)
+ set(LOGCHAR_IS_WCHAR 0)
+ set(LOGCHAR_IS_UTF8 0)
elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t")
set(LOGCHAR_IS_WCHAR 1)
+ set(LOGCHAR_IS_UNICHAR 0)
+ set(LOGCHAR_IS_UTF8 0)
+elseif(${LOG4CXX_CHAR} STREQUAL "utf-8")
+ set(LOGCHAR_IS_UNICHAR 0)
+ set(LOGCHAR_IS_WCHAR 0)
+ set(LOGCHAR_IS_UTF8 1)
endif()
+
option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON)
option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF)
set(INIT_IOS_BASE 0)
17 changes: 17 additions & 0 deletions recipes/log4cxx/all/patches/0.13.0-0001-find-apr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,10 +41,12 @@ if(NOT BUILD_SHARED_LIBS)
endif()

# Find Apache Runtime
-find_package(APR REQUIRED)
+find_package(apr REQUIRED)
+set(APR_LIBRARIES apr::apr)

# Find Apache Runtime Utilities
-find_package(APR-Util REQUIRED)
+find_package(apr-util REQUIRED)
+set(APR_UTIL_LIBRARIES apr-util::apr-util)

find_package( Threads REQUIRED )

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/src/main/cpp/threadutility.cpp
+++ b/src/main/cpp/threadutility.cpp
@@ -16,6 +16,9 @@
*/

#include "log4cxx/helpers/threadutility.h"
+#if !defined(LOG4CXX)
+ #define LOG4CXX 1
+#endif
#include "log4cxx/private/log4cxx_private.h"
#include "log4cxx/helpers/loglog.h"

44 changes: 44 additions & 0 deletions recipes/log4cxx/all/patches/0.13.0-0001-logchar-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp
index c14c12fd..057ecd86 100644
--- a/src/main/cpp/threadutility.cpp
+++ b/src/main/cpp/threadutility.cpp
@@ -113,11 +113,13 @@ void ThreadUtility::threadStartedNameThread(LogString threadName,
std::thread::id /*threadId*/,
std::thread::native_handle_type nativeHandle){
#if LOG4CXX_HAS_PTHREAD_SETNAME
- if( pthread_setname_np( static_cast<pthread_t>( nativeHandle ), threadName.c_str() ) < 0 ){
- LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") );
+ LOG4CXX_ENCODE_CHAR(sthreadName, threadName);
+ if (pthread_setname_np(static_cast<pthread_t>(nativeHandle), sthreadName.c_str()) < 0) {
+ LOGLOG_ERROR(LOG4CXX_STR("unable to set thread name"));
}
#elif LOG4CXX_HAS_SETTHREADDESCRIPTION
- HRESULT hr = SetThreadDescription(static_cast<HANDLE>(nativeHandle), threadName.c_str());
+ LOG4CXX_ENCODE_WCHAR(wthreadName, threadName);
+ HRESULT hr = SetThreadDescription(static_cast<HANDLE>(nativeHandle), wthreadName.c_str());
if(FAILED(hr)){
LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") );
}
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index e31443fb..32122e41 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -39,9 +39,18 @@ endif()

if(${LOG4CXX_CHAR} STREQUAL "unichar")
set(LOGCHAR_IS_UNICHAR 1)
+ set(LOGCHAR_IS_WCHAR 0)
+ set(LOGCHAR_IS_UTF8 0)
elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t")
set(LOGCHAR_IS_WCHAR 1)
+ set(LOGCHAR_IS_UNICHAR 0)
+ set(LOGCHAR_IS_UTF8 0)
+elseif(${LOG4CXX_CHAR} STREQUAL "utf-8")
+ set(LOGCHAR_IS_UNICHAR 0)
+ set(LOGCHAR_IS_WCHAR 0)
+ set(LOGCHAR_IS_UTF8 1)
endif()
+
option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON)
option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF)
set(INIT_IOS_BASE 0)
52 changes: 52 additions & 0 deletions recipes/log4cxx/all/patches/0.13.0-0001-visual-studio-15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp
index b57ab66..ef48704 100644
--- a/src/main/cpp/threadutility.cpp
+++ b/src/main/cpp/threadutility.cpp
@@ -27,7 +27,11 @@
#include <processthreadsapi.h>
#endif

-using log4cxx::helpers::ThreadUtility;
+namespace log4cxx
+{
+namespace helpers
+{
+

struct ThreadUtility::priv_data{
priv_data(){
@@ -36,9 +40,9 @@ struct ThreadUtility::priv_data{
start_post = nullptr;
}

- log4cxx::helpers::ThreadStartPre start_pre;
- log4cxx::helpers::ThreadStarted started;
- log4cxx::helpers::ThreadStartPost start_post;
+ ThreadStartPre start_pre;
+ ThreadStarted started;
+ ThreadStartPost start_post;
};

#if LOG4CXX_HAS_PTHREAD_SIGMASK
@@ -138,14 +142,18 @@ void ThreadUtility::postThreadUnblockSignals(){
}


-log4cxx::helpers::ThreadStartPre ThreadUtility::preStartFunction(){
+ThreadStartPre ThreadUtility::preStartFunction(){
return m_priv->start_pre;
}

-log4cxx::helpers::ThreadStarted ThreadUtility::threadStartedFunction(){
+ThreadStarted ThreadUtility::threadStartedFunction(){
return m_priv->started;
}

-log4cxx::helpers::ThreadStartPost ThreadUtility::postStartFunction(){
+ThreadStartPost ThreadUtility::postStartFunction(){
return m_priv->start_post;
}
+
+} //namespace helpers
+} //namespace log4cxx
+
26 changes: 26 additions & 0 deletions recipes/log4cxx/all/patches/1.2.0-0001-find-apr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61c0479..6ac3e77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,16 +51,18 @@ endif()

# Find Apache Runtime
option(APR_STATIC "Link to the APR static library" OFF)
-find_package(APR REQUIRED)
+find_package(apr REQUIRED)
+set(APR_LIBRARIES apr::apr)

# Find Apache Runtime Utilities
option(APU_STATIC "Link to the APR-Util static library" OFF)
-find_package(APR-Util REQUIRED)
+find_package(apr-util REQUIRED)
+set(APR_UTIL_LIBRARIES apr-util::apr-util)

find_package( Threads REQUIRED )

# Find expat for XML parsing
-find_package(EXPAT REQUIRED)
+find_package(EXPAT REQUIRED MODULE)
if(TARGET EXPAT::EXPAT)
set(EXPAT_LIBRARIES EXPAT::EXPAT)
elseif(TARGET expat::expat)
3 changes: 2 additions & 1 deletion recipes/log4cxx/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ project(test_package LANGUAGES CXX)
find_package(log4cxx REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} log4cxx)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_include_directories(${PROJECT_NAME} PRIVATE ${log4cxx_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE log4cxx )
6 changes: 3 additions & 3 deletions recipes/log4cxx/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
Expand All @@ -22,6 +21,7 @@ def build(self):

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
config_xml_name = os.path.join(self.source_folder, "log4cxx_config.xml")
self.run(f"{bin_path} {config_xml_name}", env="conanrun")
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run("{} {}".format(bin_path, config_xml_name), env="conanrun")

Loading
Loading