xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("fmtlog")
  2. set_homepage("https://github.com/MengRao/fmtlog")
  3. set_description("fmtlog is a performant fmtlib-style logging library with latency in nanoseconds.")
  4. set_license("MIT")
  5. add_urls("https://github.com/MengRao/fmtlog/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/MengRao/fmtlog.git")
  7. add_versions("v2.1.2", "d286184e04c3c3286417873dd2feac524c53babc6cd60f10179aa5b10416ead7")
  8. add_deps("cmake", "fmt")
  9. if is_plat("linux") then
  10. add_syslinks("pthread")
  11. end
  12. on_install("linux", "macosx", "windows", function (package)
  13. local configs = {}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. io.replace("CMakeLists.txt", "add_subdirectory(fmt)", "", {plain = true})
  16. io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true})
  17. io.replace("CMakeLists.txt", "add_subdirectory(bench)", "", {plain = true})
  18. import("package.tools.cmake").install(package, configs, {packagedeps = "fmt"})
  19. if package:config("shared") then
  20. os.tryrm(path.join(package:installdir("lib"), "*.a"))
  21. else
  22. os.tryrm(path.join(package:installdir("lib"), "*.dll"))
  23. os.tryrm(path.join(package:installdir("lib"), "*.dylib"))
  24. os.tryrm(path.join(package:installdir("lib"), "*.so"))
  25. end
  26. os.cp("*.h", package:installdir("include/fmtlog"))
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. void test() {
  31. logi("A info msg");
  32. }
  33. ]]}, {configs = {languages = "c++17"}, includes = "fmtlog/fmtlog.h"}))
  34. end)