Conversation
There was a problem hiding this comment.
Pull request overview
This PR reorganizes header file imports to minimize dependencies and optimizes compilation parameters for faster debug builds. The changes replace monolithic includes (e.g., opencv2/opencv.hpp) with specific module includes and remove unused headers throughout the codebase.
Key changes:
- Split
opencv2/opencv.hppinto specific module includes (imgcodecs.hpp,imgproc.hpp,videoio.hpp,core.hpp) across multiple files - Added debug-specific compilation flags (
-Og) and precompiled headers for spdlog to speed up debug builds - Removed unused header includes across the codebase (QCoreApplication, QFileInfo, convert.h, vector, QTextEdit, etc.)
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Added compile commands export, corrected version script comment path, configured debug optimization flags, added precompiled headers for debug builds, and removed VERSION_CPP from glob to prevent conflicts |
| src/mqtt/mqtt_client.cpp | Added blank line after header include for consistency |
| src/mqtt/MQTTMessageWidget.cpp | Repositioned blank line after header include |
| src/main.cpp | Removed unused convert.h include |
| src/logging.h | Removed unused QCoreApplication include |
| src/convert.h | Removed unused vector include, split opencv2/opencv.hpp into specific imgcodecs and imgproc includes |
| src/components/message_dialog.cpp | Removed QVBoxLayout include (incorrectly - still used in code), added blank line |
| src/components/UiConfig.cpp | Removed unused QFileInfo include, added blank line |
| src/about_dialog.cpp | Removed unused QApplication include, added blank line |
| src/FrameWidget.cpp | Added blank lines for better code organization |
| src/CameraWidget.h | Removed unused QTextEdit include, replaced opencv2/opencv.hpp with specific videoio.hpp |
| src/CameraWidget.cpp | Removed multiple unused Qt includes, added specific opencv2 includes (imgcodecs, imgproc) |
| src/BarcodeWidget.h | Reordered includes to group by type (project headers, then system headers) |
| src/BarcodeWidget.cpp | Replaced opencv2/opencv.hpp with specific includes (core, imgcodecs, imgproc), added blank lines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if(NOT MSVC) | ||
| set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og") | ||
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og") | ||
| set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -O0 -Wl,-O0") |
There was a problem hiding this comment.
The linker flags include -O0 -Wl,-O0 which disables optimization for linking. While this may speed up link time, it's unusual to optimize the C/CXX compilation with -Og while disabling linker optimization completely. Consider using -Wl,-O1 instead of -Wl,-O0 to maintain some link-time optimization benefits while still improving debug build times.
| set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -O0 -Wl,-O0") | |
| set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -O0 -Wl,-O1") |
|
难绷微软服务爆炸导致ci失败 |
112f843 to
8c765ab
Compare
|
或许你应该说明一下这是根据什么定义的include顺序,也让后面的人一直按照它。 |
|
include顺序由clang-format配置文件定义,我建议也在项目头文件和依赖头文件间添加一个空行。 |
|
在 docs 写个文档介绍一下一些基本的吧 |
No description provided.