22
33This page describes the process of building a ModbusTools project from source files.
44
5- ## Building ModbusTools from source on Windows
6-
7- ### Preparation
8-
9- The ModbusTools project requires Qt version 5.8 or later.
10-
11- 1 . Download qt-online-installer, follow the link and choose Windows version for installer:
12-
13- https://www.qt.io/download-qt-installer
14-
15- 2 . Run qt-online-installer and install all necessary components: Qt 5 (Qt5.15.2) framework.
16-
17- Qt 5.8 or higher is needed so in ` Select Components ` window check ` Archive ` checkbox and push ` Filter ` button.
18- Then is better to check latest version of Qt5.15 framework (e.g. 5.15.2)
19-
20- 3 . Download and install git for Windows or use WSL and install git for WSL.
21-
22- 4 . Make dir for binaries, e.g. in ` <user-home-dir>\bin\ModbusTools ` using Windows command console:
23- ``` console
24- >cd `<user-home-dir>`
25- >mkdir bin\ModbusTools
26- >cd bin\ModbusTools
27- ```
28- 5 . Clone repository:
29- ``` console
30- $ git clone --recursive https://github.com/serhmarch/ModbusTools.git
31- ```
32-
33- ### Build using qmake
34-
35- This example shows how to build ` ModbusTools ` for MSVC compiler using ` qmake ` .
36-
37- 1 . Open Windows command console and initialize all MSVC compiler vars (e.g. include, lib) using ` vcvarsall.bat ` script.
38- This script will be configured for x64 arch (use ` ...\vcvarsall.bat -help ` to display all options):
39- `console
40-
41- > "c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
42- > `
43-
44- 2 . Run qmake to produce ` Makefile ` .
45- This command will make ` Release ` version, for ` Debug ` replase with ` "CONFIG+=debug" ` :
46- `console
47-
48- > C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe path\to\ModbusTools.pro -spec win32-msvc "CONFIG+=release"
49- > `
50-
51- 3 . Produce all make files:
52-
53- ``` console
54- >C:\Qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile qmake_all
55- ```
56-
57- 4 . Build project from Makefile's:
58- ``` console
59- >C:\Qt\Tools\QtCreator\bin\jom\jom.exe
60- ```
61-
62- ### Build using cmake
63-
64- 1 . Run cmake to generate project (make) files.
65- ` CMAKE_PREFIX_PATH ` must be set to installed Qt framewrok files:
66- `console
67- > cmake -DCMAKE_PREFIX_PATH: PATH =C:/Qt/5.15.2/msvc2019_64 -S path\to\ModbusTools -B .
68- > `
69- 2 . Make binaries (+ debug|release config):
70- ``` console
71- $ cmake --build .
72- $ cmake --build . --config Debug
73- $ cmake --build . --config Release
74- ```
75- 3. Resulting bin files is located in `Debug` or `Release` directory.
76-
77- #### Build using CMakePresets.json
78-
79- ```console
80- cmake --preset "Win64-MSVC"
81- cmake --build --preset "Win64-MSVC-Debug"
82- cmake --build --preset "Win64-MSVC-Release"
83- ```
84-
855## Building ModbusTools from source on Linux
866
87- ### Preparation
7+ ### Preparations
888
899The ModbusTools project requires Qt version 5.8 or later.
9010
@@ -147,6 +67,46 @@ The ModbusTools project requires Qt version 5.8 or later.
14767 $ cd bin/ModbusTools
14868 ```
14969
70+ ### Build using cmake
71+
72+ 1. Run cmake to generate project (make) files.
73+
74+ ```console
75+ $ cmake -S ~/src/ModbusTools -B .
76+ ```
77+
78+ 2. Make binaries (+ debug|release config):
79+ ```console
80+ $ cmake --build .
81+ $ cmake --build . --config Debug
82+ $ cmake --build . --config Release
83+ ```
84+ 3. Resulting bin files is located in `./bin` directory.
85+
86+ #### Build using CMakePresets.json
87+
88+ ```console
89+ cmake --preset "Linux-Debug"
90+ cmake --build --preset "Linux-Debug"
91+
92+ cmake --preset "Linux-Release"
93+ cmake --build --preset "Linux-Release"
94+ ```
95+
96+ ### Install using cmake
97+
98+ To install compiled binaries and other necessary files run next command:
99+
100+ ``` console
101+ $ cmake --install < build_dir> --prefix < install_dest_dir>
102+ ```
103+
104+ Next command installs files from build dir into ModbusTools dir of user's home directory:
105+
106+ ``` console
107+ $ cmake --install . --prefix " $HOME /ModbusTools"
108+ ```
109+
150110### Build using qmake
151111
1521121 . Run qmake to create Makefile for build:
@@ -189,30 +149,98 @@ The ModbusTools project requires Qt version 5.8 or later.
189149 -rwxr-xr-x 1 march march 269888 Sep 27 16:24 libmodbus.so.1.0.0
190150 ```
191151
192- ### Build using cmake
152+ ## Building ModbusTools from source on Windows
193153
194- 1. Run cmake to generate project (make) files.
154+ ### Preparation
195155
196- ```console
197- $ cmake -S ~/src/ModbusTools -B .
198- ```
156+ The ModbusTools project requires Qt version 5.8 or later.
157+
158+ 1. Download qt-online-installer, follow the link and choose Windows version for installer:
159+
160+ https://www.qt.io/download-qt-installer
161+
162+ 2. Run qt-online-installer and install all necessary components: Qt 5 (Qt5.15.2) framework.
163+
164+ Qt 5.8 or higher is needed so in `Select Components` window check `Archive` checkbox and push `Filter` button.
165+ Then is better to check latest version of Qt5.15 framework (e.g. 5.15.2)
166+
167+ 3. Download and install git for Windows or use WSL and install git for WSL.
168+
169+ 4. Make dir for binaries, e.g. in `<user-home-dir>\bin\ModbusTools` using Windows command console:
170+ ```console
171+ >cd `<user-home-dir>`
172+ >mkdir bin\ModbusTools
173+ >cd bin\ModbusTools
174+ ```
175+ 5 . Clone repository:
176+ ``` console
177+ $ git clone --recursive https://github.com/serhmarch/ModbusTools.git
178+ ```
179+
180+ ### Build using qmake
181+
182+ This example shows how to build ` ModbusTools ` for MSVC compiler using ` qmake ` .
199183
184+ 1 . Open Windows command console and initialize all MSVC compiler vars (e.g. include, lib) using ` vcvarsall.bat ` script.
185+ This script will be configured for x64 arch (use ` ...\vcvarsall.bat -help ` to display all options):
186+ `console
187+
188+ > "c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
189+ > `
190+
191+ 2 . Run qmake to produce ` Makefile ` .
192+ This command will make ` Release ` version, for ` Debug ` replase with ` "CONFIG+=debug" ` :
193+ `console
194+
195+ > C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe path\to\ModbusTools.pro -spec win32-msvc "CONFIG+=release"
196+ > `
197+
198+ 3 . Produce all make files:
199+
200+ ``` console
201+ >C:\Qt\Tools\QtCreator\bin\jom\jom.exe -f Makefile qmake_all
202+ ```
203+
204+ 4 . Build project from Makefile's:
205+ ``` console
206+ >C:\Qt\Tools\QtCreator\bin\jom\jom.exe
207+ ```
208+
209+ ### Build using cmake
210+
211+ 1 . Run cmake to generate project (make) files.
212+ ` CMAKE_PREFIX_PATH ` must be set to installed Qt framewrok files:
213+ `console
214+ > cmake -DCMAKE_PREFIX_PATH: PATH =C:/Qt/5.15.2/msvc2019_64 -S path\to\ModbusTools -B .
215+ > `
2002162 . Make binaries (+ debug|release config):
201217 ``` console
202218 $ cmake --build .
203219 $ cmake --build . --config Debug
204220 $ cmake --build . --config Release
205221 ```
206- 3. Resulting bin files is located in `./bin ` directory.
222+ 3. Resulting bin files is located in `Debug` or `Release ` directory.
207223
208224#### Build using CMakePresets.json
209225
210226```console
211- cmake --preset "Linux-Debug"
212- cmake --build --preset "Linux-Debug"
227+ cmake --preset "Win64-MSVC"
228+ cmake --build --preset "Win64-MSVC-Debug"
229+ cmake --build --preset "Win64-MSVC-Release"
230+ ```
213231
214- cmake --preset "Linux-Release"
215- cmake --build --preset "Linux-Release"
232+ ### Install using cmake
233+
234+ To install compiled binaries and other necessary files run next command:
235+
236+ ``` console
237+ > cmake --install < build_dir> --prefix < install_dest_dir>
238+ ```
239+
240+ Next command installs files from build dir into ModbusTools dir of user's home directory:
241+
242+ ``` console
243+ > cmake --install . --prefix " %USERPROFILE%\ModbusTools"
216244```
217245
218246## Build Docker Image
@@ -232,6 +260,23 @@ The GUIs will be exposed via a web server on port 6080.
232260 ```
2332613 . Access the application at ` http://localhost:6080/vnc.html `
234262
263+ # Install ModbusTools
264+
265+ General view of ModbusTools applications dir:
266+ * modbus.dll
267+ * core.dll
268+ * server.exe
269+ * client.exe
270+ * script : [ dir]
271+ * server : [ dir]
272+ * mbserver.py
273+ * help : [ dir]
274+ * ModbusClient.qch
275+ * ModbusClient.qhc
276+ * ModbusServer.qch
277+ * ModbusServer.qhc
278+
279+ ## Install using cmake
235280
236281## Arch Linux Install
237282
0 commit comments