xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.2.1", "9bc2f1ea37eece0f4807689962b529d2d4fa07654baef184f051319b4eac9304")
  8. add_versions("v2.1.2", "d286184e04c3c3286417873dd2feac524c53babc6cd60f10179aa5b10416ead7")
  9. add_deps("cmake", "fmt")
  10. if is_plat("linux") then
  11. add_syslinks("pthread")
  12. end
  13. on_install("linux", "macosx", "windows|!arm64", function (package)
  14. local configs = {}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. io.replace("CMakeLists.txt", "add_subdirectory(fmt)", "", {plain = true})
  17. io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true})
  18. io.replace("CMakeLists.txt", "add_subdirectory(bench)", "", {plain = true})
  19. import("package.tools.cmake").install(package, configs, {packagedeps = "fmt"})
  20. if package:config("shared") then
  21. os.tryrm(path.join(package:installdir("lib"), "*.a"))
  22. else
  23. os.tryrm(path.join(package:installdir("lib"), "*.dll"))
  24. os.tryrm(path.join(package:installdir("lib"), "*.dylib"))
  25. os.tryrm(path.join(package:installdir("lib"), "*.so"))
  26. end
  27. os.cp("*.h", package:installdir("include/fmtlog"))
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. void test() {
  32. logi("A info msg");
  33. }
  34. ]]}, {configs = {languages = "c++17"}, includes = "fmtlog/fmtlog.h"}))
  35. end)