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

Added lwlog recipe #26283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions recipes/lwlog/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sources:
"latest":
url:
- "https://github.com/ChristianPanov/lwlog/archive/refs/heads/master.zip"
sha256: "687ccccec729548526aecb5287df071f28b37aa78fb4923092a97f71a6869c31"
55 changes: 55 additions & 0 deletions recipes/lwlog/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps


class lwlogRecipe(ConanFile):
name = "lwlog"
version = "latest"
package_type = "library"

# Optional metadata
license = "MIT"
author = "Christian Panov"
url = "https://github.com/ChristianPanov/lwlog"
description = "Very fast synchronous and asynchronous C++17 logging library"
topics = ("library", "cpp", "asynchronous", "high-performance", "logger", "logging", "metaprogramming", "logging-library", "cpp17", "low-latency", "logger-middleware", "logging-framework", "cpp17-library", "lwlog")

# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"fPIC": [True, False]}
default_options = {"fPIC": True}

# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "CMakeLists.txt", "Config.cmake.in", "lwlog/src/*", "Sandbox/*"

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["lwlog_lib"]
self.cpp_info.set_property("cmake_file_name", "lwlog")
self.cpp_info.set_property("cmake_target_name", "lwlog::lwlog_lib")
self.cpp_info.includedirs = ["include/src"]
10 changes: 10 additions & 0 deletions recipes/lwlog/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.15)
project(PackageTest CXX)

find_package(lwlog CONFIG REQUIRED)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(example test_package.cpp)
target_link_libraries(example lwlog::lwlog_lib)
26 changes: 26 additions & 0 deletions recipes/lwlog/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


class lwlogTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "example")
self.run(cmd, env="conanrun")
27 changes: 27 additions & 0 deletions recipes/lwlog/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "lwlog.h"

int main()
{
using logger_config = lwlog::configuration<
lwlog::disable_local_time,
lwlog::disable_thread_id,
lwlog::disable_process_id,
lwlog::disable_topics>;

auto console = std::make_shared<
lwlog::logger<
logger_config,
lwlog::asynchronous_policy<
lwlog::default_async_queue_size,
lwlog::default_overflow_policy>,
lwlog::immediate_flush_policy,
lwlog::single_threaded_policy,
lwlog::sinks::stdout_sink>>("CONSOLE");

console->set_level_filter(lwlog::level::info | lwlog::level::debug | lwlog::level::critical);
console->set_pattern(".red([%T] [%n]) .dark_green([%l]): .cyan(%v) TEXT");

console->critical("First critical message");

return 0;
}
3 changes: 3 additions & 0 deletions recipes/lwlog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"latest":
folder: all