xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("celero")
  2. set_homepage("https://github.com/DigitalInBlue/Celero")
  3. set_description("C++ Benchmarking Library")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/DigitalInBlue/Celero/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/DigitalInBlue/Celero.git")
  7. add_versions("v2.9.0", "d59df84696e0dd58022d2c42837362c06eba6d1e29bac61f7b3143bc73d779e5")
  8. add_versions("v2.8.5", "1f319661c4bee1f6855e45c1764be6cd38bfe27e8afa8da1ad7060c1a793aa20")
  9. add_versions("v2.8.2", "7d2131ba27ca5343b31f1e04777ed3e666e2ad7f785e79c960c872fc48cd5f88")
  10. add_patches("v2.8.2", path.join(os.scriptdir(), "patches", "2.8.2", "gcc11.patch"), "4851cc1ed85d9ee9ce000d7df9d5baabc86f83c50cff09074159239fa37ca8e9")
  11. add_deps("cmake")
  12. on_load("windows", function (package)
  13. if not package:config("shared") then
  14. package:add("defines", "CELERO_STATIC")
  15. end
  16. end)
  17. on_install("windows", "macosx", "linux", function (package)
  18. local configs = {"-DCELERO_TREAT_WARNINGS_AS_ERRORS=OFF"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DCELERO_COMPILE_DYNAMIC_LIBRARIES=" .. (package:config("shared") and "ON" or "OFF"))
  21. if package:is_plat("windows") then
  22. table.insert(configs, "-DVCPKG_CRT_LINKAGE=" .. (package:config("vs_runtime"):startswith("MT") and "static" or "dynamic"))
  23. end
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. void test() {
  29. const auto time = celero::timer::GetSystemTime();
  30. }
  31. ]]}, {configs = {languages = "c++14"}, includes = "celero/Timer.h"}))
  32. end)