From e715de8fe29473da8f3df310d5ab42af3a8c0d0f Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 23 May 2024 00:13:56 +0900 Subject: [PATCH 01/10] quill: add version 4.0.0 --- recipes/quill/all/conandata.yml | 3 ++ recipes/quill/all/conanfile.py | 38 ++++++++++++++++--- recipes/quill/all/test_package/CMakeLists.txt | 6 ++- .../all/test_package/test_package_4_0.cpp | 38 +++++++++++++++++++ recipes/quill/config.yml | 2 + 5 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 recipes/quill/all/test_package/test_package_4_0.cpp diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 5fe2a37cc1525..7f577a4ff0937 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.0.0": + url: "https://github.com/odygrd/quill/archive/v4.0.0.tar.gz" + sha256: "c4e8a5a8f555a26baff1578fa37b9c6a968170a9bab64fcc913f6b90b91589dc" "3.9.0": url: "https://github.com/odygrd/quill/archive/v3.9.0.tar.gz" sha256: "6e6a46dc6ae94e8321aca00d27dae754dcc51ee83fe60078f8f1f3eb7b3b227b" diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index 96693e04b9fe8..9172ca4beafaf 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc import os @@ -60,13 +61,23 @@ def _compilers_minimum_versions(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "4.0.0": + del self.options.fPIC + del self.options.with_bounded_queue + del self.options.with_no_exceptions + del self.options.with_x86_arch + del self.options.with_bounded_blocking_queue + self.package_type = "header-library" def configure(self): if Version(self.version) < "2.8.0": del self.options.with_bounded_blocking_queue def layout(self): - cmake_layout(self, src_folder="src") + if Version(self.version) >= "4.0.0": + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def requirements(self): self.requires("fmt/10.2.1", transitive_headers=True) @@ -110,6 +121,9 @@ def is_quilll_x86_arch(self): return True def generate(self): + if Version(self.version) >= "4.0.0": + return + tc = CMakeToolchain(self) tc.variables["QUILL_FMT_EXTERNAL"] = True tc.variables["QUILL_ENABLE_INSTALL"] = True @@ -138,7 +152,8 @@ def generate(self): def _patch_sources(self): # remove bundled fmt rmdir(self, os.path.join(self.source_folder, "quill", "quill", "include", "quill", "bundled", "fmt")) - rmdir(self, os.path.join(self.source_folder, "quill", "quill", "src", "bundled", "fmt")) + if Version(self.version) < "4.0.0": + rmdir(self, os.path.join(self.source_folder, "quill", "quill", "src", "bundled", "fmt")) if "2.0.0" <= Version(self.version) < "2.9.1": replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), @@ -148,22 +163,33 @@ def _patch_sources(self): def build(self): self._patch_sources() + if Version(self.version) >= "4.0.0": + return cmake = CMake(self) cmake.configure() cmake.build() def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = CMake(self) - cmake.install() + if Version(self.version) >= "4.0.0": + copy( + self, + "*.h", + os.path.join(self.source_folder, "quill", "include"), + os.path.join(self.package_folder, "include"), + ) + else: + cmake = CMake(self) + cmake.install() rmdir(self, os.path.join(self.package_folder, "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = ["quill"] + if Version(self.version) < "4.0.0": + self.cpp_info.libs = ["quill"] self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") - if self.is_quilll_x86_arch(): + if Version(self.version) < "4.0.0" and self.is_quilll_x86_arch(): self.cpp_info.defines.append("QUILL_X86ARCH") self.cpp_info.cxxflags.append("-mclflushopt") diff --git a/recipes/quill/all/test_package/CMakeLists.txt b/recipes/quill/all/test_package/CMakeLists.txt index b6b657d776df5..48af91aa96c21 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -3,7 +3,11 @@ project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) +if(quill_VERSION VERSION_GREATER_EQUAL "4.0.0") + add_executable(${PROJECT_NAME} test_package_4_0.cpp) +else() + add_executable(${PROJECT_NAME} test_package.cpp) +endif() target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/quill/all/test_package/test_package_4_0.cpp b/recipes/quill/all/test_package/test_package_4_0.cpp new file mode 100644 index 0000000000000..70b95a5d52c9d --- /dev/null +++ b/recipes/quill/all/test_package/test_package_4_0.cpp @@ -0,0 +1,38 @@ +#include "quill/Backend.h" +#include "quill/Frontend.h" +#include "quill/LogMacros.h" +#include "quill/Logger.h" +#include "quill/sinks/FileSink.h" + +#include + +int main() +{ + // Start the backend thread + quill::BackendOptions backend_options; + quill::Backend::start(backend_options); + + // Frontend + auto file_sink = quill::Frontend::create_or_get_sink( + "example_file_logging.log", + []() + { + quill::FileSinkConfig cfg; + cfg.set_open_mode('w'); + cfg.set_filename_append_option(quill::FilenameAppendOption::StartDateTime); + return cfg; + }(), + quill::FileEventNotifier{}); + + quill::Logger* logger = + quill::Frontend::create_or_get_logger("root", std::move(file_sink), + "%(time) [%(thread_id)] %(short_source_location:<28) " + "LOG_%(log_level:<9) %(logger:<12) %(message)", + "%H:%M:%S.%Qns", quill::Timezone::GmtTime); + + // set the log level of the logger to debug (default is info) + logger->set_log_level(quill::LogLevel::Debug); + + LOG_INFO(logger, "log something {}", 123); + LOG_DEBUG(logger, "something else {}", 456); +} diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index f3e422292101a..73cfec85bfc62 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.0": + folder: "all" "3.9.0": folder: "all" "3.8.0": From 0be3de16c1d1f01da0d35642c90bf14654603e41 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 23 May 2024 00:42:52 +0900 Subject: [PATCH 02/10] make bindirs and libdirs empty --- recipes/quill/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index 9172ca4beafaf..2e6e82b0977f4 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -188,6 +188,10 @@ def package(self): def package_info(self): if Version(self.version) < "4.0.0": self.cpp_info.libs = ["quill"] + else: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") if Version(self.version) < "4.0.0" and self.is_quilll_x86_arch(): self.cpp_info.defines.append("QUILL_X86ARCH") From 1a950c933e1b65b261b2b38b6ed258a9a8bd7f7b Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 23 May 2024 07:09:03 +0900 Subject: [PATCH 03/10] add package_id --- recipes/quill/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index 2e6e82b0977f4..dd7437c2d6f4b 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -82,6 +82,10 @@ def layout(self): def requirements(self): self.requires("fmt/10.2.1", transitive_headers=True) + def package_id(self): + if Version(self.version) >= "4.0.0": + self.info.clear() + def validate(self): supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] From 1d36f1296268b30fc106df12e2fcf75f2b90c273 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 23 May 2024 20:02:41 +0900 Subject: [PATCH 04/10] avoid deleting fPIC twice --- recipes/quill/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index dd7437c2d6f4b..e1a4cb347dcce 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -59,8 +59,6 @@ def _compilers_minimum_versions(self): } def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC if Version(self.version) >= "4.0.0": del self.options.fPIC del self.options.with_bounded_queue @@ -68,6 +66,9 @@ def config_options(self): del self.options.with_x86_arch del self.options.with_bounded_blocking_queue self.package_type = "header-library" + else: + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if Version(self.version) < "2.8.0": From 64c3209a225478b9cabb835302afc7143751ec8c Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 24 May 2024 09:45:18 +0900 Subject: [PATCH 05/10] don't require fmtlib in 4.0.0 --- recipes/quill/all/conanfile.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index e1a4cb347dcce..eed73d7a4ba1f 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -81,7 +81,8 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("fmt/10.2.1", transitive_headers=True) + if Version(self.version) < "4.0.0": + self.requires("fmt/10.2.1", transitive_headers=True) def package_id(self): if Version(self.version) >= "4.0.0": @@ -183,25 +184,24 @@ def package(self): os.path.join(self.source_folder, "quill", "include"), os.path.join(self.package_folder, "include"), ) - else: - cmake = CMake(self) - cmake.install() + return + cmake = CMake(self) + cmake.install() rmdir(self, os.path.join(self.package_folder, "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): if Version(self.version) < "4.0.0": self.cpp_info.libs = ["quill"] + if self.is_quilll_x86_arch(): + self.cpp_info.defines.append("QUILL_X86ARCH") + self.cpp_info.cxxflags.append("-mclflushopt") + self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") else: self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") - if Version(self.version) < "4.0.0" and self.is_quilll_x86_arch(): - self.cpp_info.defines.append("QUILL_X86ARCH") - self.cpp_info.cxxflags.append("-mclflushopt") - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") if Version(self.version) >= "2.0.0" and \ From 06322c6b7e85f58c53646fe792b9dc4ea9d5bd10 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 26 May 2024 20:56:02 +0900 Subject: [PATCH 06/10] update 4.1.0 --- recipes/quill/all/conandata.yml | 6 +++--- recipes/quill/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 7f577a4ff0937..5a2acd1b7e694 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "4.0.0": - url: "https://github.com/odygrd/quill/archive/v4.0.0.tar.gz" - sha256: "c4e8a5a8f555a26baff1578fa37b9c6a968170a9bab64fcc913f6b90b91589dc" + "4.1.0": + url: "https://github.com/odygrd/quill/archive/v4.1.0.tar.gz" + sha256: "53ebaf36ae1fccbb0ef1ce7bfcd746de6281d87ae691c2284c36119fc20e2194" "3.9.0": url: "https://github.com/odygrd/quill/archive/v3.9.0.tar.gz" sha256: "6e6a46dc6ae94e8321aca00d27dae754dcc51ee83fe60078f8f1f3eb7b3b227b" diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 73cfec85bfc62..7e4db70e1a003 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,5 +1,5 @@ versions: - "4.0.0": + "4.1.0": folder: "all" "3.9.0": folder: "all" From 2c7ee571abe4de584afee66e39ef24a32bf84198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 27 May 2024 13:22:50 +0200 Subject: [PATCH 07/10] Split library into header-only and static library packages --- recipes/quill/all/conandata.yml | 57 ------ recipes/quill/all/conanfile.py | 165 +++------------- recipes/quill/all/test_package/CMakeLists.txt | 17 +- .../quill/all/test_package/test_package.cpp | 70 +++++-- .../all/test_package/test_package_4_0.cpp | 38 ---- recipes/quill/config.yml | 38 ++-- recipes/quill/old/conandata.yml | 58 ++++++ recipes/quill/old/conanfile.py | 177 ++++++++++++++++++ recipes/quill/old/test_package/CMakeLists.txt | 17 ++ recipes/quill/old/test_package/conanfile.py | 26 +++ .../quill/old/test_package/test_package.cpp | 19 ++ .../test_v1_package/CMakeLists.txt | 0 .../{all => old}/test_v1_package/conanfile.py | 0 13 files changed, 397 insertions(+), 285 deletions(-) delete mode 100644 recipes/quill/all/test_package/test_package_4_0.cpp create mode 100644 recipes/quill/old/conandata.yml create mode 100644 recipes/quill/old/conanfile.py create mode 100644 recipes/quill/old/test_package/CMakeLists.txt create mode 100644 recipes/quill/old/test_package/conanfile.py create mode 100644 recipes/quill/old/test_package/test_package.cpp rename recipes/quill/{all => old}/test_v1_package/CMakeLists.txt (100%) rename recipes/quill/{all => old}/test_v1_package/conanfile.py (100%) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 5a2acd1b7e694..c4f6120c25648 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -2,60 +2,3 @@ sources: "4.1.0": url: "https://github.com/odygrd/quill/archive/v4.1.0.tar.gz" sha256: "53ebaf36ae1fccbb0ef1ce7bfcd746de6281d87ae691c2284c36119fc20e2194" - "3.9.0": - url: "https://github.com/odygrd/quill/archive/v3.9.0.tar.gz" - sha256: "6e6a46dc6ae94e8321aca00d27dae754dcc51ee83fe60078f8f1f3eb7b3b227b" - "3.8.0": - url: "https://github.com/odygrd/quill/archive/v3.8.0.tar.gz" - sha256: "d3e1b349c5d6904c9644e5b79ec65f21692e8094a3d75241a7fe071076eef4dd" - "3.7.0": - url: "https://github.com/odygrd/quill/archive/v3.7.0.tar.gz" - sha256: "53afe555c32b4263c9d31ec11bd0d858983374af7a5e79eb26124f803b192515" - "3.6.0": - url: "https://github.com/odygrd/quill/archive/v3.6.0.tar.gz" - sha256: "ba9dc3df262f2e65c57904580cc8407eba9a462001340c17bab7ae1dccddb4bd" - "3.5.1": - url: "https://github.com/odygrd/quill/archive/v3.5.1.tar.gz" - sha256: "9fa4ebe594c66ce2a409630c304724fa7a2ada0d842ba9c9aaf05f0a90b461f9" - "3.5.0": - url: "https://github.com/odygrd/quill/archive/v3.5.0.tar.gz" - sha256: "47a69465cddeb05645745bed0b3099b49cb627464782f765ce9545723ff1fe84" - "3.4.1": - url: "https://github.com/odygrd/quill/archive/v3.4.1.tar.gz" - sha256: "99f6497b8ba37c30c871fab89f14cd7bc989f3eaa921ccd940a521ee60a6a1c5" - "3.4.0": - url: "https://github.com/odygrd/quill/archive/v3.4.0.tar.gz" - sha256: "16a6cfadc288953f07d128bb51e8ebd4ca6bb8ce4175b5a8af53ce7dde324d8d" - "3.3.1": - url: "https://github.com/odygrd/quill/archive/v3.3.1.tar.gz" - sha256: "f929d54a115b45c32dd2acd1a9810336d35c31fde9f5581c51ad2b80f980d0d1" - "3.2.0": - url: "https://github.com/odygrd/quill/archive/v3.2.0.tar.gz" - sha256: "9745ad83b285bbd0481bd14c1b866b7e6121a981dd211b914f5d55955040fd00" - "3.1.0": - url: "https://github.com/odygrd/quill/archive/v3.1.0.tar.gz" - sha256: "9e7aa64c4f8101ed2b59d1cf3156b1c6bdd712ca89a2ec7aa7166905edc3e621" - "3.0.2": - url: "https://github.com/odygrd/quill/archive/v3.0.2.tar.gz" - sha256: "76e9f607168f71cf1028ae7374fbe91225e400c11b5a51a6ebc992c85d012eed" - "2.9.2": - url: "https://github.com/odygrd/quill/archive/v2.9.2.tar.gz" - sha256: "5b5b502f33277d1ebdb39d57898b1ca25affef4819d390927499f368dd562d91" - "2.9.1": - url: "https://github.com/odygrd/quill/archive/v2.9.1.tar.gz" - sha256: "921e053118136f63cebb2ca1d7e42456fd0bf9626facb755884709092753c054" - "2.9.0": - url: "https://github.com/odygrd/quill/archive/v2.9.0.tar.gz" - sha256: "dec64c0fbb4bfbafe28fdeeeefac10206285bf2be4a42ec5dfb7987ca4ccb372" - "2.8.0": - url: "https://github.com/odygrd/quill/archive/v2.8.0.tar.gz" - sha256: "0461a6c314e3d882f3b9ada487ef1bf558925272509ee41a9fd25f7776db6075" - "2.7.0": - url: "https://github.com/odygrd/quill/archive/v2.7.0.tar.gz" - sha256: "10b8912e4c463a3a86b809076b95bec49aa08393d9ae6b92196cd46314236b87" - "2.6.0": - url: "https://github.com/odygrd/quill/archive/v2.6.0.tar.gz" - sha256: "d72fd5a01bf8d3e59ed93a789a8f103bc31efe0fb3c09182c74036a2e3a8451b" - "1.7.3": - url: "https://github.com/odygrd/quill/archive/v1.7.3.tar.gz" - sha256: "3fff0c5ffb19bbde5429369079741f84a6acce3a781b504cec5e677b05461208" diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index eed73d7a4ba1f..a696da22a6a0a 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -1,11 +1,9 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.files import get, copy, rmdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc import os @@ -17,76 +15,28 @@ class QuillConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/odygrd/quill/" - topics = ("logging", "log", "async") - package_type = "static-library" + topics = ("logging", "log", "async", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - "with_bounded_queue": [True, False], - "with_no_exceptions": [True, False], - "with_x86_arch": [True, False], - "with_bounded_blocking_queue": [True, False], - } - default_options = { - "fPIC": True, - "with_bounded_queue": False, - "with_no_exceptions": False, - "with_x86_arch": False, - "with_bounded_blocking_queue": False, - } @property def _min_cppstd(self): - return "17" if Version(self.version) >= "2.0.0" else "14" + return "17" @property def _compilers_minimum_versions(self): return { - "14": - { - "gcc": "5", - "Visual Studio": "15", - "clang": "5", - "apple-clang": "10", - }, - "17": - { - "gcc": "8", - "Visual Studio": "16", - "clang": "7", - "apple-clang": "12", - }, + "gcc": "8", + "Visual Studio": "16", + "clang": "7", + "apple-clang": "12", } - def config_options(self): - if Version(self.version) >= "4.0.0": - del self.options.fPIC - del self.options.with_bounded_queue - del self.options.with_no_exceptions - del self.options.with_x86_arch - del self.options.with_bounded_blocking_queue - self.package_type = "header-library" - else: - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if Version(self.version) < "2.8.0": - del self.options.with_bounded_blocking_queue - def layout(self): - if Version(self.version) >= "4.0.0": - basic_layout(self, src_folder="src") - else: - cmake_layout(self, src_folder="src") - - def requirements(self): - if Version(self.version) < "4.0.0": - self.requires("fmt/10.2.1", transitive_headers=True) + basic_layout(self, src_folder="src") def package_id(self): - if Version(self.version) >= "4.0.0": - self.info.clear() + self.info.clear() def validate(self): supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] @@ -97,113 +47,42 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - compilers_minimum_version = self._compilers_minimum_versions[self._min_cppstd] + compilers_minimum_version = self._compilers_minimum_versions minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") - else: - self.output.warning(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") - if Version(self.version) >= "2.0.0" and \ - self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ + if self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ self.settings.compiler.libcxx == "libstdc++": raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, which your compiler doesn't support.") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - def is_quilll_x86_arch(self): - if not self.options.with_x86_arch: - return False - if Version(self.version) < "2.7.0": - return False - if self.settings.arch not in ("x86", "x86_64"): - return False - if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": - return False - if is_msvc(self): - return False - return True - - def generate(self): - if Version(self.version) >= "4.0.0": - return - - tc = CMakeToolchain(self) - tc.variables["QUILL_FMT_EXTERNAL"] = True - tc.variables["QUILL_ENABLE_INSTALL"] = True - if Version(self.version) < "2.8.0": - tc.variables["QUILL_USE_BOUNDED_QUEUE"] = self.options.with_bounded_queue - else: - if self.options.with_bounded_queue: - tc.preprocessor_definitions["QUILL_USE_BOUNDED_QUEUE"] = 1 - tc.variables["QUILL_NO_EXCEPTIONS"] = self.options.with_no_exceptions - tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True - if self.is_quilll_x86_arch(): - if Version(self.version) < "2.8.0": - tc.variables["QUILL_X86ARCH"] = True - else: - tc.preprocessor_definitions["QUILL_X86ARCH"] = 1 - tc.variables["CMAKE_CXX_FLAGS"] = "-mclflushopt" - if Version(self.version) >= "2.8.0" and self.options.get_safe("with_bounded_blocking_queue"): - tc.preprocessor_definitions["QUILL_USE_BOUNDED_BLOCKING_QUEUE"] = 1 - if Version(self.version) >= "3.2.0": - tc.variables["QUILL_DISABLE_POSITION_INDEPENDENT_CODE"] = not self.options.get_safe("fPIC") - tc.generate() - - deps = CMakeDeps(self) - deps.generate() def _patch_sources(self): # remove bundled fmt rmdir(self, os.path.join(self.source_folder, "quill", "quill", "include", "quill", "bundled", "fmt")) - if Version(self.version) < "4.0.0": - rmdir(self, os.path.join(self.source_folder, "quill", "quill", "src", "bundled", "fmt")) - - if "2.0.0" <= Version(self.version) < "2.9.1": - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - """set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/quill/cmake" CACHE STRING "Modules for CMake" FORCE)""", - """set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}/quill/cmake")""" - ) def build(self): self._patch_sources() - if Version(self.version) >= "4.0.0": - return - cmake = CMake(self) - cmake.configure() - cmake.build() def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - if Version(self.version) >= "4.0.0": - copy( - self, - "*.h", - os.path.join(self.source_folder, "quill", "include"), - os.path.join(self.package_folder, "include"), - ) - return - - cmake = CMake(self) - cmake.install() - rmdir(self, os.path.join(self.package_folder, "pkgconfig")) - rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "quill", "include"), + os.path.join(self.package_folder, "include"), + ) + def package_info(self): - if Version(self.version) < "4.0.0": - self.cpp_info.libs = ["quill"] - if self.is_quilll_x86_arch(): - self.cpp_info.defines.append("QUILL_X86ARCH") - self.cpp_info.cxxflags.append("-mclflushopt") - self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") - else: - self.cpp_info.bindirs = [] - self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - if Version(self.version) >= "2.0.0" and \ - self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": self.cpp_info.system_libs.append("stdc++fs") diff --git a/recipes/quill/all/test_package/CMakeLists.txt b/recipes/quill/all/test_package/CMakeLists.txt index 48af91aa96c21..4d5e7a7566fab 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -3,18 +3,9 @@ project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) -if(quill_VERSION VERSION_GREATER_EQUAL "4.0.0") - add_executable(${PROJECT_NAME} test_package_4_0.cpp) -else() - add_executable(${PROJECT_NAME} test_package.cpp) -endif() +add_executable(${PROJECT_NAME} test_package.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) -if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_compile_definitions(${PROJECT_NAME} PRIVATE QUILL_FILE_HANDLERS_API_V3_3) -if(quill_VERSION VERSION_GREATER_EQUAL "3.3.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE QUILL_FILE_HANDLERS_API_V3_3) -endif() diff --git a/recipes/quill/all/test_package/test_package.cpp b/recipes/quill/all/test_package/test_package.cpp index b02a6dd344b06..3c984618a5cd0 100644 --- a/recipes/quill/all/test_package/test_package.cpp +++ b/recipes/quill/all/test_package/test_package.cpp @@ -1,19 +1,59 @@ -#include "quill/Quill.h" +#include "quill/Backend.h" +#include "quill/Frontend.h" +#include "quill/LogMacros.h" +#include "quill/Logger.h" +#include "quill/sinks/ConsoleSink.h" + +#include +#include + +/** + * Trivial logging example to console + */ int main() { - quill::start(); -#ifdef QUILL_FILE_HANDLERS_API_V3_3 - auto file_handler = quill::file_handler("logfile.log", []() { - quill::FileHandlerConfig cfg; - cfg.set_open_mode('w'); - return cfg; - }()); -#else - auto file_handler = quill::file_handler("logfile.log", "w"); -#endif - auto my_logger = quill::create_logger("my_logger", std::move(file_handler)); - - LOG_INFO(my_logger, "Hello from {}", "Quill"); - LOG_CRITICAL(my_logger, "This is a conan example {}", 1234); + // Start the backend thread + quill::BackendOptions backend_options; + quill::Backend::start(backend_options); + + // Frontend + auto console_sink = quill::Frontend::create_or_get_sink("sink_id_1"); + quill::Logger* logger = quill::Frontend::create_or_get_logger("root", std::move(console_sink)); + + // Change the LogLevel to print everything + logger->set_log_level(quill::LogLevel::TraceL3); + + LOG_TRACE_L3(logger, "This is a log trace l3 example {}", 1); + LOG_TRACE_L2(logger, "This is a log trace l2 example {} {}", 2, 2.3); + LOG_TRACE_L1(logger, "This is a log trace l1 {} example", "string"); + LOG_DEBUG(logger, "This is a log debug example {}", 4); + LOG_INFO(logger, "This is a log info example {}", sizeof(std::string)); + LOG_WARNING(logger, "This is a log warning example {}", sizeof(std::string)); + LOG_ERROR(logger, "This is a log error example {}", sizeof(std::string)); + LOG_CRITICAL(logger, "This is a log critical example {}", sizeof(std::string)); + + // libfmt format specification mini language is supported + // note: named arguments are not supported + LOG_INFO(logger, "Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); + LOG_INFO(logger, "Easy padding in numbers like {:08d}", 12); + LOG_INFO(logger, "{:>30}", "right aligned"); + LOG_INFO(logger, "Positional arguments {1} {2} {0} ", "too", "are", "supported"); + LOG_INFO(logger, "Support for precision {:.4f}", 1.23456); + + // To log with a different format to the same sink, just create another logger + auto console_sink_2 = quill::Frontend::get_sink("sink_id_1"); // get the created sink + quill::Logger* logger_2 = quill::Frontend::create_or_get_logger( + "logger_2", std::move(console_sink_2), "%(time) %(log_level:<9) %(logger:<12) %(message)"); + + logger_2->set_log_level(quill::LogLevel::TraceL3); + + LOG_TRACE_L3(logger_2, "This is a log trace l3 example {}", 1); + LOG_TRACE_L2(logger_2, "This is a log trace l2 example {} {}", 2, 2.3); + LOG_TRACE_L1(logger_2, "This is a log trace l1 {} example", "string"); + LOG_DEBUG(logger_2, "This is a log debug example {}", 4); + LOG_INFO(logger_2, "This is a log info example {}", sizeof(std::string)); + LOG_WARNING(logger_2, "This is a log warning example {}", sizeof(std::string)); + LOG_ERROR(logger_2, "This is a log error example {}", sizeof(std::string)); + LOG_CRITICAL(logger_2, "This is a log critical example {}", sizeof(std::string)); } diff --git a/recipes/quill/all/test_package/test_package_4_0.cpp b/recipes/quill/all/test_package/test_package_4_0.cpp deleted file mode 100644 index 70b95a5d52c9d..0000000000000 --- a/recipes/quill/all/test_package/test_package_4_0.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "quill/Backend.h" -#include "quill/Frontend.h" -#include "quill/LogMacros.h" -#include "quill/Logger.h" -#include "quill/sinks/FileSink.h" - -#include - -int main() -{ - // Start the backend thread - quill::BackendOptions backend_options; - quill::Backend::start(backend_options); - - // Frontend - auto file_sink = quill::Frontend::create_or_get_sink( - "example_file_logging.log", - []() - { - quill::FileSinkConfig cfg; - cfg.set_open_mode('w'); - cfg.set_filename_append_option(quill::FilenameAppendOption::StartDateTime); - return cfg; - }(), - quill::FileEventNotifier{}); - - quill::Logger* logger = - quill::Frontend::create_or_get_logger("root", std::move(file_sink), - "%(time) [%(thread_id)] %(short_source_location:<28) " - "LOG_%(log_level:<9) %(logger:<12) %(message)", - "%H:%M:%S.%Qns", quill::Timezone::GmtTime); - - // set the log level of the logger to debug (default is info) - logger->set_log_level(quill::LogLevel::Debug); - - LOG_INFO(logger, "log something {}", 123); - LOG_DEBUG(logger, "something else {}", 456); -} diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 7e4db70e1a003..479950ba06b20 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -2,40 +2,40 @@ versions: "4.1.0": folder: "all" "3.9.0": - folder: "all" + folder: "old" "3.8.0": - folder: "all" + folder: "old" "3.7.0": - folder: "all" + folder: "old" "3.6.0": - folder: "all" + folder: "old" "3.5.1": - folder: "all" + folder: "old" "3.5.0": - folder: "all" + folder: "old" "3.4.1": - folder: "all" + folder: "old" "3.4.0": - folder: "all" + folder: "old" "3.3.1": - folder: "all" + folder: "old" "3.2.0": - folder: "all" + folder: "old" "3.1.0": - folder: "all" + folder: "old" "3.0.2": - folder: "all" + folder: "old" "2.9.2": - folder: "all" + folder: "old" "2.9.1": - folder: "all" + folder: "old" "2.9.0": - folder: "all" + folder: "old" "2.8.0": - folder: "all" + folder: "old" "2.7.0": - folder: "all" + folder: "old" "2.6.0": - folder: "all" + folder: "old" "1.7.3": - folder: "all" + folder: "old" diff --git a/recipes/quill/old/conandata.yml b/recipes/quill/old/conandata.yml new file mode 100644 index 0000000000000..5fe2a37cc1525 --- /dev/null +++ b/recipes/quill/old/conandata.yml @@ -0,0 +1,58 @@ +sources: + "3.9.0": + url: "https://github.com/odygrd/quill/archive/v3.9.0.tar.gz" + sha256: "6e6a46dc6ae94e8321aca00d27dae754dcc51ee83fe60078f8f1f3eb7b3b227b" + "3.8.0": + url: "https://github.com/odygrd/quill/archive/v3.8.0.tar.gz" + sha256: "d3e1b349c5d6904c9644e5b79ec65f21692e8094a3d75241a7fe071076eef4dd" + "3.7.0": + url: "https://github.com/odygrd/quill/archive/v3.7.0.tar.gz" + sha256: "53afe555c32b4263c9d31ec11bd0d858983374af7a5e79eb26124f803b192515" + "3.6.0": + url: "https://github.com/odygrd/quill/archive/v3.6.0.tar.gz" + sha256: "ba9dc3df262f2e65c57904580cc8407eba9a462001340c17bab7ae1dccddb4bd" + "3.5.1": + url: "https://github.com/odygrd/quill/archive/v3.5.1.tar.gz" + sha256: "9fa4ebe594c66ce2a409630c304724fa7a2ada0d842ba9c9aaf05f0a90b461f9" + "3.5.0": + url: "https://github.com/odygrd/quill/archive/v3.5.0.tar.gz" + sha256: "47a69465cddeb05645745bed0b3099b49cb627464782f765ce9545723ff1fe84" + "3.4.1": + url: "https://github.com/odygrd/quill/archive/v3.4.1.tar.gz" + sha256: "99f6497b8ba37c30c871fab89f14cd7bc989f3eaa921ccd940a521ee60a6a1c5" + "3.4.0": + url: "https://github.com/odygrd/quill/archive/v3.4.0.tar.gz" + sha256: "16a6cfadc288953f07d128bb51e8ebd4ca6bb8ce4175b5a8af53ce7dde324d8d" + "3.3.1": + url: "https://github.com/odygrd/quill/archive/v3.3.1.tar.gz" + sha256: "f929d54a115b45c32dd2acd1a9810336d35c31fde9f5581c51ad2b80f980d0d1" + "3.2.0": + url: "https://github.com/odygrd/quill/archive/v3.2.0.tar.gz" + sha256: "9745ad83b285bbd0481bd14c1b866b7e6121a981dd211b914f5d55955040fd00" + "3.1.0": + url: "https://github.com/odygrd/quill/archive/v3.1.0.tar.gz" + sha256: "9e7aa64c4f8101ed2b59d1cf3156b1c6bdd712ca89a2ec7aa7166905edc3e621" + "3.0.2": + url: "https://github.com/odygrd/quill/archive/v3.0.2.tar.gz" + sha256: "76e9f607168f71cf1028ae7374fbe91225e400c11b5a51a6ebc992c85d012eed" + "2.9.2": + url: "https://github.com/odygrd/quill/archive/v2.9.2.tar.gz" + sha256: "5b5b502f33277d1ebdb39d57898b1ca25affef4819d390927499f368dd562d91" + "2.9.1": + url: "https://github.com/odygrd/quill/archive/v2.9.1.tar.gz" + sha256: "921e053118136f63cebb2ca1d7e42456fd0bf9626facb755884709092753c054" + "2.9.0": + url: "https://github.com/odygrd/quill/archive/v2.9.0.tar.gz" + sha256: "dec64c0fbb4bfbafe28fdeeeefac10206285bf2be4a42ec5dfb7987ca4ccb372" + "2.8.0": + url: "https://github.com/odygrd/quill/archive/v2.8.0.tar.gz" + sha256: "0461a6c314e3d882f3b9ada487ef1bf558925272509ee41a9fd25f7776db6075" + "2.7.0": + url: "https://github.com/odygrd/quill/archive/v2.7.0.tar.gz" + sha256: "10b8912e4c463a3a86b809076b95bec49aa08393d9ae6b92196cd46314236b87" + "2.6.0": + url: "https://github.com/odygrd/quill/archive/v2.6.0.tar.gz" + sha256: "d72fd5a01bf8d3e59ed93a789a8f103bc31efe0fb3c09182c74036a2e3a8451b" + "1.7.3": + url: "https://github.com/odygrd/quill/archive/v1.7.3.tar.gz" + sha256: "3fff0c5ffb19bbde5429369079741f84a6acce3a781b504cec5e677b05461208" diff --git a/recipes/quill/old/conanfile.py b/recipes/quill/old/conanfile.py new file mode 100644 index 0000000000000..5132c325f18a0 --- /dev/null +++ b/recipes/quill/old/conanfile.py @@ -0,0 +1,177 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc + +import os + +required_conan_version = ">=1.52.0" + +class QuillConan(ConanFile): + name = "quill" + description = "Asynchronous Low Latency C++ Logging Library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/odygrd/quill/" + topics = ("logging", "log", "async") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "with_bounded_queue": [True, False], + "with_no_exceptions": [True, False], + "with_x86_arch": [True, False], + "with_bounded_blocking_queue": [True, False], + } + default_options = { + "fPIC": True, + "with_bounded_queue": False, + "with_no_exceptions": False, + "with_x86_arch": False, + "with_bounded_blocking_queue": False, + } + + @property + def _min_cppstd(self): + return "17" if Version(self.version) >= "2.0.0" else "14" + + @property + def _compilers_minimum_versions(self): + return { + "14": + { + "gcc": "5", + "Visual Studio": "15", + "clang": "5", + "apple-clang": "10", + }, + "17": + { + "gcc": "8", + "Visual Studio": "16", + "clang": "7", + "apple-clang": "12", + }, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if Version(self.version) < "2.8.0": + del self.options.with_bounded_blocking_queue + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/10.2.1", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] + + if not any(arch in str(self.settings.arch) for arch in supported_archs): + raise ConanInvalidConfiguration(f"{self.settings.arch} is not supported by {self.ref}") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + compilers_minimum_version = self._compilers_minimum_versions[self._min_cppstd] + minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version: + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") + else: + self.output.warning(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + + if Version(self.version) >= "2.0.0" and \ + self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ + self.settings.compiler.libcxx == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, which your compiler doesn't support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def is_quilll_x86_arch(self): + if not self.options.with_x86_arch: + return False + if Version(self.version) < "2.7.0": + return False + if self.settings.arch not in ("x86", "x86_64"): + return False + if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + return False + if is_msvc(self): + return False + return True + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QUILL_FMT_EXTERNAL"] = True + tc.variables["QUILL_ENABLE_INSTALL"] = True + if Version(self.version) < "2.8.0": + tc.variables["QUILL_USE_BOUNDED_QUEUE"] = self.options.with_bounded_queue + else: + if self.options.with_bounded_queue: + tc.preprocessor_definitions["QUILL_USE_BOUNDED_QUEUE"] = 1 + tc.variables["QUILL_NO_EXCEPTIONS"] = self.options.with_no_exceptions + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if self.is_quilll_x86_arch(): + if Version(self.version) < "2.8.0": + tc.variables["QUILL_X86ARCH"] = True + else: + tc.preprocessor_definitions["QUILL_X86ARCH"] = 1 + tc.variables["CMAKE_CXX_FLAGS"] = "-mclflushopt" + if Version(self.version) >= "2.8.0" and self.options.get_safe("with_bounded_blocking_queue"): + tc.preprocessor_definitions["QUILL_USE_BOUNDED_BLOCKING_QUEUE"] = 1 + if Version(self.version) >= "3.2.0": + tc.variables["QUILL_DISABLE_POSITION_INDEPENDENT_CODE"] = not self.options.get_safe("fPIC") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # remove bundled fmt + rmdir(self, os.path.join(self.source_folder, "quill", "quill", "include", "quill", "bundled", "fmt")) + rmdir(self, os.path.join(self.source_folder, "quill", "quill", "src", "bundled", "fmt")) + + if "2.0.0" <= Version(self.version) < "2.9.1": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + """set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/quill/cmake" CACHE STRING "Modules for CMake" FORCE)""", + """set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}/quill/cmake")""" + ) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["quill"] + if self.is_quilll_x86_arch(): + self.cpp_info.defines.append("QUILL_X86ARCH") + self.cpp_info.cxxflags.append("-mclflushopt") + self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + if Version(self.version) >= "2.0.0" and \ + self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": + self.cpp_info.system_libs.append("stdc++fs") diff --git a/recipes/quill/old/test_package/CMakeLists.txt b/recipes/quill/old/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..519d5ee2b3973 --- /dev/null +++ b/recipes/quill/old/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(quill REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) +if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() + +if(quill_VERSION VERSION_GREATER_EQUAL "3.3.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE QUILL_FILE_HANDLERS_API_V3_3) +endif() diff --git a/recipes/quill/old/test_package/conanfile.py b/recipes/quill/old/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/quill/old/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/quill/old/test_package/test_package.cpp b/recipes/quill/old/test_package/test_package.cpp new file mode 100644 index 0000000000000..b02a6dd344b06 --- /dev/null +++ b/recipes/quill/old/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include "quill/Quill.h" + +int main() +{ + quill::start(); +#ifdef QUILL_FILE_HANDLERS_API_V3_3 + auto file_handler = quill::file_handler("logfile.log", []() { + quill::FileHandlerConfig cfg; + cfg.set_open_mode('w'); + return cfg; + }()); +#else + auto file_handler = quill::file_handler("logfile.log", "w"); +#endif + auto my_logger = quill::create_logger("my_logger", std::move(file_handler)); + + LOG_INFO(my_logger, "Hello from {}", "Quill"); + LOG_CRITICAL(my_logger, "This is a conan example {}", 1234); +} diff --git a/recipes/quill/all/test_v1_package/CMakeLists.txt b/recipes/quill/old/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/quill/all/test_v1_package/CMakeLists.txt rename to recipes/quill/old/test_v1_package/CMakeLists.txt diff --git a/recipes/quill/all/test_v1_package/conanfile.py b/recipes/quill/old/test_v1_package/conanfile.py similarity index 100% rename from recipes/quill/all/test_v1_package/conanfile.py rename to recipes/quill/old/test_v1_package/conanfile.py From 8adb5e0ccbd36fcf17c0c38a96508fe3c8b98f09 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 28 May 2024 09:46:43 +0900 Subject: [PATCH 08/10] remove package_id in old recipe --- recipes/quill/old/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/quill/old/conanfile.py b/recipes/quill/old/conanfile.py index 5132c325f18a0..ec7b4a29d6da7 100644 --- a/recipes/quill/old/conanfile.py +++ b/recipes/quill/old/conanfile.py @@ -71,9 +71,6 @@ def layout(self): def requirements(self): self.requires("fmt/10.2.1", transitive_headers=True) - def package_id(self): - self.info.clear() - def validate(self): supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] From 7a9de367d0bc4d77775e4e7f8044a371ab972cba Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 1 Jun 2024 23:39:43 +0900 Subject: [PATCH 09/10] update 4.2.1 --- recipes/quill/all/conandata.yml | 6 +++--- recipes/quill/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index c4f6120c25648..b12f69acb137f 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "4.1.0": - url: "https://github.com/odygrd/quill/archive/v4.1.0.tar.gz" - sha256: "53ebaf36ae1fccbb0ef1ce7bfcd746de6281d87ae691c2284c36119fc20e2194" + "4.2.1": + url: "https://github.com/odygrd/quill/archive/v4.2.1.tar.gz" + sha256: "c1e49181da44cfda175085f4d2027dd8f38b171ca12fc659b61a3138535ab46e" diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 479950ba06b20..961ea742e1093 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,5 +1,5 @@ versions: - "4.1.0": + "4.2.1": folder: "all" "3.9.0": folder: "old" From 93ccfb576614e6438e0208bd0b64b3b980a8f78e Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 3 Jun 2024 00:26:28 +0900 Subject: [PATCH 10/10] update 4.3.0 --- recipes/quill/all/conandata.yml | 6 +++--- recipes/quill/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index b12f69acb137f..5a2aea87cc533 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "4.2.1": - url: "https://github.com/odygrd/quill/archive/v4.2.1.tar.gz" - sha256: "c1e49181da44cfda175085f4d2027dd8f38b171ca12fc659b61a3138535ab46e" + "4.3.0": + url: "https://github.com/odygrd/quill/archive/v4.3.0.tar.gz" + sha256: "c97bf3bfac6dfb7ed77fa08d945a490e302ba07e405539fda61985b39750cb29" diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 961ea742e1093..722f4f019f681 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,5 +1,5 @@ versions: - "4.2.1": + "4.3.0": folder: "all" "3.9.0": folder: "old"