Skip to content

Commit 9bb2512

Browse files
[cmake] format verification support (#102)
1 parent 4b671c4 commit 9bb2512

File tree

3 files changed

+75
-98
lines changed

3 files changed

+75
-98
lines changed

.github/workflows/verify_code_style_format.yml

-20
This file was deleted.

.github/workflows/verify_style.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Test Style"
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3.0.2
15+
- name: Install
16+
run: |
17+
sudo apt install clang-format-14
18+
pip install cmakelang
19+
- name: Verify
20+
run: |
21+
find . -iname *.hpp -o -iname *.cpp -o -iname *.tpp -o -iname support/** | xargs clang-format-14 --Werror --dry-run --verbose -style=file
22+
cmake-format --check CMakeLists.txt

CMakeLists.txt

+53-78
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,53 @@
1-
cmake_minimum_required(
2-
VERSION "3.24"
3-
)
4-
5-
project(kalman
6-
VERSION "0.1.0"
7-
DESCRIPTION "Kalman Filter for C++"
8-
LANGUAGES "CXX"
9-
)
10-
11-
include(CTest)
12-
include(FetchContent)
13-
14-
install(
15-
DIRECTORY "include/fcarouge"
16-
DESTINATION "include"
17-
)
18-
19-
FetchContent_Declare(
20-
eigen
21-
GIT_REPOSITORY "https://gitlab.com/libeigen/eigen.git"
22-
GIT_TAG "3147391d946bb4b6c68edd901f2add6ac1f31f8c" # 3.4.0
23-
)
24-
25-
FetchContent_Declare(
26-
fmt
27-
GIT_REPOSITORY "https://github.com/fmtlib/fmt.git"
28-
GIT_TAG "c4ee726532178e556d923372f29163bd206d7732" # 9.0.0
29-
)
30-
31-
FetchContent_MakeAvailable(
32-
eigen
33-
fmt
34-
)
35-
36-
add_library(kalman
37-
INTERFACE
38-
)
39-
40-
add_library(main
41-
source/main.cpp
42-
)
43-
44-
target_include_directories(kalman
45-
INTERFACE
46-
"include"
47-
"support/include/fcarouge"
48-
)
49-
50-
add_executable(kalman_test_driver
51-
test/eigen/f.cpp
52-
test/eigen/h.cpp
53-
test/eigen/initialization.cpp
54-
test/f.cpp
55-
test/format.cpp
56-
test/h.cpp
57-
test/initialization.cpp
58-
)
59-
60-
target_link_libraries(kalman_test_driver
61-
PRIVATE
62-
eigen
63-
fmt
64-
kalman
65-
main
66-
)
67-
68-
set_target_properties(kalman_test_driver
69-
PROPERTIES
70-
CXX_STANDARD 23
71-
CXX_STANDARD_REQUIRED ON
72-
CXX_EXTENSIONS OFF
73-
)
74-
75-
add_test(
76-
NAME kalman_test
77-
COMMAND kalman_test_driver
78-
)
1+
cmake_minimum_required(VERSION "3.24")
2+
3+
project(
4+
kalman
5+
VERSION "0.1.0"
6+
DESCRIPTION "Kalman Filter for C++"
7+
LANGUAGES "CXX")
8+
9+
include(CTest)
10+
include(FetchContent)
11+
12+
install(DIRECTORY "include/fcarouge" DESTINATION "include")
13+
14+
FetchContent_Declare(
15+
eigen
16+
GIT_REPOSITORY "https://gitlab.com/libeigen/eigen.git"
17+
GIT_TAG "3147391d946bb4b6c68edd901f2add6ac1f31f8c" # 3.4.0
18+
)
19+
20+
FetchContent_Declare(
21+
fmt
22+
GIT_REPOSITORY "https://github.com/fmtlib/fmt.git"
23+
GIT_TAG "c4ee726532178e556d923372f29163bd206d7732" # 9.0.0
24+
)
25+
26+
FetchContent_MakeAvailable(eigen fmt)
27+
28+
add_library(kalman INTERFACE)
29+
30+
add_library(main source/main.cpp)
31+
32+
target_include_directories(kalman INTERFACE "include"
33+
"support/include/fcarouge")
34+
35+
add_executable(
36+
kalman_test_driver
37+
test/eigen/f.cpp
38+
test/eigen/h.cpp
39+
test/eigen/initialization.cpp
40+
test/f.cpp
41+
test/format.cpp
42+
test/h.cpp
43+
test/initialization.cpp)
44+
45+
target_link_libraries(kalman_test_driver PRIVATE eigen fmt kalman main)
46+
47+
set_target_properties(
48+
kalman_test_driver
49+
PROPERTIES CXX_STANDARD 23
50+
CXX_STANDARD_REQUIRED ON
51+
CXX_EXTENSIONS OFF)
52+
53+
add_test(NAME kalman_test COMMAND kalman_test_driver)

0 commit comments

Comments
 (0)