Skip to content

Commit d65285a

Browse files
committed
Add Bazel build rules.
1 parent 7665574 commit d65285a

7 files changed

+119
-1
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --cxxopt="--std=c++17"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ build/*
22
Testing/*
33
.cache/
44
compile_commands.json
5+
bazel-*
56

67
# Visual studio
78
.vs/

BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cc_library(
2+
name = "fast_float",
3+
hdrs = glob(["include/fast_float/*.h"]),
4+
strip_include_prefix = "include",
5+
visibility = ["//visibility:public"],
6+
)

MODULE.bazel

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""fast_float number parsing library: 4x faster than strtod"""
2+
3+
module(
4+
name = "fast_float",
5+
version = "6.1.6",
6+
compatibility_level = 6,
7+
)
8+
9+
bazel_dep(name = "doctest", version = "2.4.11", dev_dependency = True)

tests/BUILD.bazel

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
cc_test(
2+
name = "basictest",
3+
srcs = ["basictest.cpp"],
4+
deps = [
5+
"//:fast_float",
6+
"@doctest//doctest",
7+
],
8+
)
9+
10+
cc_test(
11+
name = "example_test",
12+
srcs = ["example_test.cpp"],
13+
deps = [
14+
"//:fast_float",
15+
"@doctest//doctest",
16+
],
17+
)
18+
19+
cc_test(
20+
name = "example_comma_test",
21+
srcs = ["example_comma_test.cpp"],
22+
deps = [
23+
"//:fast_float",
24+
"@doctest//doctest",
25+
],
26+
)
27+
28+
cc_test(
29+
name = "fast_int",
30+
srcs = ["fast_int.cpp"],
31+
deps = [
32+
"//:fast_float",
33+
"@doctest//doctest",
34+
],
35+
)
36+
37+
cc_test(
38+
name = "fixedwidthtest",
39+
srcs = ["fixedwidthtest.cpp"],
40+
deps = [
41+
"//:fast_float",
42+
"@doctest//doctest",
43+
],
44+
)
45+
46+
cc_test(
47+
name = "fortran",
48+
srcs = ["fortran.cpp"],
49+
deps = [
50+
"//:fast_float",
51+
"@doctest//doctest",
52+
],
53+
)
54+
55+
cc_test(
56+
name = "json_fmt",
57+
srcs = ["json_fmt.cpp"],
58+
deps = [
59+
"//:fast_float",
60+
"@doctest//doctest",
61+
],
62+
)
63+
64+
cc_test(
65+
name = "long_test",
66+
srcs = ["long_test.cpp"],
67+
deps = [
68+
"//:fast_float",
69+
"@doctest//doctest",
70+
],
71+
)
72+
73+
cc_test(
74+
name = "powersoffive_hardround",
75+
srcs = ["powersoffive_hardround.cpp"],
76+
deps = [
77+
"//:fast_float",
78+
"@doctest//doctest",
79+
],
80+
)
81+
82+
cc_test(
83+
name = "rcppfastfloat_test",
84+
srcs = ["rcppfastfloat_test.cpp"],
85+
deps = [
86+
"//:fast_float",
87+
"@doctest//doctest",
88+
],
89+
)
90+
91+
cc_test(
92+
name = "string_test",
93+
srcs = ["string_test.cpp"],
94+
deps = [
95+
"//:fast_float",
96+
"@doctest//doctest",
97+
],
98+
)

tests/basictest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
22
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
3-
#include <doctest/doctest.h>
3+
#include "doctest/doctest.h"
44

55
#include "fast_float/fast_float.h"
66
#include <cmath>

tests/fixedwidthtest.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#include <cstring>
55
#include "fast_float/fast_float.h"
66
#include <cstdint>
7+
8+
#if __cplusplus >= 202300L
79
#include <stdfloat>
10+
#endif
811

912
int main() {
1013
// Write some testcases for the parsing of floating point numbers in the

0 commit comments

Comments
 (0)