Skip to content

Commit 6aafa07

Browse files
authored
Merge pull request #2 from ModbusScope/merge_changes
Update tooling
2 parents 0511dd1 + 94aaadb commit 6aafa07

File tree

11 files changed

+212
-39
lines changed

11 files changed

+212
-39
lines changed

.clang-format

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Mozilla
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignConsecutiveMacros: true
9+
AlignEscapedNewlines: Right
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowAllParametersOfDeclarationOnNextLine: true
13+
AllowShortBlocksOnASingleLine: false
14+
AllowShortCaseLabelsOnASingleLine: false
15+
AllowShortFunctionsOnASingleLine: None
16+
AllowShortIfStatementsOnASingleLine: false
17+
AllowShortLoopsOnASingleLine: false
18+
AlwaysBreakAfterDefinitionReturnType: None
19+
AlwaysBreakAfterReturnType: None
20+
AlwaysBreakBeforeMultilineStrings: false
21+
AlwaysBreakTemplateDeclarations: true
22+
BinPackArguments: true
23+
BinPackParameters: false
24+
BraceWrapping:
25+
AfterCaseLabel: true
26+
AfterClass: true
27+
AfterControlStatement: true
28+
AfterEnum: true
29+
AfterFunction: true
30+
AfterNamespace: false
31+
AfterObjCDeclaration: false
32+
AfterStruct: true
33+
AfterUnion: true
34+
AfterExternBlock: false
35+
BeforeCatch: true
36+
BeforeElse: true
37+
IndentBraces: false
38+
SplitEmptyFunction: true
39+
SplitEmptyRecord: true
40+
SplitEmptyNamespace: true
41+
BreakBeforeBinaryOperators: None
42+
BreakBeforeBraces: Custom
43+
BreakBeforeInheritanceComma: false
44+
BreakBeforeTernaryOperators: true
45+
BreakConstructorInitializersBeforeComma: false
46+
BreakConstructorInitializers: BeforeColon
47+
BreakAfterJavaFieldAnnotations: false
48+
BreakStringLiterals: true
49+
ColumnLimit: 120
50+
CommentPragmas: '^ IWYU pragma:'
51+
CompactNamespaces: true
52+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
53+
ConstructorInitializerIndentWidth: 4
54+
ContinuationIndentWidth: 2
55+
Cpp11BracedListStyle: false
56+
DerivePointerAlignment: false
57+
DisableFormat: false
58+
ExperimentalAutoDetectBinPacking: false
59+
FixNamespaceComments: true
60+
ForEachMacros:
61+
- foreach
62+
- Q_FOREACH
63+
- BOOST_FOREACH
64+
- TEST_GROUP
65+
- TEST_GROUP_BASE
66+
- TEST_BASE
67+
IncludeBlocks: Preserve
68+
IncludeCategories:
69+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
70+
Priority: 2
71+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
72+
Priority: 3
73+
- Regex: '.*'
74+
Priority: 1
75+
IncludeIsMainRegex: '(Test)?$'
76+
IndentCaseLabels: false
77+
IndentPPDirectives: None
78+
IndentWidth: 4
79+
IndentWrappedFunctionNames: false
80+
JavaScriptQuotes: Leave
81+
JavaScriptWrapImports: true
82+
KeepEmptyLinesAtTheStartOfBlocks: true
83+
MacroBlockBegin: ''
84+
MacroBlockEnd: ''
85+
MaxEmptyLinesToKeep: 1
86+
NamespaceIndentation: None
87+
ObjCBlockIndentWidth: 2
88+
ObjCSpaceAfterProperty: true
89+
ObjCSpaceBeforeProtocolList: false
90+
PenaltyBreakAssignment: 2
91+
PenaltyBreakBeforeFirstCallParameter: 19
92+
PenaltyBreakComment: 300
93+
PenaltyBreakFirstLessLess: 120
94+
PenaltyBreakString: 1000
95+
PenaltyExcessCharacter: 1000000
96+
PenaltyReturnTypeOnItsOwnLine: 200
97+
PointerAlignment: Left
98+
RawStringFormats:
99+
- Delimiters: ['pb', 'proto']
100+
Language: TextProto
101+
BasedOnStyle: google
102+
ReflowComments: true
103+
SortIncludes: true
104+
SortUsingDeclarations: true
105+
SpaceAfterCStyleCast: true
106+
SpaceAfterTemplateKeyword: false
107+
SpaceBeforeAssignmentOperators: true
108+
SpaceBeforeParens: ControlStatements
109+
SpaceInEmptyParentheses: false
110+
SpacesBeforeTrailingComments: 1
111+
SpacesInAngles: Leave
112+
SpacesInContainerLiterals: false
113+
SpacesInCStyleCastParentheses: false
114+
SpacesInParentheses: false
115+
SpacesInSquareBrackets: false
116+
Standard: c++20
117+
TabWidth: 4
118+
TypenameMacros: ['TEST']
119+
UseTab: Never
120+
...
121+

