File tree Expand file tree Collapse file tree 8 files changed +85
-0
lines changed Expand file tree Collapse file tree 8 files changed +85
-0
lines changed Original file line number Diff line number Diff line change 84
84
working-directory : ${{github.workspace}}/test/library
85
85
run : cmake -Bbuild
86
86
87
+ - name : Build lib metabench tests
88
+ working-directory : ${{github.workspace}}/test/library
89
+ run : cmake --build build -t metabench_tests
90
+
87
91
- name : Check lib quality
88
92
working-directory : ${{github.workspace}}/test/library
89
93
run : cmake --build build -t ci-quality
Original file line number Diff line number Diff line change @@ -47,3 +47,18 @@ if(NOT COMMAND boost_sml_recipe)
47
47
"SML_BUILD_TESTS OFF" )
48
48
endmacro ()
49
49
endif ()
50
+
51
+ if (NOT COMMAND metabench_recipe)
52
+ macro (metabench_recipe VERSION )
53
+ add_versioned_package(
54
+ NAME
55
+ metabench
56
+ GITHUB_REPOSITORY
57
+ "ldionne/metabench"
58
+ GIT_TAG
59
+ ${VERSION}
60
+ DOWNLOAD_ONLY
61
+ YES )
62
+ include ("${metabench_SOURCE_DIR} /metabench.cmake" )
63
+ endmacro ()
64
+ endif ()
Original file line number Diff line number Diff line change
1
+ if (COMMAND add_metabench_profile)
2
+ return ()
3
+ endif ()
4
+
5
+ add_custom_target (metabench_tests)
6
+
7
+ macro (get_metabench)
8
+ if (NOT COMMAND metabench_add_chart)
9
+ metabench_recipe(3322ce7)
10
+ endif ()
11
+ endmacro ()
12
+
13
+ function (add_mb_profile)
14
+ set (singleValueArgs TARGET RANGE)
15
+ set (multiValueArgs TEMPLATES INCLUDE_DIRECTORIES LIBRARIES DS_ARGS
16
+ CHART_ARGS)
17
+ cmake_parse_arguments (MB "" "${singleValueArgs} " "${multiValueArgs} "
18
+ ${ARGN} )
19
+
20
+ foreach (template ${MB_TEMPLATES} )
21
+ string (REPLACE "/" "_" dataset ${template} )
22
+ metabench_add_dataset(${dataset} "${template} " "${MB_RANGE} " NAME
23
+ ${dataset} ${MB_DS_ARGS} )
24
+ target_include_directories (${dataset} PRIVATE ${MB_INCLUDE_DIRECTORIES} )
25
+ target_link_libraries (${dataset} PRIVATE ${MB_LIBRARIES} )
26
+ list (APPEND datasets ${dataset} )
27
+ endforeach ()
28
+
29
+ metabench_add_chart(${MB_TARGET} DATASETS ${datasets} ${MB_CHART_ARGS} )
30
+ add_dependencies (metabench_tests ${MB_TARGET} )
31
+ endfunction ()
32
+
33
+ macro (add_metabench_profile)
34
+ get_metabench()
35
+ add_mb_profile(${ARGN} )
36
+ endmacro ()
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
13
13
include (${CMAKE_CURRENT_LIST_DIR} /sanitizers.cmake)
14
14
include (${CMAKE_CURRENT_LIST_DIR} /test .cmake)
15
15
include (${CMAKE_CURRENT_LIST_DIR} /benchmark.cmake)
16
+ include (${CMAKE_CURRENT_LIST_DIR} /metabench.cmake)
16
17
17
18
include (${CMAKE_CURRENT_LIST_DIR} /warnings.cmake)
18
19
include (${CMAKE_CURRENT_LIST_DIR} /profile.cmake)
Original file line number Diff line number Diff line change @@ -32,4 +32,5 @@ target_sources(
32
32
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
33
33
add_docs(docs)
34
34
clang_tidy_interface(TARGET test_lib EXCLUDE_FILESETS exclusions)
35
+ add_subdirectory (test )
35
36
endif ()
Original file line number Diff line number Diff line change
1
+ add_metabench_profile(
2
+ TARGET
3
+ mb_test
4
+ RANGE
5
+ "[1, 100, 200]"
6
+ TEMPLATES
7
+ test_array.cpp.erb
8
+ test_tuple.cpp.erb
9
+ DS_ARGS
10
+ MEDIAN_OF
11
+ 3
12
+ CHART_ARGS
13
+ TITLE
14
+ "test" )
Original file line number Diff line number Diff line change
1
+ #include < array >
2
+
3
+ auto main() -> int {
4
+ #if defined(METABENCH)
5
+ [[maybe_unused]] auto a = std::array{<%= ( 1 ..n ) . to_a . join ( ', ' ) %> };
6
+ #endif
7
+ }
Original file line number Diff line number Diff line change
1
+ #include < tuple >
2
+
3
+ auto main() -> int {
4
+ #if defined(METABENCH)
5
+ [[maybe_unused]] auto t = std::make_tuple(<%= ( 1 ..n ) . to_a . join ( ', ' ) %> );
6
+ #endif
7
+ }
You can’t perform that action at this time.
0 commit comments