Skip to content

Commit

Permalink
Merge pull request #274 from BYVoid/bazel
Browse files Browse the repository at this point in the history
Add Bazel build rules.
  • Loading branch information
lemire authored Nov 1, 2024
2 parents 7665574 + d65285a commit e800cab
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 1 deletion.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt="--std=c++17"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build/*
Testing/*
.cache/
compile_commands.json
bazel-*

# Visual studio
.vs/
Expand Down
6 changes: 6 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cc_library(
name = "fast_float",
hdrs = glob(["include/fast_float/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
9 changes: 9 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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)
98 changes: 98 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
],
)
2 changes: 1 addition & 1 deletion tests/basictest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
#include "doctest/doctest.h"

#include "fast_float/fast_float.h"
#include <cmath>
Expand Down
3 changes: 3 additions & 0 deletions tests/fixedwidthtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#include <cstring>
#include "fast_float/fast_float.h"
#include <cstdint>

#if __cplusplus >= 202300L
#include <stdfloat>
#endif

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

0 comments on commit e800cab

Please sign in to comment.