Skip to content

Commit f1df0ec

Browse files
committed
DOC: Add documentation for installing Qt6
Add initial documentation for how to install Qt6 on Ubuntu 24.04. Update README with improved build instructions, CMake usage, platform-specific notes, and developer hints
1 parent bf0ff9e commit f1df0ec

1 file changed

Lines changed: 63 additions & 7 deletions

File tree

README.md

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,22 @@ need to build and run the generator when you want to build additional wrappers
3636
or you want to upgrade/downgrade to another Qt version, but this requires
3737
updating the typesystems as well.
3838

39-
# Building
39+
# Building
4040

41-
## General
41+
## Using qmake and manual steps
42+
43+
### General
4244

4345
Building PythonQt requires a couple of steps.
4446
Follow these instructions in order to get a correctly built PythonQt runtime and Qt bindings.
4547

46-
### Recommendations
48+
#### Recommendations
4749

4850
It is recommended to build the Qt bindings yourself instead of using the pregenerated ones.
4951
This ensures the bindings are compatible with your Qt version.
5052
Do not build `PythonQt.pro` directly because it will only use the pregenerated bindings!
5153

52-
### Environment
54+
#### Environment
5355

5456
First, you need to set a couple of environment variables, which depend on your Python and Qt installation.
5557

@@ -74,7 +76,7 @@ First, you need to set a couple of environment variables, which depend on your P
7476

7577
The absolute path to the root directory of your Qt installation.
7678

77-
### Binding Generator
79+
#### Binding Generator
7880

7981
1. cd into the `generator` directory
8082
2. Run qmake on `generator.pro`
@@ -93,7 +95,7 @@ First, you need to set a couple of environment variables, which depend on your P
9395

9496
`<generator-executable> qtscript_masterinclude.h build_all.txt`
9597

96-
### PythonQt Runtime
98+
#### PythonQt Runtime
9799

98100
Next, we need the PythonQt runtime.
99101

@@ -106,7 +108,7 @@ Next, we need the PythonQt runtime.
106108

107109
Use `nmake` for MSVC (Visual Studio; make sure to have the environment variables set for Visual Studio beforehand). Otherwise, use `make`.
108110

109-
### Extensions
111+
#### Extensions
110112

111113
As a last step, we need to build the extensions.
112114

@@ -121,6 +123,60 @@ As a last step, we need to build the extensions.
121123

122124
After all these steps, you should now have a fully working PythonQt runtime and Qt bindings for your Python/Qt installation 🎉.
123125

126+
127+
## The CMake Build System replaces the qmake manual proceedure defined above
128+
129+
Get the source code from the GitHub.
130+
```bash
131+
git clone git@github.com:MeVisLab/PythonQt.git
132+
cd PythonQt
133+
git checkout <desired_branch>
134+
```
135+
136+
Build the PythonQt runtime and Qt bindings using CMake.
137+
```bash
138+
cmake -S $(pwd) -B ../PythonQt-build -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release
139+
cmake --build ../PythonQt-build --config Release
140+
```
141+
142+
143+
# Platform Notes
124144
## MinGW
125145

126146
It is possible to build PythonQt with MinGW on Windows instead of using MSVC.
147+
148+
## Ubuntu 24.04 apt-get install QT6
149+
It is possible to build PythonQt on Ubuntu 24.04 using the `apt` package manager to install the required Qt6 packages.
150+
``` bash
151+
apt install qt6-base-dev qt6-tools-dev-tools libqt6* qt6-* qml6-module-qt*
152+
```
153+
154+
## arm64 based MacOS
155+
It is possible to build PythonQt on arm64 based MacOS systems.
156+
157+
Download and install qt6 from https://www.qt.io/download. Install the desired Qt6.
158+
159+
# Hints for developers
160+
161+
## Upgrading Qt Versions
162+
163+
### Use `clazy` for static analysis of Qt code
164+
```bash
165+
# NOTE: clazy uses the cmake output file generated when CMAKE_EXPORT_COMPILE_COMMANDS=ON
166+
export CLAZY_TEST="use-static-qregularexpression"
167+
168+
clazy-standalone -p ../PythonQt-build \
169+
--checks="${CLAZY_TEST}" \
170+
--only-qt \
171+
$(find . -name "*.cpp" |fgrep -v "/examples/") \
172+
2>&1 \
173+
| fgrep -v "pragma-messages" \
174+
| tee ../logger.${CLAZY_TEST}
175+
vim -q ../logger.${CLAZY_TEST}
176+
```
177+
178+
179+
# List clazy tests available
180+
```bash
181+
clazy-standalone -p ../PythonQt-build --only-qt generator/main.cpp --list-checks >> ../MIGRATE_QT5_to_QT6
182+
```

0 commit comments

Comments
 (0)