xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  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).zip",
  6. "https://github.com/DigitalInBlue/Celero.git")
  7. add_versions("v2.8.2", "6618c45adf2671c550997780e334592969fc4179d086b5b3cf5369fb1f4f6743")
  8. add_patches("v2.8.2", path.join(os.scriptdir(), "patches", "2.8.2", "gcc11.patch"), "4851cc1ed85d9ee9ce000d7df9d5baabc86f83c50cff09074159239fa37ca8e9")
  9. add_deps("cmake")
  10. on_load("windows", function (package)
  11. if not package:config("shared") then
  12. package:add("defines", "CELERO_STATIC")
  13. end
  14. end)
  15. on_install("windows", "macosx", "linux", function (package)
  16. local configs = {"-DCELERO_TREAT_WARNINGS_AS_ERRORS=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DCELERO_COMPILE_DYNAMIC_LIBRARIES=" .. (package:config("shared") and "ON" or "OFF"))
  19. if package:is_plat("windows") then
  20. table.insert(configs, "-DVCPKG_CRT_LINKAGE=" .. (package:config("vs_runtime"):startswith("MT") and "static" or "dynamic"))
  21. end
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. void test() {
  27. const auto time = celero::timer::GetSystemTime();
  28. }
  29. ]]}, {configs = {languages = "c++14"}, includes = "celero/Timer.h"}))
  30. end)