xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728
  1. package("fast_float")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/fastfloat/fast_float")
  4. set_description("Fast and exact implementation of the C++ from_chars functions for float and double types: 4x faster than strtod")
  5. set_license("Apache-2.0")
  6. add_urls("https://github.com/fastfloat/fast_float/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/fastfloat/fast_float.git")
  8. add_versions("v3.5.1", "8558bf9c66ccd2f7d03c94461a107f49ad9cf6e4f6c0c84e148fec0aa32b4dd9")
  9. add_versions("v3.4.0", "a242877d2fae81ca412033f5ebf5dbc43cb029c56b4af78e33106b9a69f8f58e")
  10. if is_plat("wasm") then
  11. add_patches("v3.4.0", path.join(os.scriptdir(), "patches", "emscripten_fix.patch"), "482705431f67e6f0a375ed7bfe87d6856e7d13f071db6157e1d5659834b0eb50")
  12. end
  13. on_install(function (package)
  14. os.vcp("include/fast_float", package:installdir("include"))
  15. end)
  16. on_test(function (package)
  17. assert(package:check_cxxsnippets({test = [[
  18. void test() {
  19. const std::string input = "3.1416 xyz ";
  20. double result;
  21. auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
  22. }
  23. ]]}, {configs = {languages = "c++11"}, includes = {"fast_float/fast_float.h"}}))
  24. end)