diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..f33ebf5f --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --cxxopt="--std=c++17" diff --git a/.gitignore b/.gitignore index 75dc2e8d..17a55c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ build/* Testing/* .cache/ compile_commands.json +bazel-* # Visual studio .vs/ diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..fc784a3b --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,6 @@ +cc_library( + name = "fast_float", + hdrs = glob(["include/fast_float/*.h"]), + strip_include_prefix = "include", + visibility = ["//visibility:public"], +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..6704680e --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,9 @@ +"""fast_float number parsing library: 4x faster than strtod""" + +module( + name = "fast_float", + version = "6.1.6", + compatibility_level = 6, +) + +bazel_dep(name = "doctest", version = "2.4.11", dev_dependency = True) diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel new file mode 100644 index 00000000..45f0b51e --- /dev/null +++ b/tests/BUILD.bazel @@ -0,0 +1,98 @@ +cc_test( + name = "basictest", + srcs = ["basictest.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "example_test", + srcs = ["example_test.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "example_comma_test", + srcs = ["example_comma_test.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "fast_int", + srcs = ["fast_int.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "fixedwidthtest", + srcs = ["fixedwidthtest.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "fortran", + srcs = ["fortran.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "json_fmt", + srcs = ["json_fmt.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "long_test", + srcs = ["long_test.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "powersoffive_hardround", + srcs = ["powersoffive_hardround.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "rcppfastfloat_test", + srcs = ["rcppfastfloat_test.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) + +cc_test( + name = "string_test", + srcs = ["string_test.cpp"], + deps = [ + "//:fast_float", + "@doctest//doctest", + ], +) diff --git a/tests/basictest.cpp b/tests/basictest.cpp index a66ccaf6..c502a03e 100644 --- a/tests/basictest.cpp +++ b/tests/basictest.cpp @@ -1,6 +1,6 @@ #define DOCTEST_CONFIG_SUPER_FAST_ASSERTS #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include "doctest/doctest.h" #include "fast_float/fast_float.h" #include diff --git a/tests/fixedwidthtest.cpp b/tests/fixedwidthtest.cpp index 8443501e..59ba7990 100644 --- a/tests/fixedwidthtest.cpp +++ b/tests/fixedwidthtest.cpp @@ -4,7 +4,10 @@ #include #include "fast_float/fast_float.h" #include + +#if __cplusplus >= 202300L #include +#endif int main() { // Write some testcases for the parsing of floating point numbers in the