Skip to content

Commit 671a16c

Browse files
committed
docs(README): require per-Qt wrapper generation; add output path & qmake toggles
- Drop claim that wrappers are pre-generated/checked-in. - Document default generator output (../generated_cpp) and override via PYTHONQT_GENERATED_PATH. - Describe qmake toggles (generator_only / exclude_generator) and switch build steps to top-level PythonQt.pro: first generate wrappers, then build runtime (and extensions) without rebuilding the generator.
1 parent 5b18910 commit 671a16c

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

README.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ see https://github.com/danmar/simplecpp. It is licensed under the `0BSDL` licens
3131
see the `LICENSE` file in the generator/simplecpp directory.
3232
Copyright (C) 2016-2023 simplecpp team
3333

34-
The generated wrappers are pre-generated and checked-in, so you only
35-
need to build and run the generator when you want to build additional wrappers
36-
or you want to upgrade/downgrade to another Qt version, but this requires
37-
updating the typesystems as well.
34+
Wrappers are **not** shipped pre-generated. You must run the generator to
35+
create wrappers for your Qt version. The repository may keep a
36+
single example tree (e.g., `generated_cpp_515`) only as a reference.
3837

3938
# Building
4039

@@ -43,12 +42,6 @@ updating the typesystems as well.
4342
Building PythonQt requires a couple of steps.
4443
Follow these instructions in order to get a correctly built PythonQt runtime and Qt bindings.
4544

46-
### Recommendations
47-
48-
It is recommended to build the Qt bindings yourself instead of using the pregenerated ones.
49-
This ensures the bindings are compatible with your Qt version.
50-
Do not build `PythonQt.pro` directly because it will only use the pregenerated bindings!
51-
5245
### Environment
5346

5447
First, you need to set a couple of environment variables, which depend on your Python and Qt installation.
@@ -76,49 +69,59 @@ First, you need to set a couple of environment variables, which depend on your P
7669

7770
### Binding Generator
7871

79-
1. cd into the `generator` directory
80-
2. Run qmake on `generator.pro`
72+
1. Configure the generator at the top level
8173

82-
`qmake CONFIG+=Release generator.pro`
74+
```bash
75+
qmake CONFIG+=generator_only CONFIG+=Release PythonQt.pro
76+
```
8377

84-
3. Make the generator
78+
2. Build the generator
8579

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

88-
4. Generate the bindings
82+
3. Generate the bindings
8983

90-
We use the generator executable from step 3 to generate the bindings.
84+
Use the generator executable from step 2 to generate the bindings.
9185
The location of the generator executable can vary depending on your platform (the subdirectory is named after the current configuration, e.g., `release`).
9286
On Windows, the generator is named `pythonqt_generator.exe`; on all other platforms, it is named `pythonqt_generator`.
9387

94-
`<generator-executable> qtscript_masterinclude.h build_all.txt`
88+
```bash
89+
<generator-executable> qtscript_masterinclude.h build_all.txt
90+
```
9591

96-
### PythonQt Runtime
9792

98-
Next, we need the PythonQt runtime.
93+
**Output location:** by default the generator emits to `../generated_cpp`
94+
(relative to the build). You can override this with:
9995

100-
1. cd into the `src` directory
101-
2. qmake `src.pro`
96+
```bash
97+
qmake PYTHONQT_GENERATED_PATH=/abs/path/to/generated_cpp
98+
```
10299

103-
`qmake CONFIG+=Release src.pro`
100+
#### qmake toggles (optional)
104101

105-
3. Make the runtime
102+
* `CONFIG+=generator_only`: build only the wrapper generator.
103+
* `CONFIG+=exclude_generator`: build everything **except** the generator.
106104

107-
Use `nmake` for MSVC (Visual Studio; make sure to have the environment variables set for Visual Studio beforehand). Otherwise, use `make`.
105+
Use these to (1) build the generator, (2) run it to produce `generated_cpp`, then (3) build the rest without rebuilding the generator.
108106

109-
### Extensions
110107

111-
As a last step, we need to build the extensions.
108+
### PythonQt Runtime
109+
110+
Next, build the runtime (and extensions) without the generator.
112111

113-
1. cd into `extensions`
114-
2. qmake `extensions.pro`
112+
1. Configure at the top level
115113

116-
`qmake CONFIG+=Release extensions.pro`
114+
```
115+
qmake CONFIG+=Release CONFIG+=exclude_generator PythonQt.pro
116+
```
117117

118-
3. Make the extensions
118+
2. Build
119119

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

122+
> The build will fail early if wrappers are missing from `../generated_cpp`
123+
> or the path specified via `PYTHONQT_GENERATED_PATH`.
124+
122125
After all these steps, you should now have a fully working PythonQt runtime and Qt bindings for your Python/Qt installation 🎉.
123126

124127
## MinGW

0 commit comments

Comments
 (0)