xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("lwlog")
  2. set_homepage("https://github.com/ChristianPanov/lwlog")
  3. set_description("Very fast synchronous and asynchronous C++17 logging library")
  4. set_license("MIT")
  5. add_urls("https://github.com/ChristianPanov/lwlog/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ChristianPanov/lwlog.git")
  7. add_versions("v1.3.1", "63123ff25b15d46ad0a89d4c85dd7c22d63382b89ed251607b3cbd908698a6da")
  8. if is_plat("linux", "bsd") then
  9. add_syslinks("pthread")
  10. end
  11. add_includedirs("include/src")
  12. add_deps("cmake")
  13. on_install(function (package)
  14. io.replace("CMakeLists.txt", "STATIC", "", {plain = true})
  15. io.replace("CMakeLists.txt",
  16. "target_link_libraries(lwlog_lib PRIVATE Threads::Threads)",
  17. "target_link_libraries(lwlog_lib PUBLIC Threads::Threads)", {plain = true})
  18. local configs = {}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. if package:is_plat("windows") and package:config("shared") then
  22. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  23. end
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <lwlog.h>
  29. void test() {
  30. lwlog::init_default_logger();
  31. lwlog::info("Info message");
  32. }
  33. ]]}, {configs = {languages = "c++17"}}))
  34. end)