Skip to content

Commit

Permalink
Merge branch 'fastfloat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
RealTimeChris authored Nov 25, 2024
2 parents d4c573d + 0a17150 commit 3d83d19
Show file tree
Hide file tree
Showing 11 changed files with 1,718 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
run: |
mkdir build &&
cd build &&
CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON .. &&
CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON -D FASTFLOAT_BENCHMARKS=ON .. &&
cmake --build . &&
ctest --output-on-failure
- name: Use cmake CXX23
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(fast_float VERSION 7.0.0 LANGUAGES CXX)
set(FASTFLOAT_CXX_STANDARD 11 CACHE STRING "the C++ standard to use for fastfloat")
set(CMAKE_CXX_STANDARD ${FASTFLOAT_CXX_STANDARD})
option(FASTFLOAT_TEST "Enable tests" OFF)

if(FASTFLOAT_TEST)
enable_testing()
add_subdirectory(tests)
Expand All @@ -29,6 +30,16 @@ if(FASTFLOAT_INSTALL)
endif()

add_library(fast_float INTERFACE)


option(FASTFLOAT_BENCHMARKS "Enable benchmarks" OFF)
if(FASTFLOAT_BENCHMARKS)
add_subdirectory(benchmarks)
else(FASTFLOAT_BENCHMARKS)
message(STATUS "Benchmarks are disabled. Set FASTFLOAT_BENCHMARKS to ON to build benchmarks (assumes C++17).")
endif(FASTFLOAT_BENCHMARKS)


add_library(FastFloat::fast_float ALIAS fast_float)
target_include_directories(
fast_float
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

## fast_float number parsing library: 4x faster than strtod

[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/fast_float.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:fast_float)
[![Ubuntu 22.04 CI (GCC 11)](https://github.com/fastfloat/fast_float/actions/workflows/ubuntu22.yml/badge.svg)](https://github.com/fastfloat/fast_float/actions/workflows/ubuntu22.yml)

The fast_float library provides fast header-only implementations for the C++
Expand Down
26 changes: 26 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
add_executable(realbenchmark benchmark.cpp)
set_property(
TARGET realbenchmark
PROPERTY CXX_STANDARD 17)

target_link_libraries(realbenchmark PUBLIC fast_float)
include(ExternalProject)

# Define the external project
ExternalProject_Add(simple_fastfloat_benchmark
GIT_REPOSITORY https://github.com/lemire/simple_fastfloat_benchmark.git
GIT_TAG master # or specify a particular commit/tag/branch
SOURCE_DIR ${CMAKE_BINARY_DIR}/simple_fastfloat_benchmark
BINARY_DIR ${CMAKE_BINARY_DIR}/simple_fastfloat_benchmark-build
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(DATA_DIR ${CMAKE_BINARY_DIR}/simple_fastfloat_benchmark/data)

add_custom_target(CopyData ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DATA_DIR} ${CMAKE_CURRENT_BINARY_DIR}/data
DEPENDS simple_fastfloat_benchmark
)
add_dependencies(realbenchmark CopyData)
target_compile_definitions(realbenchmark PUBLIC BENCHMARK_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data")
Loading

0 comments on commit 3d83d19

Please sign in to comment.