Skip to content

Commit 0dde907

Browse files
committed
[cmake-format] add gersemi setup and pre-commit
1 parent 6bb1274 commit 0dde907

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.pre-commit-config.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ repos:
1414
third_party/identify_stream_usage/.*|
1515
include/ginkgo/ginkgo.hpp
1616
)
17-
- repo: https://github.com/cheshirekow/cmake-format-precommit
18-
rev: 'v0.6.13' # The current latest release
17+
- repo: https://github.com/BlankSpruce/gersemi
18+
rev: 0.19.0
1919
hooks:
20-
- id: cmake-format
20+
- id: gersemi
2121
name: cmake-format
22+
files: ^cmake|CMakeLists.txt
2223
- repo: local
2324
hooks:
2425
# The official reuse hook only supports calling lint, so we need our own hook

benchmark/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function(ginkgo_benchmark_onemkl_linops type def)
5050
endfunction()
5151

5252

53+
# gersemi: off
5354
# Generates an executable for one precision. Each executable will be linked to
5455
# `ginkgo`, `gflags` and `nlohmann-json`.
5556
# Note: This should only be used by `ginkgo_add_typed_benchmark_executables`
@@ -60,6 +61,7 @@ endfunction()
6061
# \param macro_def preprocessor macro name that will be defined during
6162
# building (to compile for a specific type)
6263
# All remaining arguments will be treated as source files
64+
# gersemi: on
6365
function(ginkgo_add_single_benchmark_executable name use_lib_linops macro_def type)
6466
add_executable("${name}" ${ARGN})
6567
target_link_libraries("${name}" ginkgo gflags nlohmann_json::nlohmann_json)
@@ -99,13 +101,15 @@ function(ginkgo_add_single_benchmark_executable name use_lib_linops macro_def ty
99101
endfunction(ginkgo_add_single_benchmark_executable)
100102

101103

104+
# gersemi: off
102105
# Generates an executable for each supported precision. Each executable will be
103106
# linked to `ginkgo`, `gflags` and `nlohmann-json`.
104107
#
105108
# \param name base-name for the executable to create
106109
# \param use_lib_linops Boolean indicating if linking against hipsparse/cusparse
107110
# is necessary
108111
# All remaining arguments will be treated as source files
112+
# gersemi: on
109113
function(ginkgo_add_typed_benchmark_executables name use_lib_linops)
110114
ginkgo_add_single_benchmark_executable(
111115
"${name}" "${use_lib_linops}" "GKO_BENCHMARK_USE_DOUBLE_PRECISION" "d" ${ARGN})

cmake/create_test.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function(ginkgo_add_resource_requirement test_name)
7676
RESOURCE_GROUPS "${add_rr_MPI_SIZE},${single_resource}")
7777
endfunction()
7878

79-
79+
# gersemi: off
8080
## Adds a test to the list executed by ctest and sets its output binary name
8181
## Possible additional arguments:
8282
## - `MPI_SIZE size` causes the tests to be run with `size` MPI processes.
@@ -86,6 +86,7 @@ endfunction()
8686
## - `DISABLE_EXECUTORS exec1 exec2` disables the test for certain backends (if built for multiple)
8787
## - `ADDITIONAL_LIBRARIES lib1 lib2` adds additional target link dependencies
8888
## - `ADDITIONAL_INCLUDES path1 path2` adds additional target include paths
89+
# gersemi: on
8990
function(ginkgo_add_test test_name test_target_name)
9091
cmake_parse_arguments(PARSE_ARGV 2 add_test "" "${gko_test_single_args}" "${gko_test_multi_args}")
9192
file(RELATIVE_PATH REL_BINARY_DIR ${PROJECT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)