diff --git a/packages/l/lwlog/xmake.lua b/packages/l/lwlog/xmake.lua index d9f52c99a29..315365de46c 100644 --- a/packages/l/lwlog/xmake.lua +++ b/packages/l/lwlog/xmake.lua @@ -6,17 +6,22 @@ package("lwlog") add_urls("https://github.com/ChristianPanov/lwlog/archive/refs/tags/$(version).tar.gz", "https://github.com/ChristianPanov/lwlog.git") + add_versions("v1.4.0", "8100a1044fd62a4ebeaf60da08ead27def0edeb92606fd88bc86f66ed54dbb40") add_versions("v1.3.1", "63123ff25b15d46ad0a89d4c85dd7c22d63382b89ed251607b3cbd908698a6da") if is_plat("linux", "bsd") then add_syslinks("pthread") end - add_includedirs("include/src") - add_deps("cmake") on_install(function (package) + if package:version() and package:version():ge("1.4.0") then + package:add("includedirs", "include", "include/lwlog") + else + package:add("includedirs", "include/src") + end + io.replace("CMakeLists.txt", "STATIC", "", {plain = true}) io.replace("CMakeLists.txt", "target_link_libraries(lwlog_lib PRIVATE Threads::Threads)", @@ -32,11 +37,21 @@ package("lwlog") end) on_test(function (package) - assert(package:check_cxxsnippets({test = [[ - #include - void test() { - lwlog::init_default_logger(); - lwlog::info("Info message"); - } - ]]}, {configs = {languages = "c++17"}})) + if package:version() and package:version():ge("1.4.0") then + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + auto console = std::make_shared("CONSOLE"); + console->info("First info message"); + } + ]]}, {configs = {languages = "c++17"}})) + else + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + lwlog::init_default_logger(); + lwlog::info("Info message"); + } + ]]}, {configs = {languages = "c++17"}})) + end end)