File tree Expand file tree Collapse file tree
static_analysis/clang-tidy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6767 env :
6868 CC : ${{ matrix.config.cc }}
6969 CXX : ${{ matrix.config.cxx }}
70- run : |
71- mkdir -p build
72- cd build
73- cmake -DCMAKE_BUILD_TYPE=Release ..
74- - name : make
75- run : |
76- cd build
77- cmake --build . --config Release # `config Release` somehow necessary by windows
70+ run : cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
71+ - name : build
72+ run : cmake --build build --config Release # `config Release` somehow necessary by windows
7873
7974 - name : upload binaries
8075 uses : actions/upload-artifact@v2
Original file line number Diff line number Diff line change 1111 runs-on : ubuntu-22.04
1212
1313 steps :
14- - run : sudo apt install clang-format-15
15-
1614 - run : clang-format-15 --version
1715
1816 - name : checkout
Original file line number Diff line number Diff line change 1515 runs-on : ubuntu-22.04
1616
1717 steps :
18- - name : ubuntu install clang-tidy
19- run : |
20- sudo apt install clang-tidy-12
21- clang-tidy-12 --version
18+ - run : clang-tidy --version
2219
2320 - name : set up python 3.8
2421 uses : actions/setup-python@v2
3128 uses : actions/checkout@v2
3229
3330 - name : cmake
34- run : |
35- mkdir -p build
36- cd build
37- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
31+ run : cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DODR_CLANG_TIDY=ON
3832
3933 - name : clang-tidy
40- run : |
41- FILES=$( find . -path ./build -prune -false -o -type f \( -iname \*.cpp \) )
42- clang-tidy-12 -p build -header-filter '.*' $FILES
34+ run : cmake --build build
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66set (CMAKE_CXX_EXTENSIONS OFF )
77
88option (ODR_TEST "enable tests" ON )
9+ option (ODR_CLANG_TIDY "Run clang-tidy static analysis" OFF )
910
1011# TODO defining global compiler flags seems to be bad practice with conan
1112# TODO consider using conan profiles
@@ -163,15 +164,15 @@ add_library(odr
163164
164165 "src/odr/internal/zip/zip_util.cpp"
165166 "src/odr/internal/zip/zip_archive.cpp"
166- )
167+ )
167168set_target_properties (odr PROPERTIES OUTPUT_NAME odr)
168169if (EXISTS "${PROJECT_SOURCE_DIR } /.git" )
169170 add_dependencies (odr check_git )
170171endif ()
171172target_include_directories (odr
172173 PUBLIC
173174 src
174- )
175+ )
175176target_link_libraries (odr
176177 PRIVATE
177178 pugixml::pugixml
@@ -180,14 +181,18 @@ target_link_libraries(odr
180181 nlohmann_json::nlohmann_json
181182 vincentlaucsb-csv-parser::vincentlaucsb-csv-parser
182183 uchardet::uchardet
183- )
184+ )
184185
185186add_subdirectory ("cli" )
186187
187188if (ODR_TEST)
188189 add_subdirectory ("test" )
189190endif ()
190191
192+ if (ODR_CLANG_TIDY)
193+ add_subdirectory ("static_analysis/clang-tidy" )
194+ endif ()
195+
191196install (
192197 TARGETS
193198 odr
Original file line number Diff line number Diff line change 1+ find_program (CLANG_TIDY_COMMAND NAMES clang-tidy )
2+
3+ if (NOT CLANG_TIDY_COMMAND)
4+ message (ERROR "ACTS_RUN_CLANG_TIDY is ON but clang-tidy is not found!" )
5+ set (CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE )
6+ endif ()
7+
8+ message (STATUS "Setting up clang-tidy run" )
9+
10+ set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND} " )
You can’t perform that action at this time.
0 commit comments