File tree Expand file tree Collapse file tree 7 files changed +1655
-1
lines changed Expand file tree Collapse file tree 7 files changed +1655
-1
lines changed Original file line number Diff line number Diff line change 1111 run : |
1212 mkdir build &&
1313 cd build &&
14- CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON .. &&
14+ CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON -D FASTFLOAT_BENCHMARKS=ON .. &&
1515 cmake --build . &&
1616 ctest --output-on-failure
1717 - name : Use cmake CXX23
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ project(fast_float VERSION 7.0.0 LANGUAGES CXX)
44set (FASTFLOAT_CXX_STANDARD 11 CACHE STRING "the C++ standard to use for fastfloat" )
55set (CMAKE_CXX_STANDARD ${FASTFLOAT_CXX_STANDARD} )
66option (FASTFLOAT_TEST "Enable tests" OFF )
7+
78if (FASTFLOAT_TEST)
89 enable_testing ()
910 add_subdirectory (tests)
@@ -29,6 +30,16 @@ if(FASTFLOAT_INSTALL)
2930endif ()
3031
3132add_library (fast_float INTERFACE )
33+
34+
35+ option (FASTFLOAT_BENCHMARKS "Enable benchmarks" OFF )
36+ if (FASTFLOAT_BENCHMARKS)
37+ add_subdirectory (benchmarks)
38+ else (FASTFLOAT_BENCHMARKS)
39+ message (STATUS "Benchmarks are disabled. Set FASTFLOAT_BENCHMARKS to ON to build benchmarks (assumes C++17)." )
40+ endif (FASTFLOAT_BENCHMARKS)
41+
42+
3243add_library (FastFloat::fast_float ALIAS fast_float)
3344target_include_directories (
3445 fast_float
Original file line number Diff line number Diff line change 1+ add_executable (realbenchmark benchmark.cpp)
2+ set_property (
3+ TARGET realbenchmark
4+ PROPERTY CXX_STANDARD 17)
5+
6+ target_link_libraries (realbenchmark PUBLIC fast_float)
7+ include (ExternalProject)
8+
9+ # Define the external project
10+ ExternalProject_Add(simple_fastfloat_benchmark
11+ GIT_REPOSITORY https://github.com/lemire/simple_fastfloat_benchmark.git
12+ GIT_TAG master # or specify a particular commit/tag/branch
13+ SOURCE_DIR ${CMAKE_BINARY_DIR} /simple_fastfloat_benchmark
14+ BINARY_DIR ${CMAKE_BINARY_DIR} /simple_fastfloat_benchmark-build
15+ CONFIGURE_COMMAND ""
16+ BUILD_COMMAND ""
17+ INSTALL_COMMAND ""
18+ )
19+ set (DATA_DIR ${CMAKE_BINARY_DIR} /simple_fastfloat_benchmark/data)
20+
21+ add_custom_target (CopyData ALL
22+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${DATA_DIR} ${CMAKE_CURRENT_BINARY_DIR} /data
23+ DEPENDS simple_fastfloat_benchmark
24+ )
25+ add_dependencies (realbenchmark CopyData)
26+ target_compile_definitions (realbenchmark PUBLIC BENCHMARK_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR} /data" )
You can’t perform that action at this time.
0 commit comments