.coderabbit.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2+
language: "en-GB"
3+
early_access: false
4+
reviews:
5+
profile: "chill"
6+
request_changes_workflow: false
7+
high_level_summary: true
8+
poem: false
9+
review_status: true
10+
collapse_walkthrough: false
11+
changed_files_summary: false
12+
estimate_code_review_effort: false
13+
auto_review:
14+
enabled: true
15+
drafts: false
16+
chat:
17+
auto_reply: true

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
skip = ./libraries,./tests/googletest,./resources,./icons

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
allow:
8+
- dependency-type: "all"
9+
ignore:
10+
- dependency-name: "*"
11+
update-types: ["version-update:semver-patch"]

.github/workflows/ccpp.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,36 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
container:
11-
image: docker://jgeudens/qt-linux:6.4.1_build_1
11+
image: docker://jgeudens/qt-linux:6.8.3_build_1
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v6.0.0
1414

15+
- name: Configure safe directory for git
16+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
17+
1518
- name: Update Modules and Build
1619
run: bash scripts/build_linux.sh
1720

1821
- name: Deploy
1922
run: bash scripts/deploy_linux.sh
2023

21-
- uses: actions/upload-artifact@v3
24+
- uses: actions/upload-artifact@v5.0.0
2225
with:
2326
name: modbussim-linux
2427
path: ModbusSim*.AppImage
2528

2629
windows:
27-
runs-on: windows-2019
30+
runs-on: windows-2022
2831

2932
steps:
30-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v6.0.0
3134

3235
- name: Install Qt installer
33-
run: pip3 install aqtinstall
36+
run: pip3 install aqtinstall==3.3.0
3437

3538
# Cache go build cache, used to speedup go test
3639
- name: Qt Build Cache
37-
uses: actions/cache@v3
40+
uses: actions/cache@v5.0.0
3841
id: cache
3942
with:
4043
path: ${{ github.workspace }}\Qt
@@ -44,8 +47,8 @@ jobs:
4447
shell: cmd
4548
run: scripts\full_build_and_deploy_windows.bat '${{ steps.cache.outputs.cache-hit }}' ${{ github.workspace }}\Qt
4649

47-
- uses: actions/upload-artifact@v3
50+
- uses: actions/upload-artifact@v5.0.0
4851
with:
49-
name: modbussim-windows
52+
name: modbusscope-windows
5053
path: |
51-
release\bin\win\ModbusSim.zip
54+
ModbusSim.zip

.gitignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*.so.*
1313
*.dll
1414
*.dylib
15+
.cache
1516

1617
# Qt-es
1718
object_script.*.Release
@@ -30,8 +31,6 @@ qrc_*.cpp
3031
ui_*.h
3132
*.qmlc
3233
*.jsc
33-
Makefile*
34-
*build-*
3534
*.qm
3635
*.prl
3736

@@ -54,4 +53,13 @@ compile_commands.json
5453
# QtCreator local machine specific files for imported projects
5554
*creator.user*
5655

57-
src/util/version.h
56+
# docs
57+
_build
58+
build/
59+
venv
60+
*docs/doxygen/html
61+
*docs/doxygen/doxygen.log
62+
63+
.vscode/
64+
65+
coverage/

CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ project(modbussim
88

99
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1010

11-
set(CMAKE_CXX_STANDARD 11)
11+
set(CMAKE_CXX_STANDARD 20)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13+
set(CMAKE_CXX_EXTENSIONS OFF)
1314

14-
set(CMAKE_AUTOUIC ON)
15-
set(CMAKE_AUTOMOC ON)
1615
set(CMAKE_AUTORCC ON)
1716

1817
# Find the QtCore library
19-
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
18+
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
2019
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
2120

2221
message(STATUS "Using Qt${QT_VERSION_MAJOR} version ${Qt${QT_VERSION_MAJOR}Core_VERSION}")
@@ -30,6 +29,8 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS
3029
REQUIRED
3130
)
3231

