Skip to content

Commit 0e916f5

Browse files
committed
Fix open/close port and flooding messages bugs, add cmake support
1 parent 46c2414 commit 0e916f5

28 files changed

+506
-6
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Ignore Qt-Project user files
22
*.user
3+
4+
#ignore vscode
5+
.vscode/
6+
37
tests/
8+
49
TODO

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 3.5) # 2.2 - case insensitive syntax
2+
3+
project(ModbusTools VERSION 0.2.1 LANGUAGES CXX)
4+
5+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
6+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
7+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
8+
9+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug")
10+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Debug")
11+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug")
12+
13+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release")
14+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Release")
15+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Release")
16+
17+
if (NOT WIN32)
18+
#set(CMAKE_SKIP_BUILD_RPATH FALSE)
19+
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
20+
set(CMAKE_INSTALL_RPATH $ORIGIN)
21+
#set(CMAKE_INSTALL_RPATH "\${ORIGIN}")
22+
endif()
23+
24+
add_subdirectory(src)

bin/Ubuntu/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
The ModbusTools project requires Qt version 5.8 or later.
44

5+
## Build using qmake
56

67
1. Update package list:
78
```console
@@ -86,3 +87,40 @@ The ModbusTools project requires Qt version 5.8 or later.
8687
-rwxr-xr-x 1 march march 993376 May 6 18:44 libcore.so.0.1.4
8788
-rwxr-xr-x 1 march march 907872 May 6 18:47 server
8889
```
90+
## Build using cmake
91+
92+
1. Build Tools
93+
94+
Previously you need to install c++ compiler kit, git and cmake itself (qt tools if needed).
95+
Then set PATH env variable to find compliler, cmake, git etc.
96+
97+
2. Create project directory, move to it and clone repository:
98+
```console
99+
$ cd ~
100+
$ mkdir src
101+
$ cd src
102+
$ git clone --recursive https://github.com/serhmarch/ModbusTools.git
103+
```
104+
3. Create and/or move to directory for build output, e.g. `~/bin/ModbusTools`:
105+
```console
106+
$ cd ~
107+
$ mkdir -p bin/ModbusTools
108+
$ cd bin/ModbusTools
109+
```
110+
4. Run cmake to generate project (make) files.
111+
```console
112+
$ cmake -S ~/src/ModbusTools -B .
113+
```
114+
To make Qt-compatibility (switch off by default for cmake build) you can use next command (e.g. for Windows 64):
115+
```console
116+
>cmake -DCMAKE_PREFIX_PATH:PATH=C:/Qt/5.15.2/msvc2019_64 -S <path\to\src\ModbusTools> -B .
117+
```
118+
5. Make binaries (+ debug|release config):
119+
```console
120+
$ cmake --build .
121+
$ cmake --build . --config Debug
122+
$ cmake --build . --config Release
123+
```
124+
125+
6. Resulting bin files is located in `./bin` directory.
126+

bin/Ubuntu/x64/client

-16 Bytes
Binary file not shown.

bin/Ubuntu/x64/libcore.so

96 Bytes
Binary file not shown.

bin/Ubuntu/x64/libcore.so.0

96 Bytes
Binary file not shown.

bin/Ubuntu/x64/libcore.so.0.2

96 Bytes
Binary file not shown.

bin/Ubuntu/x64/libcore.so.0.2.0

96 Bytes
Binary file not shown.

bin/Ubuntu/x64/libmodbus.so

21.2 KB
Binary file not shown.

bin/Ubuntu/x64/libmodbus.so.1

21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)