Skip to content

Commit 9c97565

Browse files
committed
испрваление и добавление пресета
1 parent fd642ed commit 9c97565

File tree

3 files changed

+16
-32
lines changed

3 files changed

+16
-32
lines changed

.github/workflows/static_analysis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ jobs:
2020
run: git submodule update --init --recursive
2121

2222
- name: Configure CMake
23-
run: cmake --preset Debug
23+
run: cmake --preset DebugAnalize
2424

2525
- name: Build
26-
run: cmake --build ./build/Debug
26+
run: cmake --build ./build/DebugAnalize
2727

2828
- name: Run clang-tidy and save report
2929
run: |
30-
mkdir -p build/Debug
30+
mkdir -p build/DebugAnalize
3131
find . -name "*.cpp" -o -name "*.cc" -o -name "*.cxx" | grep -v "^./build/" | \
32-
xargs --no-run-if-empty -n1 clang-tidy -p build/Debug 2>&1 | tee build/Debug/clang-tidy-report.txt || true
32+
xargs --no-run-if-empty -n1 clang-tidy -p build/DebugAnalize 2>&1 | tee build/DebugAnalize/clang-tidy-report.txt || true
3333
3434
- name: Run cppcheck and save XML report
3535
run: |
36-
if [ -f build/Debug/compile_commands.json ]; then
37-
mkdir -p build/Debug
38-
cppcheck --enable=warning,style,performance,portability,missingIncludeSystem --inconclusive --project=build/Debug/compile_commands.json --xml 2> build/Debug/cppcheck-report.xml || true
36+
if [ -f build/DebugAnalize/compile_commands.json ]; then
37+
mkdir -p build/DebugAnalize
38+
cppcheck --enable=warning,style,performance,portability,missingIncludeSystem --inconclusive --project=build/DebugAnalize/compile_commands.json --xml 2> build/DebugAnalize/cppcheck-report.xml || true
3939
else
4040
echo "compile_commands.json not found, skipping cppcheck"
4141
fi
@@ -44,4 +44,4 @@ jobs:
4444
uses: actions/upload-artifact@v4
4545
with:
4646
name: static-analysis-reports
47-
path: build/Debug/
47+
path: build/DebugAnalize/

CMakeLists.txt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,6 @@ message("Build type: " ${CMAKE_BUILD_TYPE})
3636
# Enable CMake support for ASM and C languages
3737
enable_language(C ASM)
3838

39-
# Enable C and C++ warnings and optimize for embedded builds
40-
if(NOT DEFINED CMAKE_C_FLAGS)
41-
set(CMAKE_C_FLAGS "")
42-
endif()
43-
if(NOT DEFINED CMAKE_CXX_FLAGS)
44-
set(CMAKE_CXX_FLAGS "")
45-
endif()
46-
47-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -ffunction-sections -fdata-sections")
48-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -ffunction-sections -fdata-sections")
49-
50-
# Release-size focused flags (optimize for size, enable LTO and garbage collect sections)
51-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -flto")
52-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -flto")
53-
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
54-
55-
# Prefer CMake's IPO support when available
56-
if(POLICY CMP0069)
57-
cmake_policy(SET CMP0069 NEW)
58-
endif()
59-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
60-
61-
# Option to enable static analysis helpers (clang-tidy / cppcheck)
62-
option(BUILD_STATIC_ANALYSIS "Enable static analysis targets (clang-tidy / cppcheck)" OFF)
6339

6440
if(BUILD_STATIC_ANALYSIS)
6541
find_program(CLANG_TIDY_EXE NAMES clang-tidy)

CMakePresets.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
"CMAKE_BUILD_TYPE": "Debug"
2727
}
2828
},
29+
{
30+
"name": "DebugAnalize",
31+
"inherits": "default",
32+
"cacheVariables": {
33+
"CMAKE_BUILD_TYPE": "Debug",
34+
"BUILD_STATIC_ANALYSIS": "ON"
35+
}
36+
},
2937
{
3038
"name": "Release",
3139
"inherits": "default",

0 commit comments

Comments
 (0)