32+
qt_standard_project_setup()
33+
3334
set(QT_LIB
3435
Qt::Widgets
3536
Qt::Xml
@@ -42,6 +43,13 @@ include_directories(
4243
${CMAKE_CURRENT_SOURCE_DIR}/testslave
4344
)
4445

46+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
47+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
48+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
49+
if (MINGW)
50+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
51+
endif()
52+
4553
SET(APP_SRCS
4654
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
4755
${CMAKE_CURRENT_SOURCE_DIR}/src/mainwindow.cpp
@@ -91,3 +99,4 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
9199
elseif(WIN32)
92100
# not required
93101
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
102+

scripts/deploy_windows.bat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ cd ..
2121
7z a ModbusSim.zip ".\%DEPLOY_DIR%\*"
2222
IF ERRORLEVEL 1 GOTO errorHandling
2323

24+
cd ..\..\..
25+
move release\bin\win\ModbusSim.zip ModbusSim.zip
26+
2427
EXIT
2528

2629
:errorHandling
27-
EXIT /B 1
30+
EXIT /B 1

scripts/setup_windows.bat

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo QT_INSTALL_DIR: %QT_INSTALL_DIR%
99
echo CACHE_HIT: %CACHE_HIT%
1010

1111
REM Set configuration
12-
set QT=6.4.1
12+
set QT=6.8.3
1313
set QT_MODULES=qtserialbus qtserialport
1414
set QT_HOST=windows
1515
set QT_TARGET=desktop
@@ -28,10 +28,11 @@ REM Install Qt
2828
aqt install-qt --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% %QT% %QT_ARCH% -m %QT_MODULES%
2929

3030
REM Install Tools
31-
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_mingw90 qt.tools.win64_mingw900
31+
REM Qt 6.8.x uses mingw 13.1.0 (GCC 13.1.0) (https://wiki.qt.io/MinGW)
32+
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_mingw1310
3233
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_cmake
3334
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_ninja
34-
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_openssl_x64
35+
aqt install-tool --outputdir %QT_INSTALL_DIR% %QT_HOST% %QT_TARGET% tools_opensslv3_x64
3536

3637
:cache_hit
3738

@@ -41,7 +42,7 @@ dir %QT_INSTALL_DIR%\Tools
4142

4243
REM Set env variables with path
4344
set "PATH=%QT_INSTALL_DIR%\%QT%\%QT_ARCH_PATH%\bin;%PATH%"
44-
set "PATH=%QT_INSTALL_DIR%\Tools\mingw1120_64\bin;%PATH%"
45+
set "PATH=%QT_INSTALL_DIR%\Tools\mingw1310_64\bin;%PATH%"
4546
set "PATH=%QT_INSTALL_DIR%\Tools\CMake_64\bin;%PATH%"
4647
set "PATH=%QT_INSTALL_DIR%\Tools\Ninja;%PATH%"
4748

@@ -50,4 +51,4 @@ set "QML_IMPORT_PATH=%QT_INSTALL_DIR%\%QT%\%QT_ARCH_PATH%\qml\"
5051
set "QML2_IMPORT_PATH=%QT_INSTALL_DIR%\%QT%\%QT_ARCH_PATH%\qml\"
5152
set "CMAKE_PREFIX_PATH=%QT_INSTALL_DIR%\%QT%\%QT_ARCH_PATH%\lib\cmake\Qt6"
5253

53-
set "OPENSSL_DIR=%QT_INSTALL_DIR%\Tools\OpenSSL\Win_x64\bin"
54+
set "OPENSSL_DIR=%QT_INSTALL_DIR%\Tools\OpenSSLv3\Win_x64\bin"

src/mainwindow.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,30 @@ MainWindow::MainWindow(QWidget *parent) :
3737
_exceptionGroup.addButton(_pUi->chkGatewayPathUnavailable, QModbusPdu::GatewayPathUnavailable);
3838

3939
connect(&_exceptionGroup, QOverload<int, bool>::of(&QButtonGroup::idToggled), this,
40-
[=](int id, bool checked){
41-
if (checked)
42-
{
43-
_pSlaveModbus->setException(static_cast<QModbusPdu::ExceptionCode>(id));
44-
}
45-
});
40+
[=, this](int id, bool checked) {
41+
if (checked)
42+
{
43+
_pSlaveModbus->setException(static_cast<QModbusPdu::ExceptionCode>(id));
44+
}
45+
});
4646

4747
/** Handle error recurrence group **/
4848
_bErrorOnce = true;
4949
_errorRecurrenceGroup.addButton(_pUi->optErrorOnce, true);
5050
_errorRecurrenceGroup.addButton(_pUi->optErrorPersistent, false);
5151

5252
connect(&_errorRecurrenceGroup, QOverload<int>::of(&QButtonGroup::idClicked), this,
53-
[=](int id){
54-
_bErrorOnce = static_cast<bool>(id);
55-
});
53+
[=, this](int id) { _bErrorOnce = static_cast<bool>(id); });
5654

5755
connect(_pSlaveModbus, &TestSlaveModbus::requestProcessed, this, &MainWindow::handleRequestProcessed);
5856

5957
/** Auto increment **/
6058
_bAutoInc = false;
61-
connect(_pUi->checkAutoIncrement, &QCheckBox::stateChanged, this,
62-
[=](int state){
63-
_bAutoInc = (state == Qt::Checked);
64-
_pIncGraph->setState(_bAutoInc);
65-
});
59+
60+
connect(_pUi->checkAutoIncrement, &QCheckBox::checkStateChanged, this, [this](Qt::CheckState state) {
61+
_bAutoInc = state;
62+
_pIncGraph->setState(_bAutoInc);
63+
});
6664

6765
/** Setup registerView **/
6866
_pUi->tblRegData->setModel(_pRegisterDataModel);

0 commit comments

Comments
 (0)